diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/remote-context-helper-tests/navigation-same-document.window.js')
-rw-r--r-- | testing/web-platform/tests/html/browsers/browsing-the-web/remote-context-helper-tests/navigation-same-document.window.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/remote-context-helper-tests/navigation-same-document.window.js b/testing/web-platform/tests/html/browsers/browsing-the-web/remote-context-helper-tests/navigation-same-document.window.js new file mode 100644 index 0000000000..6f637e2b90 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/remote-context-helper-tests/navigation-same-document.window.js @@ -0,0 +1,39 @@ +// META: title=RemoteContextHelper navigation using BFCache +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/test-helper.js + +'use strict'; + +async function assertLocationIs(remoteContextWrapper, expectedLocation) { + assert_equals( + await remoteContextWrapper.executeScript(() => { + return location.toString(); + }), + expectedLocation, 'verify location'); +} + +promise_test(async t => { + const rcHelper = new RemoteContextHelper(); + + const rc = await rcHelper.addWindow(); + + const oldLocation = await rc.executeScript(() => { + return location.toString(); + }); + const newLocation = oldLocation + '#fragment'; + + // Navigate to same document. + await rc.navigateTo(newLocation); + + // Verify that the window navigated. + await assertLocationIs(rc, newLocation); + + // Navigate back. + await rc.historyBack(oldLocation); + + // Verify that the window navigated back and the executor is running. + await assertLocationIs(rc, oldLocation); +}); |