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

Side by Side Diff: chrome/test/data/extensions/api_test/tab_capture/performance.js

Issue 121203002: Use window.URL instead of window.webkitURL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: window.URL -> URL in user_images_grid.js Created 6 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // The tests here cover the end-to-end functionality of tab capturing and 5 // The tests here cover the end-to-end functionality of tab capturing and
6 // playback as video. The page generates a test patter (moving balls) and 6 // playback as video. The page generates a test patter (moving balls) and
7 // the rendering output of the tab is captured into a LocalMediaStream. Then, 7 // the rendering output of the tab is captured into a LocalMediaStream. Then,
8 // the LocalMediaStream is plugged into a video element for playback. 8 // the LocalMediaStream is plugged into a video element for playback.
9 // 9 //
10 10
11 // Global to prevent gc from eating the video tag. 11 // Global to prevent gc from eating the video tag.
12 var video = null; 12 var video = null;
13 13
14 function TestStream(stream) { 14 function TestStream(stream) {
15 // Create video and canvas elements, but no need to append them to the 15 // Create video and canvas elements, but no need to append them to the
16 // DOM. 16 // DOM.
17 video = document.createElement("video"); 17 video = document.createElement("video");
18 video.width = 1920; 18 video.width = 1920;
19 video.height = 1080; 19 video.height = 1080;
20 video.addEventListener("error", chrome.test.fail); 20 video.addEventListener("error", chrome.test.fail);
21 21
22 var canvas = document.createElement("canvas"); 22 var canvas = document.createElement("canvas");
23 canvas.width = video.width; 23 canvas.width = video.width;
24 canvas.height = video.height; 24 canvas.height = video.height;
25 var context = canvas.getContext("2d"); 25 var context = canvas.getContext("2d");
26 document.body.appendChild(canvas); 26 document.body.appendChild(canvas);
27 var start_time = new Date().getTime(); 27 var start_time = new Date().getTime();
28 28
29 // Play the LocalMediaStream in the video element. 29 // Play the LocalMediaStream in the video element.
30 video.src = webkitURL.createObjectURL(stream); 30 video.src = URL.createObjectURL(stream);
31 video.play(); 31 video.play();
32 32
33 var frame = 0; 33 var frame = 0;
34 function draw() { 34 function draw() {
35 // Run for 10 seconds. 35 // Run for 10 seconds.
36 if (new Date().getTime() - start_time > 10000) { 36 if (new Date().getTime() - start_time > 10000) {
37 chrome.test.succeed(); 37 chrome.test.succeed();
38 // Note that the API testing framework might not terminate if we keep 38 // Note that the API testing framework might not terminate if we keep
39 // animating and capturing, so we have to make sure that we stop doing 39 // animating and capturing, so we have to make sure that we stop doing
40 // that here. 40 // that here.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 } 110 }
111 }, 111 },
112 TestStream); 112 TestStream);
113 } 113 }
114 114
115 chrome.test.runTests([ tabCapturePerformanceTest ]); 115 chrome.test.runTests([ tabCapturePerformanceTest ]);
116 116
117 // TODO(hubbe): Consider capturing audio as well, need to figure out how to 117 // TODO(hubbe): Consider capturing audio as well, need to figure out how to
118 // capture relevant statistics for that though. 118 // capture relevant statistics for that though.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698