Commit 737f4fdf authored by bsheedy's avatar bsheedy Committed by Commit Bot

Automated VR refresh test

Automates the manual test for ensuring that the refresh button in the
VR browser's overflow menu functions as expected.

Bug: 887510
Change-Id: I9e97f5b5c313229e8845ef7fc0f1e2730434bf29
Reviewed-on: https://chromium-review.googlesource.com/c/1333111Reviewed-by: default avatarBill Orr <billorr@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607734}
parent 43ee9538
...@@ -388,7 +388,7 @@ public class VrBrowserControllerInputTest { ...@@ -388,7 +388,7 @@ public class VrBrowserControllerInputTest {
navStart, POLL_TIMEOUT_SHORT_MS)) navStart, POLL_TIMEOUT_SHORT_MS))
.doubleValue() .doubleValue()
> navigationTimestamp; > navigationTimestamp;
}); }, "Dragging page down did not refresh page");
} }
/** /**
......
...@@ -524,6 +524,34 @@ public class VrBrowserNavigationTest { ...@@ -524,6 +524,34 @@ public class VrBrowserNavigationTest {
"Forward button is enabled.", VrBrowserTransitionUtils.isForwardButtonEnabled()); "Forward button is enabled.", VrBrowserTransitionUtils.isForwardButtonEnabled());
} }
/**
* Tests that the refresh button in the overflow menu properly refreshes the page.
*/
@Test
@MediumTest
public void testRefreshButton() throws InterruptedException {
// The navigationStart time should change anytime we refresh, so save the value and compare
// later.
// Use a double because apparently returning Unix timestamps as floating point is a logical
// thing for JavaScript to do and Long.valueOf is afraid of decimal points.
String navStart = "window.performance.timing.navigationStart";
final double navigationTimestamp =
Double.valueOf(mVrBrowserTestFramework.runJavaScriptOrFail(
navStart, POLL_TIMEOUT_SHORT_MS))
.doubleValue();
NativeUiUtils.clickElementAndWaitForUiQuiescence(
UserFriendlyElementName.OVERFLOW_MENU, new PointF());
NativeUiUtils.clickElement(UserFriendlyElementName.RELOAD_BUTTON, new PointF());
// Wait for the navigationStart time to be newer than our saved time.
CriteriaHelper.pollInstrumentationThread(() -> {
return Double.valueOf(mVrBrowserTestFramework.runJavaScriptOrFail(
navStart, POLL_TIMEOUT_SHORT_MS))
.doubleValue()
> navigationTimestamp;
}, "Refresh button did not refresh page");
}
/** /**
* Tests that navigation to/from native pages works properly and that interacting with the * Tests that navigation to/from native pages works properly and that interacting with the
* screen doesn't cause issues. See crbug.com/737167. * screen doesn't cause issues. See crbug.com/737167.
......
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