Closed Bug 922609 Opened 11 years ago Closed 11 years ago

Provide a way for tests to determine that the video app has finished scanning

Categories

(Firefox OS Graveyard :: Gaia::Video, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: davehunt, Assigned: vsireesha246)

References

Details

(Keywords: perf, Whiteboard: [c=automation p= s= u=])

Attachments

(1 file)

We need a reliable method to wait for the Video app to have loaded all thumbnails. At the moment we use a combination of the appload event, checking for the expected number of thumbnails, and checking for the progress bar to be hidden. Ideally we would be able to combine the appload event with another event or dom change that indicates that the scan has completed. This existing waits can be seen here: https://github.com/mozilla/b2gperf/blob/15cbbd8441e70fd6170a268649f3f00617ba7068/b2gperf/b2gperf.py#L764
Keywords: perf
Whiteboard: [c=automation p= s= u=]
Hi Dave, I may help to add that. But I am not sure what you mean the timing loaded all thumbnails. Do you mean the time we generate all thumbnails? If yes, that's the moment of metadata parsing. The correct position of that event is at [1]. Please note, there is a function call hideThrobber before that line that hideThrobber hides the progress bar. [1] https://github.com/mozilla-b2g/gaia/blob/master/apps/video/js/metadata.js#L98
Flags: needinfo?(dave.hunt)
Hi John. For these particular tests we populate the device with 200 videos, and want to scroll smoothly through the thumbnails. In order to do this we need to wait for all of the thumbnails to be loaded, otherwise the scroll height varies as the thumbnails appear. Looking at the referenced code, I think you're right. If we had an event fired at the point where we stop parsing the metadata, we could use this to wait for the video app to be in a usable state.
Flags: needinfo?(dave.hunt)
Hi Dave, If you want the timing that video app created all thumbnail HTML elements, it is at[1]. But that doesn't mean all thumbnail images are loaded. It just created the HTML elements and appended them to DOM tree. At this timing, user can still scroll the list without all images loaded. If you want the timing all thumbnail images are loaded and shown on the screen, I don't think we have the chance to do that. Because video app doesn't listen onload event of thumbnail images. [1] https://github.com/mozilla-b2g/gaia/blob/35b5c926e952c505dcc7f563a26f3640364326f3/apps/video/js/db.js#L101
It's not the timing that we're after, it's something to wait for before continuing with user interactions. At the moment we wait for the appload event, followed by waiting for the number of thumbnails to be the number we're expecting, followed by waiting for the progress bar to be hidden. If there was another custom even such as videostartupdone or similar, we could instead just wait for this.
Hi Dave, Since we land the patch of flatfish, we do have a place waiting for the scanning finished[1]. But we don't have any custom event. If you have any preferred event, I can dispatch that event for you. [1] https://github.com/mozilla-b2g/gaia/blob/a3913b3b4dc1075638181f898da3555b3108a58d/apps/video/js/video.js#L671
Flags: needinfo?(dave.hunt)
Looking at this, we might be able to wait for spinnerOverlay to be hidden, or playerView to be displayed. A more determinable event for having finished the scan would be great though. Can I just check, is this for every launch, or just cold launches?
Flags: needinfo?(dave.hunt)
(In reply to Dave Hunt (:davehunt) from comment #6) > Looking at this, we might be able to wait for spinnerOverlay to be hidden, > or playerView to be displayed. A more determinable event for having finished > the scan would be great though. Can I just check, is this for every launch, > or just cold launches? I don't know what the every launch and code launch mean. If cold launch means to launch without existing video instance and every launch means to bring the background video instance to foreground, it only executes at cold launch.
Yes, a cold launch is when the application is not already running in the background. Does a scan not happen at all on a warm launch (when the application is running in the background)? It would be good to have a sinble event that fires in both launch cases.
That said, my particular use case is for cold launches, so having an event that indicates the initial scan after a cold launch has completed would suit my needs.
A full-scan only happens at cold launch. Since it is on the background, we use the change event from device storage to find the creation of video file and do the metadata parsing. Which event name do you prefer? And I need to use PerformanceTestingHelper.dispatch('name') to dispatch that, right?
(In reply to John Hu [:johnhu] from comment #10) > A full-scan only happens at cold launch. > > Since it is on the background, we use the change event from device storage > to find the creation of video file and do the metadata parsing. How about something like 'scanfinished'? > Which event name do you prefer? And I need to use > PerformanceTestingHelper.dispatch('name') to dispatch that, right? I'm not familiar with the PerformanceTestingHelper. So long as I can handle this event from the application context then we should be good. Julien, does this make sense to you?
Flags: needinfo?(felash)
(In reply to Dave Hunt (:davehunt) from comment #11) > > Which event name do you prefer? And I need to use > > PerformanceTestingHelper.dispatch('name') to dispatch that, right? > > I'm not familiar with the PerformanceTestingHelper. So long as I can handle > this event from the application context then we should be good. Another alternative is to dispatch the custom event to window object.
The PerformanceTestingHelper is simply sending events to "window", but only when "window.mozPerfHasListener" is true (this was to avoid sending events when nobody listens). So that should work perfectly!
Flags: needinfo?(felash)
Then we need to add the video app to the "startup_event" perf test. But that's a no brainer.
This is 2 different issues: if the app sends perf events, then we _can_ add the video app to the perf tests, but that wouldn't help the integration tests ;)
Assignee: nobody → vsireesha246
Hi Dave, Would you please suggest me how to set window.mozPerfHasListener? I am dispatching PerformanceTestingHelper.dispatch('sacn-finished') and due to window.mozPerfHasListene=false it is retuning.
Flags: needinfo?(dave.hunt)
mozPerfHasListener is set by the marionette script, either from b2gperf or from |make test-perf| depending on how you run it. See gaia//tests/performance/performance_helper_atom.js for example (that's the one used by |make test-perf|)
Flags: needinfo?(dave.hunt)
Attached file Pointer to Pull Request.html (deleted) —
Hi John, Would you please review the patch and let me know the review comments. Thanks.. Sireesha
Attachment #8371228 - Flags: review?(johu)
Comment on attachment 8371228 [details] Pointer to Pull Request.html Thanks sireesha for this patch. It works correctly.
Attachment #8371228 - Flags: review?(johu) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: