Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: third_party/WebKit/LayoutTests/presentation/presentation-navigation.html

Issue 2641663002: [Presentation API] Use iframe in presentation-navigation test (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/presentation/presentation-navigation-multipleurls.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/presentation/presentation-navigation-multipleurls.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698