Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/presentation-navigation.html |
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-navigation.html b/third_party/WebKit/LayoutTests/presentation/presentation-navigation.html |
| index aca9aeddec2c364212b3d0921d635360edbcd430..e0841285fb3747a0529f00e5c258926225d18022 100644 |
| --- a/third_party/WebKit/LayoutTests/presentation/presentation-navigation.html |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-navigation.html |
| @@ -3,18 +3,31 @@ |
| <body> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| +<iframe></iframe> |
| <script> |
| -if (location.href.endsWith('#after-reload')) { |
| - test(function() { |
| - assert_equals(navigator.presentation.defaultRequest, null); |
| - }, "Test that navigator.defaultRequest isn't kept alive after reload.") |
| -} else { |
| - navigator.presentation.defaultRequest = new PresentationRequest("https://example.org"); |
| +var iframe = document.querySelector('iframe'); |
| - location.href += '#after-reload'; |
| - location.reload(); |
| -} |
| +async_test(t => { |
| + t.step(function() { |
|
foolip
2017/01/18 11:13:52
The argument to async_test is called as a step, so
zhaobin
2017/01/18 19:22:42
Done.
|
| + iframe.onload = () => { |
|
foolip
2017/01/18 11:13:52
This needs to be iframe.onload = t.step_func(() =>
zhaobin
2017/01/18 19:22:42
Done.
|
| + var defaultRequest = iframe.contentWindow.navigator.presentation.defaultRequest; |
|
foolip
2017/01/18 11:13:52
Extracting this out won't work, then you're operat
zhaobin
2017/01/18 19:22:42
Done.
|
| + if (iframe.src.endsWith('#after-reload')) { |
| + assert_equals(defaultRequest, null); |
|
foolip
2017/01/18 11:13:52
If this test passed like this, how did defaultRequ
zhaobin
2017/01/18 19:22:42
We load iframe twice:
1: iframe loads 'resources/
foolip
2017/01/18 19:42:45
Oh, now I see my misunderstanding. defaultRequest
|
| + t.done(); |
| + } else { |
| + defaultRequest = new PresentationRequest("https://example.org"); |
| + assert_not_equals(defaultRequest, null); |
| + |
| + iframe.src += '#after-reload'; |
| + iframe.contentWindow.location.reload(true); |
| + } |
| + }; |
| + |
| + // Navigate the iframe |
| + iframe.src = 'resources/blank.html'; |
| + }); |
| +}, "Test that navigator.defaultRequest isn't kept alive after reload."); |
| </script> |
| </body> |