Commit 26b67bb7 authored by bsheedy's avatar bsheedy Committed by Commit Bot

Update VR dialog tests to be RenderTests

Updates all of the tests in VrBrowserDialogTest to be actual
RenderTests instead of just capturing an image and doing nothing with
it. Also moves the majority of them out into different test classes
that are more appropriate for what they are testing since most aren't
actually for permission dialogs.

Bug: 887505, 864775, 862182
Change-Id: If65738034d49558f48d89ab26dda8aacc15c4774
Reviewed-on: https://chromium-review.googlesource.com/c/1414192
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarBill Orr <billorr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630063}
parent f29748c7
...@@ -841,6 +841,7 @@ if (enable_vr || (enable_arcore && package_arcore)) { ...@@ -841,6 +841,7 @@ if (enable_vr || (enable_arcore && package_arcore)) {
"javatests/src/org/chromium/chrome/browser/vr/util/HeadTrackingUtils.java", "javatests/src/org/chromium/chrome/browser/vr/util/HeadTrackingUtils.java",
"javatests/src/org/chromium/chrome/browser/vr/util/NativeUiUtils.java", "javatests/src/org/chromium/chrome/browser/vr/util/NativeUiUtils.java",
"javatests/src/org/chromium/chrome/browser/vr/util/NfcSimUtils.java", "javatests/src/org/chromium/chrome/browser/vr/util/NfcSimUtils.java",
"javatests/src/org/chromium/chrome/browser/vr/util/RenderTestUtils.java",
"javatests/src/org/chromium/chrome/browser/vr/util/VrBrowserTransitionUtils.java", "javatests/src/org/chromium/chrome/browser/vr/util/VrBrowserTransitionUtils.java",
"javatests/src/org/chromium/chrome/browser/vr/util/VrInfoBarUtils.java", "javatests/src/org/chromium/chrome/browser/vr/util/VrInfoBarUtils.java",
"javatests/src/org/chromium/chrome/browser/vr/util/VrSettingsServiceUtils.java", "javatests/src/org/chromium/chrome/browser/vr/util/VrSettingsServiceUtils.java",
...@@ -881,6 +882,7 @@ if (enable_vr || (enable_arcore && package_arcore)) { ...@@ -881,6 +882,7 @@ if (enable_vr || (enable_arcore && package_arcore)) {
"//chrome/android/shared_preference_files/test/", "//chrome/android/shared_preference_files/test/",
"//components/test/data/js_dialogs/render_tests/", "//components/test/data/js_dialogs/render_tests/",
"//components/test/data/permission_dialogs/render_tests/", "//components/test/data/permission_dialogs/render_tests/",
"//components/test/data/vr_browser_ui/render_tests/",
"//third_party/gvr-android-sdk/test-apks/", "//third_party/gvr-android-sdk/test-apks/",
] ]
} }
......
...@@ -11,6 +11,7 @@ import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V ...@@ -11,6 +11,7 @@ import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V
import android.graphics.PointF; import android.graphics.PointF;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.test.filters.LargeTest;
import android.support.test.filters.MediumTest; import android.support.test.filters.MediumTest;
import org.junit.Assert; import org.junit.Assert;
...@@ -20,17 +21,21 @@ import org.junit.Test; ...@@ -20,17 +21,21 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI; import org.chromium.chrome.browser.payments.ui.PaymentRequestUI;
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest; import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest;
import org.chromium.chrome.browser.vr.rules.ChromeTabbedActivityVrTestRule; import org.chromium.chrome.browser.vr.rules.ChromeTabbedActivityVrTestRule;
import org.chromium.chrome.browser.vr.util.NativeUiUtils; import org.chromium.chrome.browser.vr.util.NativeUiUtils;
import org.chromium.chrome.browser.vr.util.RenderTestUtils;
import org.chromium.chrome.browser.vr.util.VrBrowserTransitionUtils; import org.chromium.chrome.browser.vr.util.VrBrowserTransitionUtils;
import org.chromium.chrome.browser.vr.util.VrShellDelegateUtils; import org.chromium.chrome.browser.vr.util.VrShellDelegateUtils;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.RenderTestRule;
import java.io.IOException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
...@@ -46,6 +51,10 @@ public class VrBrowserNativeUiTest { ...@@ -46,6 +51,10 @@ public class VrBrowserNativeUiTest {
@Rule @Rule
public ChromeTabbedActivityVrTestRule mVrTestRule = new ChromeTabbedActivityVrTestRule(); public ChromeTabbedActivityVrTestRule mVrTestRule = new ChromeTabbedActivityVrTestRule();
@Rule
public RenderTestRule mRenderTestRule =
new RenderTestRule("components/test/data/vr_browser_ui/render_tests");
private VrBrowserTestFramework mVrBrowserTestFramework; private VrBrowserTestFramework mVrBrowserTestFramework;
private static final String TEST_PAGE_2D_URL = private static final String TEST_PAGE_2D_URL =
...@@ -281,4 +290,68 @@ public class VrBrowserNativeUiTest { ...@@ -281,4 +290,68 @@ public class VrBrowserNativeUiTest {
ChromeTabUtils.waitForTabPageLoaded( ChromeTabUtils.waitForTabPageLoaded(
mVrTestRule.getActivity().getActivityTab(), "chrome://va/"); mVrTestRule.getActivity().getActivityTab(), "chrome://va/");
} }
/**
* Tests that the keyboard appears when clicking on the URL bar.
* Also contains a regression test for https://crbug.com/874671 where inputting text into the
* URL bar would cause a browser crash.
*/
@Test
@LargeTest
@Feature({"Browser", "RenderTest"})
public void testKeyboardAppearsOnUrlBarClick()
throws InterruptedException, TimeoutException, IOException {
NativeUiUtils.clickElementAndWaitForUiQuiescence(UserFriendlyElementName.URL, new PointF());
// For whatever reason, the laser has a lot of random noise (not visible to an actual user)
// when the keyboard is present on certain OS/hardware configurations (currently known to
// happen on Pixel XL w/ N). So, point the controller off to the right so the laser isn't
// visible.
NativeUiUtils.hoverElement(UserFriendlyElementName.OMNIBOX_TEXT_FIELD, new PointF(3f, 0f));
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
"keyboard_visible_browser_ui", mRenderTestRule);
// Regression test for https://crbug.com/874671
// We need to use the VrCore-side emulated controller because the keyboard isn't a UI
// element, meaning we can't specify it as a click target for the Chrome-side controller.
NativeUiUtils.revertToRealInput();
// Point at the keyboard and click an arbitrary key
EmulatedVrController controller = new EmulatedVrController(mVrTestRule.getActivity());
controller.recenterView();
controller.moveControllerInstant(0.0f, -0.259f, -0.996f, -0.0f);
// Spam clicks to ensure we're getting one in.
for (int i = 0; i < 5; i++) {
controller.performControllerClick();
}
}
/**
* Tests that the overflow menu appears when the overflow menu button is clicked.
*/
@Test
@LargeTest
@Feature({"Browser", "RenderTest"})
public void testOverflowMenuAppears()
throws InterruptedException, TimeoutException, IOException {
NativeUiUtils.clickElementAndWaitForUiQuiescence(
UserFriendlyElementName.OVERFLOW_MENU, new PointF());
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
"overflow_menu_visible_browser_ui", mRenderTestRule);
}
/**
* Tests that the page info popup appears when the security token in the URL bar is clicked.
*/
@Test
@LargeTest
@Feature({"Browser", "RenderTest"})
public void testPageInfoAppearsOnSecurityTokenClick()
throws InterruptedException, TimeoutException, IOException {
NativeUiUtils.clickElementAndWaitForUiQuiescence(
UserFriendlyElementName.PAGE_INFO_BUTTON, new PointF());
// Workaround for https://crbug.com/893291, where the text doesn't actually show up until a
// bit after the element is drawn.
SystemClock.sleep(1000);
NativeUiUtils.waitForUiQuiescence();
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
"page_info_visible_browser_ui", mRenderTestRule);
}
} }
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
package org.chromium.chrome.browser.vr.jsdialog; package org.chromium.chrome.browser.vr.jsdialog;
import static org.chromium.chrome.browser.vr.XrTestFramework.PAGE_LOAD_TIMEOUT_S;
import static org.chromium.chrome.browser.vr.XrTestFramework.POLL_TIMEOUT_LONG_MS; import static org.chromium.chrome.browser.vr.XrTestFramework.POLL_TIMEOUT_LONG_MS;
import static org.chromium.chrome.browser.vr.XrTestFramework.POLL_TIMEOUT_SHORT_MS;
import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_VIEWER_DAYDREAM; import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_VIEWER_DAYDREAM;
import android.support.test.filters.MediumTest; import android.support.test.filters.MediumTest;
...@@ -15,20 +17,20 @@ import org.junit.Rule; ...@@ -15,20 +17,20 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.jsdialog.JavascriptAppModalDialog; import org.chromium.chrome.browser.vr.UserFriendlyElementName;
import org.chromium.chrome.browser.vr.VrBrowserTestFramework;
import org.chromium.chrome.browser.vr.rules.ChromeTabbedActivityVrTestRule; import org.chromium.chrome.browser.vr.rules.ChromeTabbedActivityVrTestRule;
import org.chromium.chrome.browser.vr.util.NativeUiUtils; import org.chromium.chrome.browser.vr.util.NativeUiUtils;
import org.chromium.chrome.browser.vr.util.RenderTestUtils;
import org.chromium.chrome.browser.vr.util.VrBrowserTransitionUtils; import org.chromium.chrome.browser.vr.util.VrBrowserTransitionUtils;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.util.RenderTestRule; import org.chromium.chrome.test.util.RenderTestRule;
import org.chromium.content_public.browser.test.util.JavaScriptUtils; import org.chromium.content_public.browser.test.util.JavaScriptUtils;
import org.chromium.ui.modaldialog.ModalDialogProperties;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
...@@ -48,10 +50,20 @@ public class VrBrowserJavaScriptModalDialogTest { ...@@ -48,10 +50,20 @@ public class VrBrowserJavaScriptModalDialogTest {
new RenderTestRule("components/test/data/js_dialogs/render_tests"); new RenderTestRule("components/test/data/js_dialogs/render_tests");
private ChromeTabbedActivity mActivity; private ChromeTabbedActivity mActivity;
private VrBrowserTestFramework mVrBrowserTestFramework;
@Before @Before
public void setUp() throws InterruptedException { public void setUp() throws InterruptedException {
mActivity = mActivityTestRule.getActivity(); mActivity = mActivityTestRule.getActivity();
mVrBrowserTestFramework = new VrBrowserTestFramework(mActivityTestRule);
mVrBrowserTestFramework.loadUrlAndAwaitInitialization(
VrBrowserTestFramework.getFileUrlForHtmlTestFile("2d_permission_page"),
PAGE_LOAD_TIMEOUT_S);
VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS);
NativeUiUtils.enableMockedInput();
// Wait for any residual animations from entering VR to finish so that they don't get caught
// later.
NativeUiUtils.waitForUiQuiescence();
} }
/** /**
...@@ -60,61 +72,80 @@ public class VrBrowserJavaScriptModalDialogTest { ...@@ -60,61 +72,80 @@ public class VrBrowserJavaScriptModalDialogTest {
@Test @Test
@MediumTest @MediumTest
@Feature({"Browser", "RenderTest"}) @Feature({"Browser", "RenderTest"})
public void testAlertModalDialog() throws ExecutionException, IOException { public void testAlertModalDialog()
testModalDialogImpl("js_modal_view_vr_alert", "alert('Hello Android!')"); throws InterruptedException, ExecutionException, IOException {
NativeUiUtils.performActionAndWaitForUiQuiescence(() -> {
NativeUiUtils.performActionAndWaitForVisibilityStatus(
UserFriendlyElementName.BROWSING_DIALOG, true /* visible */, () -> {
JavaScriptUtils.executeJavaScript(
mActivity.getCurrentWebContents(), "alert('Hello Android!')");
});
});
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
"js_modal_view_vr_alert_visible_browser_ui", mRenderTestRule);
// No assertNoJavaScriptErrors since the alert is still visible, preventing further
// JavaScript execution.
} }
/** /**
* Verifies modal confirm-dialog appearance and that it looks as it is expected. * Verifies modal confirm-dialog appearance and that it looks as it is expected. Additionally,
* verifies that its "Cancel" button works as expected.
*/ */
@Test @Test
@MediumTest @MediumTest
@Feature({"Browser", "RenderTest"}) @Feature({"Browser", "RenderTest"})
public void testConfirmModalDialog() throws ExecutionException, IOException { public void testConfirmModalDialog()
testModalDialogImpl("js_modal_view_vr_confirm", "confirm('Deny?')"); throws InterruptedException, ExecutionException, IOException {
NativeUiUtils.performActionAndWaitForUiQuiescence(() -> {
NativeUiUtils.performActionAndWaitForVisibilityStatus(
UserFriendlyElementName.BROWSING_DIALOG, true /* visible */, () -> {
JavaScriptUtils.executeJavaScript(
mActivity.getCurrentWebContents(), "var c = confirm('Deny?')");
});
});
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
"js_modal_view_vr_confirm_visible_browser_ui", mRenderTestRule);
NativeUiUtils.clickFallbackUiNegativeButton();
// Ensure the cancel button was clicked.
Assert.assertTrue("JavaScript Confirm's cancel button was not clicked",
mVrBrowserTestFramework.runJavaScriptOrFail("c", POLL_TIMEOUT_SHORT_MS)
.equals("false"));
NativeUiUtils.waitForUiQuiescence();
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
"js_modal_view_vr_confirm_canceled_browser_ui", mRenderTestRule);
mVrBrowserTestFramework.assertNoJavaScriptErrors();
} }
/** /**
* Verifies modal prompt-dialog appearance and that it looks as it is expected. * Verifies modal prompt-dialog appearance and that it looks as it is expected. Additionally,
* verifies that its "Ok" button works as expected.
*/ */
@Test @Test
@MediumTest @MediumTest
@Feature({"Browser", "RenderTest"}) @Feature({"Browser", "RenderTest"})
public void testPromptModalDialog() throws ExecutionException, IOException { public void testPromptModalDialog()
testModalDialogImpl( throws InterruptedException, ExecutionException, IOException {
"js_modal_view_vr_prompt", "prompt('Is the tree closed?', 'Hopefully not')"); String expectedString = "Hopefully not";
} NativeUiUtils.performActionAndWaitForUiQuiescence(() -> {
NativeUiUtils.performActionAndWaitForVisibilityStatus(
private void testModalDialogImpl(String name, String js) UserFriendlyElementName.BROWSING_DIALOG, true /* visible */, () -> {
throws ExecutionException, IOException { JavaScriptUtils.executeJavaScript(mActivity.getCurrentWebContents(),
VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS); "var p = prompt('Is the tree closed?', '" + expectedString + "')");
});
executeJavaScriptAndWaitForDialog(js); });
RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
JavascriptAppModalDialog jsDialog = getCurrentDialog(); "js_modal_view_vr_prompt_visible_browser_ui", mRenderTestRule);
Assert.assertNotNull("No dialog showing.", jsDialog); NativeUiUtils.clickFallbackUiPositiveButton();
// This JavaScript will only run once the prompt has been dismissed, and the return value
Assert.assertEquals(NativeUiUtils.getVrViewContainer().getChildCount(), 1); // will only be what we expect if the positive button was actually clicked (as opposed to
mRenderTestRule.render(NativeUiUtils.getVrViewContainer().getChildAt(0), name); // canceled).
} Assert.assertTrue("JavaScript Prompt's OK button was not clicked",
mVrBrowserTestFramework
/** .runJavaScriptOrFail("p == '" + expectedString + "'", POLL_TIMEOUT_SHORT_MS)
* Asynchronously executes the given code for spawning a dialog and waits .equals("true"));
* for the dialog to be visible. NativeUiUtils.waitForUiQuiescence();
*/ RenderTestUtils.dumpAndCompare(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI,
private void executeJavaScriptAndWaitForDialog(String script) { "js_modal_view_vr_prompt_submitted_browser_ui", mRenderTestRule);
JavaScriptUtils.executeJavaScript(mActivity.getCurrentWebContents(), script); mVrBrowserTestFramework.assertNoJavaScriptErrors();
NativeUiUtils.waitForModalDialogStatus(true /* shouldBeShown */, mActivity);
}
/**
* Returns the current JavaScript modal dialog showing or null if no such dialog is currently
* showing.
*/
private JavascriptAppModalDialog getCurrentDialog() throws ExecutionException {
return (JavascriptAppModalDialog) ThreadUtils.runOnUiThreadBlocking(
()
-> mActivity.getModalDialogManager().getCurrentDialogForTest().get(
ModalDialogProperties.CONTROLLER));
} }
} }
...@@ -110,6 +110,18 @@ public class NativeUiUtils { ...@@ -110,6 +110,18 @@ public class NativeUiUtils {
elementName, VrControllerTestAction.CLICK_UP, position); elementName, VrControllerTestAction.CLICK_UP, position);
} }
/**
* Hovers over a UI element with the controller.
*
* @param elementName The UserFriendlyElementName that will be hovered over.
* @param position A PointF specifying where on the element to hover relative to a unit square
* centered at (0, 0).
*/
public static void hoverElement(int elementName, PointF position) {
TestVrShellDelegate.getInstance().performControllerActionForTesting(
elementName, VrControllerTestAction.HOVER, position);
}
/** /**
* Clicks the app button while pointed at a UI element. * Clicks the app button while pointed at a UI element.
* @param elementName The UserFriendlyElementName that will be pointed at. * @param elementName The UserFriendlyElementName that will be pointed at.
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.vr.util;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import org.junit.Assert;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.test.util.RenderTestRule;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
/**
* Class containing utility functions for using RenderTests with VR UI.
*/
public class RenderTestUtils {
// Creating a temporary directory doesn't seem to work, so instead use a fixed location that
// we know we can write to.
private static final String IMAGE_DUMP_DIR = "chrome/test/data/vr/framebuffer_dumps";
/**
* Helper function for running the general dumpAndCompare when only one image needs to be
* compared.
*
* @param suffix the framebuffer suffix from NativeUiUtils to use.
* @param id the RenderTest image ID to use when comparing the produced imaged to the golden.
* @param rule the RenderTestRule to use for comparing images.
*/
public static void dumpAndCompare(String suffix, String id, RenderTestRule rule)
throws IOException, InterruptedException {
HashMap<String, String> suffixToId = new HashMap<String, String>();
suffixToId.put(suffix, id);
dumpAndCompare(suffixToId, rule);
}
/**
* Dumps all framebuffers on the next frame and compares the specified images using the provided
* RenderTestRule.
*
* @param suffixToIds a map from framebuffer suffixes from NativeUiUtils to RenderTest image
* IDs.
* @param rule the RenderTestRule to use for comparing images.
*/
public static void dumpAndCompare(HashMap<String, String> suffixToIds, RenderTestRule rule)
throws IOException, InterruptedException {
File dumpDirectory = new File(UrlUtils.getIsolatedTestFilePath(IMAGE_DUMP_DIR));
if (!dumpDirectory.exists() && !dumpDirectory.isDirectory()) {
Assert.assertTrue("Failed to make framebuffer dump directory", dumpDirectory.mkdirs());
}
// Properly joining these with Paths.get() would be great, except that Paths.get() requires
// API level 26.
File baseImagePath = new File(dumpDirectory, "dump");
// Dump the next frame's frame buffers to disk.
NativeUiUtils.dumpNextFramesFrameBuffers(baseImagePath.getPath());
for (String suffix : suffixToIds.keySet()) {
String id = suffixToIds.get(suffix);
String filepath = baseImagePath.getPath() + suffix + ".png";
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(filepath, options);
// The browser UI dump contains both eyes rendered, which is unnecessary for comparing
// since any difference in one should show up in the other. So, take the left half of
// the image to get the left eye, which reduces the amount of space the image takes up.
if (suffix.equals(NativeUiUtils.FRAME_BUFFER_SUFFIX_BROWSER_UI)) {
bitmap = Bitmap.createBitmap(
bitmap, 0, 0, bitmap.getWidth() / 2, bitmap.getHeight());
}
rule.compareForResult(bitmap, id);
}
}
}
\ No newline at end of file
...@@ -89,6 +89,10 @@ UiElementName UserFriendlyElementNameToUiElementName( ...@@ -89,6 +89,10 @@ UiElementName UserFriendlyElementNameToUiElementName(
return kAudioCaptureIndicator; return kAudioCaptureIndicator;
case UserFriendlyElementName::kWebXrExternalPromptNotification: case UserFriendlyElementName::kWebXrExternalPromptNotification:
return kWebXrExternalPromptNotification; return kWebXrExternalPromptNotification;
case UserFriendlyElementName::kCameraPermissionIndicator:
return kVideoCaptureIndicator;
case UserFriendlyElementName::kLocationPermissionIndicator:
return kLocationAccessIndicator;
default: default:
NOTREACHED(); NOTREACHED();
return kNone; return kNone;
......
...@@ -43,6 +43,11 @@ enum class UserFriendlyElementName : int { ...@@ -43,6 +43,11 @@ enum class UserFriendlyElementName : int {
kWebXrExternalPromptNotification, // The notification shown in the headset kWebXrExternalPromptNotification, // The notification shown in the headset
// if a permission is requested while in // if a permission is requested while in
// immersive WebXR session. // immersive WebXR session.
kCameraPermissionIndicator, // The camera icon that appears when a page is
// using the camera permission.
kLocationPermissionIndicator, // The location icon that appears when a page
// is using the high accuracy location
// permission.
}; };
// These are the types of actions that Java can request callbacks for once // These are the types of actions that Java can request callbacks for once
......
...@@ -26,6 +26,9 @@ GOLDEN_DIRECTORIES = [ ...@@ -26,6 +26,9 @@ GOLDEN_DIRECTORIES = [
os.path.join( os.path.join(
CHROMIUM_SRC, 'components', 'test', 'data', 'permission_dialogs', CHROMIUM_SRC, 'components', 'test', 'data', 'permission_dialogs',
'render_tests'), 'render_tests'),
os.path.join(
CHROMIUM_SRC, 'components', 'test', 'data', 'vr_browser_ui',
'render_tests'),
] ]
......
<!doctype html>
<!-- Just a blank page with some helpers for permission requests. Useful for
permission prompt pixel diff tests, as we need an actual page (as opposed to
about:blank) to request permissions, but text on a page can sometimes result in
slight differences in produced images due to antialiasing. -->
<html>
<body>
<script src="../resources/webxr_e2e.js"></script>
<script>
var lastPermissionGranted = null;
function onGranted() {
// Conditional to avoid failures from the location API calling this
// repeatedly without us acking each finishJavaScriptStep();
if (lastPermissionGranted !== null) return;
lastPermissionGranted = true;
finishJavaScriptStep();
}
function onDenied() {
if (lastPermissionGranted !== null) return;
lastPermissionGranted = false;
finishJavaScriptStep();
}
</script>
</body>
</html>
<!doctype html>
<!-- Just a blank page. Useful for permission prompt pixel diff tests, as
we need an actual page (as opposed to about:blank) to request permissions, but
text on a page can sometimes result in slight differences in produced images due
to antialiasing. -->
<html>
<body>
<script src="../resources/webxr_e2e.js"></script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment