| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" | 
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" | 
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" | 
| 8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" | 
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" | 
| 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
      " | 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
      " | 
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1209   const GURL kUrl2("http://www.google.com"); | 1209   const GURL kUrl2("http://www.google.com"); | 
| 1210   contents()->NavigateAndCommit(kUrl2); | 1210   contents()->NavigateAndCommit(kUrl2); | 
| 1211   EXPECT_FALSE(main_test_rfh()->frame_tree_node()->render_manager()->web_ui()); | 1211   EXPECT_FALSE(main_test_rfh()->frame_tree_node()->render_manager()->web_ui()); | 
| 1212 } | 1212 } | 
| 1213 | 1213 | 
| 1214 // Tests that we don't end up in an inconsistent state if a page does a back and | 1214 // Tests that we don't end up in an inconsistent state if a page does a back and | 
| 1215 // then reload. http://crbug.com/51680 | 1215 // then reload. http://crbug.com/51680 | 
| 1216 // Also tests that only user-gesture navigations can interrupt cross-process | 1216 // Also tests that only user-gesture navigations can interrupt cross-process | 
| 1217 // navigations. http://crbug.com/75195 | 1217 // navigations. http://crbug.com/75195 | 
| 1218 TEST_F(RenderFrameHostManagerTest, PageDoesBackAndReload) { | 1218 TEST_F(RenderFrameHostManagerTest, PageDoesBackAndReload) { | 
|  | 1219   if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 
|  | 1220           switches::kEnableBrowserSideNavigation)) { | 
|  | 1221     // PlzNavigate uses a significantly different logic for renderer initiated | 
|  | 1222     // navigations and navigation cancellation. Adapting this test would make it | 
|  | 1223     // full of special cases and almost unreadable. | 
|  | 1224     // There are tests that exercise these concerns for PlzNavigate, all from | 
|  | 1225     // NavigatorTestWithBrowserSideNavigation: | 
|  | 1226     // - BrowserInitiatedNavigationCancel | 
|  | 1227     // - RendererUserInitiatedNavigationCancel | 
|  | 1228     // - RendererNonUserInitiatedNavigationDoesntCancelRendererUserInitiated | 
|  | 1229     // - RendererNonUserInitiatedNavigationDoesntCancelBrowserInitiated | 
|  | 1230     // - RendererNonUserInitiatedNavigationCancelSimilarNavigation | 
|  | 1231     SUCCEED() << "Test is not applicable with browser side navigation enabled"; | 
|  | 1232     return; | 
|  | 1233   } | 
| 1219   const GURL kUrl1("http://www.google.com/"); | 1234   const GURL kUrl1("http://www.google.com/"); | 
| 1220   const GURL kUrl2("http://www.evil-site.com/"); | 1235   const GURL kUrl2("http://www.evil-site.com/"); | 
| 1221 | 1236 | 
| 1222   // Navigate to a safe site, then an evil site. | 1237   // Navigate to a safe site, then an evil site. | 
| 1223   // This will switch RenderFrameHosts.  We cannot assert that the first and | 1238   // This will switch RenderFrameHosts.  We cannot assert that the first and | 
| 1224   // second RFHs are different, though, because the first one may be promptly | 1239   // second RFHs are different, though, because the first one may be promptly | 
| 1225   // deleted. | 1240   // deleted. | 
| 1226   contents()->NavigateAndCommit(kUrl1); | 1241   contents()->NavigateAndCommit(kUrl1); | 
| 1227   contents()->NavigateAndCommit(kUrl2); | 1242   contents()->NavigateAndCommit(kUrl2); | 
| 1228   TestRenderFrameHost* evil_rfh = contents()->GetMainFrame(); | 1243   TestRenderFrameHost* evil_rfh = contents()->GetMainFrame(); | 
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2213   EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2228   EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); | 
| 2214   contents2->NavigateAndCommit(kUrl3); | 2229   contents2->NavigateAndCommit(kUrl3); | 
| 2215   EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2230   EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); | 
| 2216   EXPECT_NE(nullptr, | 2231   EXPECT_NE(nullptr, | 
| 2217             iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); | 2232             iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); | 
| 2218   EXPECT_EQ(nullptr, | 2233   EXPECT_EQ(nullptr, | 
| 2219             iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); | 2234             iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); | 
| 2220 } | 2235 } | 
| 2221 | 2236 | 
| 2222 }  // namespace content | 2237 }  // namespace content | 
| OLD | NEW | 
|---|