Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java

Issue 2462963002: Implement modal permission prompts for media permissions on Android. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java
index 5f452a7c17b73eab442998a1ae237ed13604d10b..b6a88bf965f7e16b17cef6836fd4bec89ef571a4 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/permissions/MediaTest.java
@@ -40,19 +40,46 @@ public class MediaTest extends PermissionTestCaseBase {
@MediumTest
@Feature({"MediaPermissions", "Main"})
@CommandLineFlags.Add(FAKE_DEVICE)
- public void testMicrophonePermissionsPlumbing() throws Exception {
+ public void testMicrophonePermissionsPlumbingInfoBar() throws Exception {
testMediaPermissionsPlumbing(
"Mic count:", "initiate_getMicrophone()", 1, false, false, false, false);
raymes 2016/11/02 08:09:03 All these bools arguments are a little confusing -
dominickn 2016/11/03 00:34:09 Acknowledged.
}
/**
+ * Verify asking for microphone creates a dialog and works when the permission is granted.
+ * @throws Exception
+ */
+ @Smoke
+ @MediumTest
+ @Feature({"MediaPermissions", "Main"})
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_FLAG})
+ public void testMicrophoneMediaPermissionsPlumbingDialog() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Mic count:", "initiate_getMicrophone()", 1, true, true, false, false);
+ }
+
+ /**
* Verify asking for camera creates an InfoBar and works when the permission is granted.
* @throws Exception
*/
@MediumTest
@Feature({"MediaPermissions", "Main"})
@CommandLineFlags.Add(FAKE_DEVICE)
- public void testCameraPermissionsPlumbing() throws Exception {
+ public void testCameraPermissionsPlumbingInfoBar() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Camera count:", "initiate_getCamera()", 1, false, false, false, false);
+ }
+
+ /**
+ * Verify asking for camera creates an infobar with no gesture and works when the permission
+ * is granted.
+ * @throws Exception
+ */
+ @Smoke
+ @MediumTest
+ @Feature({"MediaPermissions", "Main"})
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_FLAG})
+ public void testCameraPermissionsPlumbingNoGestureCreatesInfoBar() throws Exception {
testMediaPermissionsPlumbing(
"Camera count:", "initiate_getCamera()", 1, false, false, false, false);
}
@@ -71,32 +98,71 @@ public class MediaTest extends PermissionTestCaseBase {
}
/**
- * Verify microphone prompts with a persistence toggle if that feature is enabled. Check the
- * switch appears and that permission is granted with it toggled on.
+ * Verify asking for both mic and camera creates a combined dialog and works when the
+ * permissions are granted.
+ * @throws Exception
+ */
+ @MediumTest
+ @Feature({"MediaPermissions", "Main"})
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_FLAG})
+ public void testCombinedPermissionsPlumbingDialog() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Combined count:", "initiate_getCombined()", 1, true, true, false, false);
+ }
+
+ /**
+ * Verify microphone creates an InfoBar with a persistence toggle if that feature is enabled.
+ * Check the switch appears and that permission is granted with it toggled on.
* @throws Exception
*/
@MediumTest
@CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + TOGGLE_FLAG})
@Feature({"MediaPermissions"})
- public void testMicrophonePersistenceOn() throws Exception {
+ public void testMicrophonePersistenceOnInfoBar() throws Exception {
testMediaPermissionsPlumbing(
"Mic count:", "initiate_getMicrophone()", 1, false, false, true, false);
}
/**
- * Verify microphone prompts with a persistence toggle if that feature is enabled. Check the
- * switch appears and that permission is granted with it toggled off.
+ * Verify microphone creates an InfoBar with a persistence toggle if that feature is enabled.
+ * Check the switch appears and that permission is granted with it toggled off.
* @throws Exception
*/
@MediumTest
@CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + TOGGLE_FLAG})
@Feature({"MediaPermissions"})
- public void testMicrophonePersistenceOff() throws Exception {
+ public void testMicrophonePersistenceOffInfoBar() throws Exception {
testMediaPermissionsPlumbing(
"Mic count:", "initiate_getMicrophone()", 1, false, false, true, true);
}
/**
+ * Verify microphone creates a dialog with a persistence toggle if that feature is enabled.
+ * Check the switch appears and that permission is granted with it toggled on.
+ * @throws Exception
+ */
+ @MediumTest
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG})
+ @Feature({"MediaPermissions"})
+ public void testMicrophonePersistenceOnDialog() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Mic count:", "initiate_getMicrophone()", 1, true, true, true, false);
+ }
+
+ /**
+ * Verify microphone creates a dialog with a persistence toggle if that feature is enabled.
+ * Check the switch appears and that permission is granted with it toggled off.
+ * @throws Exception
+ */
+ @MediumTest
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG})
+ @Feature({"MediaPermissions"})
+ public void testMicrophonePersistenceOffDialog() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Mic count:", "initiate_getMicrophone()", 1, true, true, true, true);
+ }
+
+ /**
* Verify camera prompts with a persistence toggle if that feature is enabled. Check the
* switch appears and that permission is granted with it toggled on.
* @throws Exception
@@ -123,27 +189,53 @@ public class MediaTest extends PermissionTestCaseBase {
}
/**
- * Verify combined prompts show a persistence toggle if that feature is enabled. Check the
- * switch appears and that permission is granted with it toggled on.
+ * Verify combined creates an InfoBar with a persistence toggle if that feature is enabled.
+ * Check the switch appears and that permission is granted with it toggled on.
* @throws Exception
*/
@MediumTest
@CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + TOGGLE_FLAG})
@Feature({"MediaPermissions"})
- public void testCombinedPersistenceOn() throws Exception {
+ public void testCombinedPersistenceOnInfoBar() throws Exception {
testMediaPermissionsPlumbing(
"Combined count:", "initiate_getCombined()", 1, false, false, true, false);
}
/**
- * Verify combined prompts show a persistence toggle if that feature is enabled. Check the
- * switch appears and that permission is granted with it toggled of.
+ * Verify combined creates an InfoBar with a persistence toggle if that feature is enabled.
+ * Check the switch appears and that permission is granted with it toggled of.
* @throws Exception
*/
@MediumTest
@CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + TOGGLE_FLAG})
@Feature({"MediaPermissions"})
- public void testCombinedPersistenceOff() throws Exception {
+ public void testCombinedPersistenceOffInfoBar() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Combined count:", "initiate_getCombined()", 1, false, false, true, true);
+ }
+
+ /**
+ * Verify combined creates a dialog with a persistence toggle if that feature is enabled. Check
+ * the switch appears and that permission is granted with it toggled on.
+ * @throws Exception
+ */
+ @MediumTest
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG})
+ @Feature({"MediaPermissions"})
+ public void testCombinedPersistenceOnDialog() throws Exception {
+ testMediaPermissionsPlumbing(
+ "Combined count:", "initiate_getCombined()", 1, true, true, true, false);
+ }
+
+ /**
+ * Verify combined creates a dialog with a persistence toggle if that feature is enabled. Check
+ * the switch appears and that permission is granted with it toggled of.
+ * @throws Exception
+ */
+ @MediumTest
+ @CommandLineFlags.Add({FAKE_DEVICE, "enable-features=" + MODAL_TOGGLE_FLAG})
+ @Feature({"MediaPermissions"})
+ public void testCombinedPersistenceOffDialog() throws Exception {
testMediaPermissionsPlumbing(
"Combined count:", "initiate_getCombined()", 1, false, false, true, true);
}

Powered by Google App Engine
This is Rietveld 408576698