mobile/android/base/tests/testGetUserMedia.java

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial