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; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 failTest("expected '" + expected + "', got '" + actual + "'."); | 256 failTest("expected '" + expected + "', got '" + actual + "'."); |
257 } | 257 } |
258 } | 258 } |
259 | 259 |
260 function assertTrue(booleanExpression, description) { | 260 function assertTrue(booleanExpression, description) { |
261 if (!booleanExpression) { | 261 if (!booleanExpression) { |
262 failTest(description); | 262 failTest(description); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 // Returns has-video-input-device to the test if there's a webcam available on | |
267 // the system. | |
268 function hasVideoInputDeviceOnSystem() { | |
269 MediaStreamTrack.getSources(function(devices) { | |
270 var hasVideoInputDevice = false; | |
271 devices.forEach(function(device) { | |
272 if (device.kind == 'video') | |
273 hasVideoInputDevice = true; | |
274 }); | |
275 | |
276 if (hasVideoInputDevice) | |
277 sendValueToTest('has-video-input-device'); | |
278 else | |
279 sendValueToTest('no-video-input-devices'); | |
280 }); | |
281 } | |
OLD | NEW |