| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/browser_render_process_host.h" | 5 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 6 #include "chrome/browser/renderer_host/render_view_host.h" | 6 #include "chrome/browser/renderer_host/render_view_host.h" |
| 7 #include "chrome/browser/tab_contents/navigation_entry.h" | 7 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 8 #include "chrome/browser/tab_contents/web_contents.h" | 8 #include "chrome/browser/tab_contents/web_contents.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 // Test of distinguishing URLs from different sites. Most of this logic is | 235 // Test of distinguishing URLs from different sites. Most of this logic is |
| 236 // tested in RegistryControlledDomainTest. This test focuses on URLs with | 236 // tested in RegistryControlledDomainTest. This test focuses on URLs with |
| 237 // different schemes or ports. | 237 // different schemes or ports. |
| 238 TEST_F(SiteInstanceTest, IsSameWebSite) { | 238 TEST_F(SiteInstanceTest, IsSameWebSite) { |
| 239 GURL url_foo = GURL("http://foo/a.html"); | 239 GURL url_foo = GURL("http://foo/a.html"); |
| 240 GURL url_foo2 = GURL("http://foo/b.html"); | 240 GURL url_foo2 = GURL("http://foo/b.html"); |
| 241 GURL url_foo_https = GURL("https://foo/a.html"); | 241 GURL url_foo_https = GURL("https://foo/a.html"); |
| 242 GURL url_foo_port = GURL("http://foo:8080/a.html"); | 242 GURL url_foo_port = GURL("http://foo:8080/a.html"); |
| 243 GURL url_javascript = GURL("javascript:alert(1);"); | 243 GURL url_javascript = GURL("javascript:alert(1);"); |
| 244 GURL url_crash = GURL(chrome::kAboutCrashURL); | 244 GURL url_crash = GURL("about:crash"); |
| 245 GURL url_hang = GURL(chrome::kAboutHangURL); | 245 GURL url_hang = GURL("about:hang"); |
| 246 GURL url_shorthang = GURL(chrome::kAboutShortHangURL); | 246 GURL url_shorthang = GURL("about:shorthang"); |
| 247 | 247 |
| 248 // Same scheme and port -> same site. | 248 // Same scheme and port -> same site. |
| 249 EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo2)); | 249 EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo2)); |
| 250 | 250 |
| 251 // Different scheme -> different site. | 251 // Different scheme -> different site. |
| 252 EXPECT_FALSE(SiteInstance::IsSameWebSite(url_foo, url_foo_https)); | 252 EXPECT_FALSE(SiteInstance::IsSameWebSite(url_foo, url_foo_https)); |
| 253 | 253 |
| 254 // Different port -> same site. | 254 // Different port -> same site. |
| 255 // (Changes to document.domain make renderer ignore the port.) | 255 // (Changes to document.domain make renderer ignore the port.) |
| 256 EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo_port)); | 256 EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo_port)); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 389 |
| 390 // Should be able to see that we don't have SiteInstances. | 390 // Should be able to see that we don't have SiteInstances. |
| 391 EXPECT_FALSE(browsing_instance->HasSiteInstance( | 391 EXPECT_FALSE(browsing_instance->HasSiteInstance( |
| 392 GURL("https://www.google.com"))); // not visited before | 392 GURL("https://www.google.com"))); // not visited before |
| 393 EXPECT_FALSE(browsing_instance3->HasSiteInstance( | 393 EXPECT_FALSE(browsing_instance3->HasSiteInstance( |
| 394 GURL("http://www.yahoo.com"))); // different BI, different profile | 394 GURL("http://www.yahoo.com"))); // different BI, different profile |
| 395 | 395 |
| 396 // browsing_instances will be deleted when their SiteInstances are deleted | 396 // browsing_instances will be deleted when their SiteInstances are deleted |
| 397 } | 397 } |
| 398 | 398 |
| OLD | NEW |