blob: 46b8e08e2904a8253f649907a053aa6381df885a [file] [log] [blame]
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
// Wait for after the load event so that the navigation doesn't get converted
// into a replace navigation.
window.onload = () => t.step_timeout(() => {
assert_equals(appHistory.transition, null);
const from = appHistory.current;
appHistory.addEventListener("navigate", t.step_func(e => {
e.transitionWhile(Promise.resolve());
assert_equals(appHistory.transition, null);
}));
let navigatesuccessFired = false;
appHistory.addEventListener("navigatesuccess", t.step_func(() => {
navigatesuccessFired = true;
assert_equals(appHistory.transition.navigationType, "reload");
assert_equals(appHistory.transition.from, from);
}));
appHistory.reload().finished.then(t.step_func_done(() => {
assert_equals(appHistory.transition, null);
assert_true(navigatesuccessFired);
}));
assert_equals(appHistory.transition.navigationType, "reload");
assert_equals(appHistory.transition.from, from);
}, 0);
}, "transitionWhile()ed reload()");
</script>