Index: chrome/browser/prerender/prerender_browsertest.cc |
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc |
index 0b86363e7edeb56ad5083a1105e3e5c14d36729f..f010b9a5d982578501cf6bcb5994f4d7cd37d298 100644 |
--- a/chrome/browser/prerender/prerender_browsertest.cc |
+++ b/chrome/browser/prerender/prerender_browsertest.cc |
@@ -624,6 +624,10 @@ class PrerenderBrowserTest : public InProcessBrowserTest { |
OpenDestURLWithJSImpl("WindowOpen()"); |
} |
+ void RemoveLinkElementAndNavigate() const { |
+ OpenDestURLWithJSImpl("RemoveLinkElementAndNavigate()"); |
+ } |
+ |
void ClickToNextPageAfterPrerender(Browser* browser) { |
ui_test_utils::WindowedNotificationObserver new_page_observer( |
content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
@@ -754,6 +758,10 @@ class PrerenderBrowserTest : public InProcessBrowserTest { |
loader_path_ = path; |
} |
+ void set_loader_query_and_fragment(const std::string& query_and_fragment) { |
+ loader_query_and_fragment_ = query_and_fragment; |
+ } |
+ |
GURL GetCrossDomainTestUrl(const std::string& path) { |
static const std::string secondary_domain = "www.foo.com"; |
host_resolver()->AddRule(secondary_domain, "127.0.0.1"); |
@@ -814,7 +822,8 @@ class PrerenderBrowserTest : public InProcessBrowserTest { |
ASSERT_TRUE(https_src_server->Start()); |
src_server = https_src_server.get(); |
} |
- GURL src_url = src_server->GetURL(replacement_path); |
+ GURL src_url = src_server->GetURL(replacement_path + |
+ loader_query_and_fragment_); |
mmenke
2012/04/24 15:26:15
We have "src_url" but "loader_query_and_fragment_"
gavinp
2012/04/26 23:55:39
I went with the change to loader_url; what src/des
|
ASSERT_TRUE(prerender_manager()); |
prerender_manager()->mutable_config().rate_limit_enabled = false; |
@@ -944,6 +953,7 @@ class PrerenderBrowserTest : public InProcessBrowserTest { |
bool use_https_src_server_; |
bool call_javascript_; |
std::string loader_path_; |
+ std::string loader_query_and_fragment_; |
Browser* explicitly_set_browser_; |
}; |
@@ -955,6 +965,32 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) { |
NavigateToDestURL(); |
mmenke
2012/04/24 15:26:15
I'd suggest you make sure that the link manager is
gavinp
2012/04/26 23:55:39
Done. These tests can even land without being dis
|
} |
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovingLink) { |
+ set_loader_path("files/prerender/prerender_loader_removing_links.html"); |
+ set_loader_query_and_fragment("?links_to_insert=1&links_to_remove=1"); |
+ PrerenderTestURL("files/prerender/prerender_page.html", |
+ FINAL_STATUS_CANCELLED, 1); |
+ RemoveLinkElementAndNavigate(); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
+ PrerenderPageRemovingLinkWithTwoLinks) { |
+ set_loader_path("files/prerender/prerender_loader_removing_links.html"); |
+ set_loader_query_and_fragment("?links_to_insert=2&links_to_remove=2"); |
+ PrerenderTestURL("files/prerender/prerender_page.html", |
+ FINAL_STATUS_CANCELLED, 1); |
+ RemoveLinkElementAndNavigate(); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
+ PrerenderPageRemovingLinkWithTwoLinksRemovingOne) { |
+ set_loader_path("files/prerender/prerender_loader_removing_links.html"); |
+ set_loader_query_and_fragment("?links_to_insert=2&links_to_remove=1"); |
+ PrerenderTestURL("files/prerender/prerender_page.html", |
+ FINAL_STATUS_USED, 1); |
+ RemoveLinkElementAndNavigate(); |
+} |
+ |
// Checks that prerendering works in incognito mode. |
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderIncognito) { |
Profile* normal_profile = current_browser()->profile(); |