|
1 package org.mozilla.gecko.tests; |
|
2 |
|
3 import android.hardware.Camera; |
|
4 import android.os.Build; |
|
5 |
|
6 public class testGetUserMedia extends BaseTest { |
|
7 public void testGetUserMedia() { |
|
8 String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html"); |
|
9 |
|
10 String GUM_MESSAGE = "Would you like to share your camera and microphone with"; |
|
11 String GUM_ALLOW = "Share"; |
|
12 String GUM_DENY = "Don't share"; |
|
13 |
|
14 blockForGeckoReady(); |
|
15 |
|
16 // Only try GUM test if the device has a camera. If there's a working Camera, |
|
17 // we'll assume there is a working audio device as well. |
|
18 // getNumberOfCameras is Gingerbread/9+ |
|
19 // We could avoid that requirement by trying to open a Camera but we |
|
20 // already know our 2.2/Tegra test devices don't have them. |
|
21 if (Build.VERSION.SDK_INT >= 9) { |
|
22 if (Camera.getNumberOfCameras() > 0) { |
|
23 // Test GUM notification |
|
24 inputAndLoadUrl(GUM_URL); |
|
25 waitForText(GUM_MESSAGE); |
|
26 mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); |
|
27 } |
|
28 } |
|
29 } |
|
30 } |