michael@0: package org.mozilla.gecko.tests; michael@0: michael@0: import android.hardware.Camera; michael@0: import android.os.Build; michael@0: michael@0: public class testGetUserMedia extends BaseTest { michael@0: public void testGetUserMedia() { michael@0: String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html"); michael@0: michael@0: String GUM_MESSAGE = "Would you like to share your camera and microphone with"; michael@0: String GUM_ALLOW = "Share"; michael@0: String GUM_DENY = "Don't share"; michael@0: michael@0: blockForGeckoReady(); michael@0: michael@0: // Only try GUM test if the device has a camera. If there's a working Camera, michael@0: // we'll assume there is a working audio device as well. michael@0: // getNumberOfCameras is Gingerbread/9+ michael@0: // We could avoid that requirement by trying to open a Camera but we michael@0: // already know our 2.2/Tegra test devices don't have them. michael@0: if (Build.VERSION.SDK_INT >= 9) { michael@0: if (Camera.getNumberOfCameras() > 0) { michael@0: // Test GUM notification michael@0: inputAndLoadUrl(GUM_URL); michael@0: waitForText(GUM_MESSAGE); michael@0: mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); michael@0: } michael@0: } michael@0: } michael@0: }