mobile/android/base/tests/testGetUserMedia.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/tests/testGetUserMedia.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +package org.mozilla.gecko.tests;
     1.5 +
     1.6 +import android.hardware.Camera;
     1.7 +import android.os.Build;
     1.8 +
     1.9 +public class testGetUserMedia extends BaseTest {
    1.10 +    public void testGetUserMedia() {
    1.11 +        String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html");
    1.12 +
    1.13 +        String GUM_MESSAGE = "Would you like to share your camera and microphone with";
    1.14 +        String GUM_ALLOW = "Share";
    1.15 +        String GUM_DENY = "Don't share";
    1.16 +
    1.17 +        blockForGeckoReady();
    1.18 +
    1.19 +        // Only try GUM test if the device has a camera. If there's a working Camera,
    1.20 +        // we'll assume there is a working audio device as well.
    1.21 +        // getNumberOfCameras is Gingerbread/9+
    1.22 +        // We could avoid that requirement by trying to open a Camera but we
    1.23 +        // already know our 2.2/Tegra test devices don't have them.
    1.24 +        if (Build.VERSION.SDK_INT >= 9) {
    1.25 +            if (Camera.getNumberOfCameras() > 0) {
    1.26 +                // Test GUM notification
    1.27 +                inputAndLoadUrl(GUM_URL);
    1.28 +                waitForText(GUM_MESSAGE);
    1.29 +                mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed");
    1.30 +            }
    1.31 +        }
    1.32 +    }
    1.33 +}

mercurial