From c28ed9273b6d2e54766b7a0112a50a436489b9d2 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Tue, 1 Jul 2014 15:38:03 +0200 Subject: [PATCH] Bug 1018928 - Expand Android gUM + gUM Doorhanger tests. r=mfinkle --- mobile/android/base/tests/robocop.ini | 2 + .../base/tests/robocop_getusermedia.html | 18 +++++- .../android/base/tests/testGetUserMedia.java | 55 ++++++++++++++++--- 3 files changed, 64 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/tests/robocop.ini b/mobile/android/base/tests/robocop.ini index a5f4defaa1b..f130e05d61c 100644 --- a/mobile/android/base/tests/robocop.ini +++ b/mobile/android/base/tests/robocop.ini @@ -40,6 +40,8 @@ skip-if = android_version == "10" skip-if = processor == "x86" [testFormHistory] [testGetUserMedia] +# disabled on 2.3; see bug 981881] +skip-if = android_version == "10" # [testHistory] # see bug 915350 [testHomeBanner] # disabled on x86 only; bug 957185 diff --git a/mobile/android/base/tests/robocop_getusermedia.html b/mobile/android/base/tests/robocop_getusermedia.html index 59300f6feb0..91a193d80da 100644 --- a/mobile/android/base/tests/robocop_getusermedia.html +++ b/mobile/android/base/tests/robocop_getusermedia.html @@ -4,6 +4,7 @@ +
- \ No newline at end of file + diff --git a/mobile/android/base/tests/testGetUserMedia.java b/mobile/android/base/tests/testGetUserMedia.java index 3a21b51f35e..0bdf7e5881f 100644 --- a/mobile/android/base/tests/testGetUserMedia.java +++ b/mobile/android/base/tests/testGetUserMedia.java @@ -8,8 +8,13 @@ public class testGetUserMedia extends BaseTest { String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html"); String GUM_MESSAGE = "Would you like to share your camera and microphone with"; - String GUM_ALLOW = "Share"; - String GUM_DENY = "Don't share"; + String GUM_ALLOW = "^Share$"; + String GUM_DENY = "^Don't Share$"; + + String GUM_PAGE_FAILED = "failed gumtest"; + String GUM_PAGE_AUDIO = "audio gumtest"; + String GUM_PAGE_VIDEO = "video gumtest"; + String GUM_PAGE_AUDIOVIDEO = "audiovideo gumtest"; blockForGeckoReady(); @@ -18,13 +23,45 @@ public class testGetUserMedia extends BaseTest { // getNumberOfCameras is Gingerbread/9+ // We could avoid that requirement by trying to open a Camera but we // already know our 2.2/Tegra test devices don't have them. - if (Build.VERSION.SDK_INT >= 9) { - if (Camera.getNumberOfCameras() > 0) { - // Test GUM notification - inputAndLoadUrl(GUM_URL); - waitForText(GUM_MESSAGE); - mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); - } + if (Build.VERSION.SDK_INT < 9) { + return; } + + if (Camera.getNumberOfCameras() <= 0) { + return; + } + // Test GUM notification showing + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); + mSolo.clickOnButton(GUM_DENY); + verifyPageTitle(GUM_PAGE_FAILED); + + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + // Cameras don't work on the testing hardware, so stream a tab + mSolo.clickOnText("Back facing camera"); + mSolo.clickOnText("Choose a tab to stream"); + mSolo.clickOnButton(GUM_ALLOW); + mSolo.clickOnText("gUM Test Page"); + verifyPageTitle(GUM_PAGE_AUDIOVIDEO); + + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + mSolo.clickOnText("Back facing camera"); + mSolo.clickOnText("No Video"); + mSolo.clickOnButton(GUM_ALLOW); + verifyPageTitle(GUM_PAGE_AUDIO); + + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + // Cameras don't work on the testing hardware, so stream a tab + mSolo.clickOnText("Back facing camera"); + mSolo.clickOnText("Choose a tab to stream"); + mSolo.clickOnText("Microphone 1"); + mSolo.clickOnText("No Audio"); + mSolo.clickOnButton(GUM_ALLOW); + mSolo.clickOnText("gUM Test Page"); + verifyPageTitle(GUM_PAGE_VIDEO); } }