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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/common/content_constants_internal.h" | 10 #include "content/common/content_constants_internal.h" |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 GURL navigated_url(test_server()->GetURL("files/title2.html")); | 1087 GURL navigated_url(test_server()->GetURL("files/title2.html")); |
1088 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + | 1088 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + |
1089 navigated_url.spec()); | 1089 navigated_url.spec()); |
1090 | 1090 |
1091 // Let's ensure that when we start with a blank window, navigating away to a | 1091 // Let's ensure that when we start with a blank window, navigating away to a |
1092 // view-source URL, we create a new SiteInstance. | 1092 // view-source URL, we create a new SiteInstance. |
1093 content::RenderViewHost* blank_rvh = shell()->web_contents()-> | 1093 content::RenderViewHost* blank_rvh = shell()->web_contents()-> |
1094 GetRenderViewHost(); | 1094 GetRenderViewHost(); |
1095 SiteInstance* blank_site_instance = blank_rvh->GetSiteInstance(); | 1095 SiteInstance* blank_site_instance = blank_rvh->GetSiteInstance(); |
1096 EXPECT_EQ(shell()->web_contents()->GetURL(), GURL::EmptyGURL()); | 1096 EXPECT_EQ(shell()->web_contents()->GetURL(), GURL::EmptyGURL()); |
1097 EXPECT_EQ(blank_site_instance->GetSite(), GURL::EmptyGURL()); | 1097 EXPECT_EQ(blank_site_instance->GetSiteURL(), GURL::EmptyGURL()); |
1098 rvh_observers.AddObserverToRVH(blank_rvh); | 1098 rvh_observers.AddObserverToRVH(blank_rvh); |
1099 | 1099 |
1100 // Now navigate to the view-source URL and ensure we got a different | 1100 // Now navigate to the view-source URL and ensure we got a different |
1101 // SiteInstance and RenderViewHost. | 1101 // SiteInstance and RenderViewHost. |
1102 NavigateToURL(shell(), view_source_url); | 1102 NavigateToURL(shell(), view_source_url); |
1103 EXPECT_NE(blank_rvh, shell()->web_contents()->GetRenderViewHost()); | 1103 EXPECT_NE(blank_rvh, shell()->web_contents()->GetRenderViewHost()); |
1104 EXPECT_NE(blank_site_instance, shell()->web_contents()-> | 1104 EXPECT_NE(blank_site_instance, shell()->web_contents()-> |
1105 GetRenderViewHost()->GetSiteInstance()); | 1105 GetRenderViewHost()->GetSiteInstance()); |
1106 rvh_observers.AddObserverToRVH(shell()->web_contents()->GetRenderViewHost()); | 1106 rvh_observers.AddObserverToRVH(shell()->web_contents()->GetRenderViewHost()); |
1107 | 1107 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | 1355 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); |
1356 | 1356 |
1357 // Make sure it ends up at the right page. | 1357 // Make sure it ends up at the right page. |
1358 WaitForLoadStop(shell()->web_contents()); | 1358 WaitForLoadStop(shell()->web_contents()); |
1359 EXPECT_EQ(https_server.GetURL("files/title1.html"), | 1359 EXPECT_EQ(https_server.GetURL("files/title1.html"), |
1360 shell()->web_contents()->GetURL()); | 1360 shell()->web_contents()->GetURL()); |
1361 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); | 1361 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); |
1362 } | 1362 } |
1363 | 1363 |
1364 } // namespace content | 1364 } // namespace content |
OLD | NEW |