Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/test/data/prerender/prerender_html5_common.js

Issue 10546103: Adding debugging for PrerenderBrowserTest.PrerenderHTML5Video tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Common js for the HTML5_* tests. The following variables need to be defined 5 // Common js for the HTML5_* tests. The following variables need to be defined
6 // before this js is included: 6 // before this js is included:
7 // - 'willPlay' - indicates if the media is expected to start playing during 7 // - 'willPlay' - indicates if the media is expected to start playing during
8 // the test. 8 // the test.
9 // - 'testNetworkEvents' - if set to true, the test will test for the 9 // - 'testNetworkEvents' - if set to true, the test will test for the
10 // loadstart and stalled events. NOTE that since the loadstart event fires 10 // loadstart and stalled events. NOTE that since the loadstart event fires
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 mediaEl.addEventListener('playing', mediaEventHandler, false); 70 mediaEl.addEventListener('playing', mediaEventHandler, false);
71 mediaEl.addEventListener('canplay', mediaEventHandler, false); 71 mediaEl.addEventListener('canplay', mediaEventHandler, false);
72 mediaEl.addEventListener('canplaythrough', mediaEventHandler, false); 72 mediaEl.addEventListener('canplaythrough', mediaEventHandler, false);
73 mediaEl.addEventListener('error', mediaEventHandler, false); 73 mediaEl.addEventListener('error', mediaEventHandler, false);
74 74
75 if (testNetworkEvents) { 75 if (testNetworkEvents) {
76 mediaEl.addEventListener('stalled', mediaEventHandler, false); 76 mediaEl.addEventListener('stalled', mediaEventHandler, false);
77 mediaEl.addEventListener('loadstart', mediaEventHandler, false); 77 mediaEl.addEventListener('loadstart', mediaEventHandler, false);
78 } 78 }
79 79
80 // TODO(shishir): Remove this once http://crbug.com/130788 is fixed.
81 function printDebugInfo() {
82 console.log("\ncanPlaySeen: " + canPlaySeen);
83 console.log("playingSeen: " + playingSeen);
84 console.log("canPlayThroughSeen: " + canPlayThroughSeen);
85 console.log("loadStartSeen: " + loadStartSeen);
86 console.log("stalledSeen: " + stalledSeen);
87 console.log("hasError: " + hasError + "\n");
88 }
89 setInterval(printDebugInfo, 5000);
90
80 function DidPrerenderPass() { 91 function DidPrerenderPass() {
81 // The media should not have started at this point. 92 // The media should not have started at this point.
82 return !canPlaySeen && !playingSeen && !hasError && 93 return !canPlaySeen && !playingSeen && !hasError &&
83 mediaEl.currentTime == 0 && 94 mediaEl.currentTime == 0 &&
84 mediaEl.readyState == mediaEl.HAVE_NOTHING && 95 mediaEl.readyState == mediaEl.HAVE_NOTHING &&
85 (!testNetworkEvents || stalledSeen); 96 (!testNetworkEvents || stalledSeen);
86 } 97 }
87 98
88 function DidDisplayPass() { 99 function DidDisplayPass() {
89 // The actual test is done via the TitleWatcher. 100 // The actual test is done via the TitleWatcher.
90 return true; 101 return true;
91 } 102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698