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

Unified Diff: content/browser/manifest/manifest_browsertest.cc

Issue 930223003: Do not reset ManifestManager state for same page navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | content/renderer/manifest/manifest_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/manifest/manifest_browsertest.cc
diff --git a/content/browser/manifest/manifest_browsertest.cc b/content/browser/manifest/manifest_browsertest.cc
index 75b08dca1b6fb3360fc0aa0bf6fafbbfe4cd7dc0..f6905a996bb381d089558d73762c06d0be27e0f6 100644
--- a/content/browser/manifest/manifest_browsertest.cc
+++ b/content/browser/manifest/manifest_browsertest.cc
@@ -312,4 +312,57 @@ IN_PROC_BROWSER_TEST_F(ManifestBrowserTest, Navigation) {
}
}
+// If a page has a manifest and the page is navigated using pushState (ie. same
+// page), it should keep its manifest state.
+IN_PROC_BROWSER_TEST_F(ManifestBrowserTest, PushStateNavigation) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+ GURL test_url =
+ embedded_test_server()->GetURL("/manifest/dummy-manifest.html");
+
+ {
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+ shell()->LoadURL(test_url);
+ navigation_observer.Wait();
+ }
+
+ {
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+ ASSERT_TRUE(content::ExecuteScript(
+ shell()->web_contents(),
+ "history.pushState({foo: \"bar\"}, 'page', 'page.html');"));
+ navigation_observer.Wait();
+ }
+
+ GetManifestAndWait();
+ EXPECT_FALSE(manifest().IsEmpty());
+ EXPECT_EQ(0u, console_error_count());
+}
+
+// If a page has a manifest and is navigated using an anchor (ie. same page), it
+// should keep its manifest state.
+IN_PROC_BROWSER_TEST_F(ManifestBrowserTest, AnchorNavigation) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+ GURL test_url =
+ embedded_test_server()->GetURL("/manifest/dummy-manifest.html");
+
+ {
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+ shell()->LoadURL(test_url);
+ navigation_observer.Wait();
+ }
+
+ {
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+ ASSERT_TRUE(content::ExecuteScript(
+ shell()->web_contents(),
+ "var a = document.createElement('a'); a.href='#foo';"
+ "document.body.appendChild(a); a.click();"));
+ navigation_observer.Wait();
+ }
+
+ GetManifestAndWait();
+ EXPECT_FALSE(manifest().IsEmpty());
+ EXPECT_EQ(0u, console_error_count());
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/renderer/manifest/manifest_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698