OLD | NEW |
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 // These must match with how the video and canvas tags are declared in html. | 5 // These must match with how the video and canvas tags are declared in html. |
6 const VIDEO_TAG_WIDTH = 320; | 6 const VIDEO_TAG_WIDTH = 320; |
7 const VIDEO_TAG_HEIGHT = 240; | 7 const VIDEO_TAG_HEIGHT = 240; |
8 | 8 |
9 // Fake video capture background green is of value 135. | 9 // Fake video capture background green is of value 135. |
10 const COLOR_BACKGROUND_GREEN = 135; | 10 const COLOR_BACKGROUND_GREEN = 135; |
11 | 11 |
12 // Number of test events to occur before the test pass. When the test pass, | 12 // Number of test events to occur before the test pass. When the test pass, |
13 // the function gAllEventsOccured is called. | 13 // the function gAllEventsOccured is called. |
14 var gNumberOfExpectedEvents = 0; | 14 var gNumberOfExpectedEvents = 0; |
15 | 15 |
16 // Number of events that currently have occurred. | 16 // Number of events that currently have occurred. |
17 var gNumberOfEvents = 0; | 17 var gNumberOfEvents = 0; |
18 | 18 |
19 var gAllEventsOccured = function () {}; | 19 var gAllEventsOccured = function () {}; |
20 | 20 |
21 // Use this function to set a function that will be called once all expected | 21 // Use this function to set a function that will be called once all expected |
22 // events has occurred. | 22 // events has occurred. |
23 function setAllEventsOccuredHandler(handler) { | 23 function setAllEventsOccuredHandler(handler) { |
24 gAllEventsOccured = handler; | 24 gAllEventsOccured = handler; |
25 } | 25 } |
26 | 26 |
27 // Tells the C++ code we succeeded, which will generally exit the test. | 27 // Tells the C++ code we succeeded, which will generally exit the test. |
28 function reportTestSuccess() { | 28 function reportTestSuccess() { |
| 29 console.log('Test Success'); |
29 window.domAutomationController.send('OK'); | 30 window.domAutomationController.send('OK'); |
30 } | 31 } |
31 | 32 |
32 // Returns a custom return value to the test. | 33 // Returns a custom return value to the test. |
33 function sendValueToTest(value) { | 34 function sendValueToTest(value) { |
34 window.domAutomationController.send(value); | 35 window.domAutomationController.send(value); |
35 } | 36 } |
36 | 37 |
37 // Immediately fails the test on the C++ side. | 38 // Immediately fails the test on the C++ side. |
38 function failTest(reason) { | 39 function failTest(reason) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (device.kind == 'video') | 262 if (device.kind == 'video') |
262 hasVideoInputDevice = true; | 263 hasVideoInputDevice = true; |
263 }); | 264 }); |
264 | 265 |
265 if (hasVideoInputDevice) | 266 if (hasVideoInputDevice) |
266 sendValueToTest('has-video-input-device'); | 267 sendValueToTest('has-video-input-device'); |
267 else | 268 else |
268 sendValueToTest('no-video-input-devices'); | 269 sendValueToTest('no-video-input-devices'); |
269 }); | 270 }); |
270 } | 271 } |
OLD | NEW |