OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 net::SpawnedTestServer https_server( | 1111 net::SpawnedTestServer https_server( |
1112 net::SpawnedTestServer::TYPE_HTTPS, | 1112 net::SpawnedTestServer::TYPE_HTTPS, |
1113 net::SpawnedTestServer::kLocalhost, | 1113 net::SpawnedTestServer::kLocalhost, |
1114 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1114 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
1115 ASSERT_TRUE(https_server.Start()); | 1115 ASSERT_TRUE(https_server.Start()); |
1116 | 1116 |
1117 // Observe the created render_view_host's to make sure they will not leak. | 1117 // Observe the created render_view_host's to make sure they will not leak. |
1118 RenderViewHostObserverArray rvh_observers; | 1118 RenderViewHostObserverArray rvh_observers; |
1119 | 1119 |
1120 GURL navigated_url(test_server()->GetURL("files/title2.html")); | 1120 GURL navigated_url(test_server()->GetURL("files/title2.html")); |
1121 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + | 1121 GURL view_source_url(kViewSourceScheme + std::string(":") + |
1122 navigated_url.spec()); | 1122 navigated_url.spec()); |
1123 | 1123 |
1124 // Let's ensure that when we start with a blank window, navigating away to a | 1124 // Let's ensure that when we start with a blank window, navigating away to a |
1125 // view-source URL, we create a new SiteInstance. | 1125 // view-source URL, we create a new SiteInstance. |
1126 RenderViewHost* blank_rvh = shell()->web_contents()-> | 1126 RenderViewHost* blank_rvh = shell()->web_contents()->GetRenderViewHost(); |
1127 GetRenderViewHost(); | |
1128 SiteInstance* blank_site_instance = blank_rvh->GetSiteInstance(); | 1127 SiteInstance* blank_site_instance = blank_rvh->GetSiteInstance(); |
1129 EXPECT_EQ(shell()->web_contents()->GetURL(), GURL::EmptyGURL()); | 1128 EXPECT_EQ(shell()->web_contents()->GetURL(), GURL::EmptyGURL()); |
1130 EXPECT_EQ(blank_site_instance->GetSiteURL(), GURL::EmptyGURL()); | 1129 EXPECT_EQ(blank_site_instance->GetSiteURL(), GURL::EmptyGURL()); |
1131 rvh_observers.AddObserverToRVH(blank_rvh); | 1130 rvh_observers.AddObserverToRVH(blank_rvh); |
1132 | 1131 |
1133 // Now navigate to the view-source URL and ensure we got a different | 1132 // Now navigate to the view-source URL and ensure we got a different |
1134 // SiteInstance and RenderViewHost. | 1133 // SiteInstance and RenderViewHost. |
1135 NavigateToURL(shell(), view_source_url); | 1134 NavigateToURL(shell(), view_source_url); |
1136 EXPECT_NE(blank_rvh, shell()->web_contents()->GetRenderViewHost()); | 1135 EXPECT_NE(blank_rvh, shell()->web_contents()->GetRenderViewHost()); |
1137 EXPECT_NE(blank_site_instance, shell()->web_contents()-> | 1136 EXPECT_NE(blank_site_instance, shell()->web_contents()-> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | 1222 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); |
1224 | 1223 |
1225 // Make sure it ends up at the right page. | 1224 // Make sure it ends up at the right page. |
1226 WaitForLoadStop(shell()->web_contents()); | 1225 WaitForLoadStop(shell()->web_contents()); |
1227 EXPECT_EQ(https_server.GetURL("files/title1.html"), | 1226 EXPECT_EQ(https_server.GetURL("files/title1.html"), |
1228 shell()->web_contents()->GetURL()); | 1227 shell()->web_contents()->GetURL()); |
1229 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); | 1228 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); |
1230 } | 1229 } |
1231 | 1230 |
1232 } // namespace content | 1231 } // namespace content |
OLD | NEW |