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

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

Issue 2641663002: [Presentation API] Use iframe in presentation-navigation test (Closed)
Patch Set: resolve code review comments from foolip 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..ba5e23032f5272691586c6b3ca584ae15466442c 100644
--- a/third_party/WebKit/LayoutTests/presentation/presentation-navigation.html
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-navigation.html
@@ -3,18 +3,29 @@
<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 => {
+ iframe.onload = t.step_func(() => {
+ var presentation = iframe.contentWindow.navigator.presentation;
+ if (iframe.src.endsWith('#after-reload')) {
+ assert_equals(presentation.defaultRequest, null);
+ t.done();
+ } else {
+ presentation.defaultRequest = new PresentationRequest("https://example.org");
+ assert_not_equals(presentation.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