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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 failTest("expected '" + expected + "', got '" + actual + "'."); | 206 failTest("expected '" + expected + "', got '" + actual + "'."); |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 function assertNotEquals(expected, actual) { | 210 function assertNotEquals(expected, actual) { |
211 if (actual === expected) { | 211 if (actual === expected) { |
212 failTest("expected '" + expected + "', got '" + actual + "'."); | 212 failTest("expected '" + expected + "', got '" + actual + "'."); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
| 216 // Returns has-video-input-device to the test if there's a webcam available on |
| 217 // the system. |
| 218 function hasVideoInputDeviceOnSystem() { |
| 219 MediaStreamTrack.getSources(function(devices) { |
| 220 var hasVideoInputDevice = false; |
| 221 devices.forEach(function(device) { |
| 222 if (device.kind == 'video') |
| 223 hasVideoInputDevice = true; |
| 224 }); |
| 225 |
| 226 if (hasVideoInputDevice) |
| 227 sendValueToTest('has-video-input-device'); |
| 228 else |
| 229 sendValueToTest('no-video-input-devices'); |
| 230 }); |
| 231 } |
OLD | NEW |