| 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 "content/browser/site_instance_impl.h" |
| 6 |
| 5 #include <stddef.h> | 7 #include <stddef.h> |
| 6 | 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 10 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 11 #include "content/browser/browser_thread_impl.h" | 14 #include "content/browser/browser_thread_impl.h" |
| 12 #include "content/browser/browsing_instance.h" | 15 #include "content/browser/browsing_instance.h" |
| 13 #include "content/browser/child_process_security_policy_impl.h" | 16 #include "content/browser/child_process_security_policy_impl.h" |
| 14 #include "content/browser/frame_host/navigation_entry_impl.h" | 17 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 15 #include "content/browser/renderer_host/render_process_host_impl.h" | 18 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 17 #include "content/browser/site_instance_impl.h" | |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 20 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/browser/webui/content_web_ui_controller_factory.h" | 21 #include "content/browser/webui/content_web_ui_controller_factory.h" |
| 20 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 22 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 21 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
| 22 #include "content/public/common/content_constants.h" | 24 #include "content/public/common/content_constants.h" |
| 23 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/common/url_constants.h" | 26 #include "content/public/common/url_constants.h" |
| 25 #include "content/public/common/url_utils.h" | 27 #include "content/public/common/url_utils.h" |
| 26 #include "content/public/test/mock_render_process_host.h" | 28 #include "content/public/test/mock_render_process_host.h" |
| 27 #include "content/public/test/test_browser_context.h" | 29 #include "content/public/test/test_browser_context.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 delete e1; | 186 delete e1; |
| 185 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 187 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 186 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 188 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 187 delete e2; | 189 delete e2; |
| 188 // instance is now deleted | 190 // instance is now deleted |
| 189 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 191 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 190 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 192 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 191 // browsing_instance is now deleted | 193 // browsing_instance is now deleted |
| 192 | 194 |
| 193 // Ensure that instances are deleted when their RenderViewHosts are gone. | 195 // Ensure that instances are deleted when their RenderViewHosts are gone. |
| 194 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 196 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 195 { | 197 { |
| 196 scoped_ptr<WebContentsImpl> web_contents(static_cast<WebContentsImpl*>( | 198 std::unique_ptr<WebContentsImpl> web_contents(static_cast<WebContentsImpl*>( |
| 197 WebContents::Create(WebContents::CreateParams( | 199 WebContents::Create(WebContents::CreateParams( |
| 198 browser_context.get(), | 200 browser_context.get(), |
| 199 SiteInstance::Create(browser_context.get()))))); | 201 SiteInstance::Create(browser_context.get()))))); |
| 200 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 202 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 201 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 203 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 202 } | 204 } |
| 203 | 205 |
| 204 // Make sure that we flush any messages related to the above WebContentsImpl | 206 // Make sure that we flush any messages related to the above WebContentsImpl |
| 205 // destruction. | 207 // destruction. |
| 206 DrainMessageLoops(); | 208 DrainMessageLoops(); |
| 207 | 209 |
| 208 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 210 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 209 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 211 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 210 // contents is now deleted, along with instance and browsing_instance | 212 // contents is now deleted, along with instance and browsing_instance |
| 211 } | 213 } |
| 212 | 214 |
| 213 // Test that NavigationEntries with SiteInstances can be cloned, but that their | 215 // Test that NavigationEntries with SiteInstances can be cloned, but that their |
| 214 // SiteInstances can be changed afterwards. Also tests that the ref counts are | 216 // SiteInstances can be changed afterwards. Also tests that the ref counts are |
| 215 // updated properly after the change. | 217 // updated properly after the change. |
| 216 TEST_F(SiteInstanceTest, CloneNavigationEntry) { | 218 TEST_F(SiteInstanceTest, CloneNavigationEntry) { |
| 217 const GURL url("test:foo"); | 219 const GURL url("test:foo"); |
| 218 | 220 |
| 219 scoped_ptr<NavigationEntryImpl> e1 = make_scoped_ptr(new NavigationEntryImpl( | 221 std::unique_ptr<NavigationEntryImpl> e1 = |
| 220 SiteInstanceImpl::Create(nullptr), 0, url, Referrer(), base::string16(), | 222 base::WrapUnique(new NavigationEntryImpl( |
| 221 ui::PAGE_TRANSITION_LINK, false)); | 223 SiteInstanceImpl::Create(nullptr), 0, url, Referrer(), |
| 224 base::string16(), ui::PAGE_TRANSITION_LINK, false)); |
| 222 | 225 |
| 223 // Clone the entry. | 226 // Clone the entry. |
| 224 scoped_ptr<NavigationEntryImpl> e2 = e1->Clone(); | 227 std::unique_ptr<NavigationEntryImpl> e2 = e1->Clone(); |
| 225 | 228 |
| 226 // Should be able to change the SiteInstance of the cloned entry. | 229 // Should be able to change the SiteInstance of the cloned entry. |
| 227 e2->set_site_instance(SiteInstanceImpl::Create(nullptr)); | 230 e2->set_site_instance(SiteInstanceImpl::Create(nullptr)); |
| 228 | 231 |
| 229 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 232 EXPECT_EQ(0, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 230 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 233 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 231 | 234 |
| 232 // The first SiteInstance and BrowsingInstance should go away after resetting | 235 // The first SiteInstance and BrowsingInstance should go away after resetting |
| 233 // e1, since e2 should no longer be referencing it. | 236 // e1, since e2 should no longer be referencing it. |
| 234 e1.reset(); | 237 e1.reset(); |
| 235 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 238 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 236 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 239 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 237 | 240 |
| 238 // The second SiteInstance should go away after resetting e2. | 241 // The second SiteInstance should go away after resetting e2. |
| 239 e2.reset(); | 242 e2.reset(); |
| 240 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 243 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 241 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 244 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 242 | 245 |
| 243 DrainMessageLoops(); | 246 DrainMessageLoops(); |
| 244 } | 247 } |
| 245 | 248 |
| 246 // Test to ensure GetProcess returns and creates processes correctly. | 249 // Test to ensure GetProcess returns and creates processes correctly. |
| 247 TEST_F(SiteInstanceTest, GetProcess) { | 250 TEST_F(SiteInstanceTest, GetProcess) { |
| 248 // Ensure that GetProcess returns a process. | 251 // Ensure that GetProcess returns a process. |
| 249 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 252 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 250 scoped_ptr<RenderProcessHost> host1; | 253 std::unique_ptr<RenderProcessHost> host1; |
| 251 scoped_refptr<SiteInstanceImpl> instance( | 254 scoped_refptr<SiteInstanceImpl> instance( |
| 252 SiteInstanceImpl::Create(browser_context.get())); | 255 SiteInstanceImpl::Create(browser_context.get())); |
| 253 host1.reset(instance->GetProcess()); | 256 host1.reset(instance->GetProcess()); |
| 254 EXPECT_TRUE(host1.get() != nullptr); | 257 EXPECT_TRUE(host1.get() != nullptr); |
| 255 | 258 |
| 256 // Ensure that GetProcess creates a new process. | 259 // Ensure that GetProcess creates a new process. |
| 257 scoped_refptr<SiteInstanceImpl> instance2( | 260 scoped_refptr<SiteInstanceImpl> instance2( |
| 258 SiteInstanceImpl::Create(browser_context.get())); | 261 SiteInstanceImpl::Create(browser_context.get())); |
| 259 scoped_ptr<RenderProcessHost> host2(instance2->GetProcess()); | 262 std::unique_ptr<RenderProcessHost> host2(instance2->GetProcess()); |
| 260 EXPECT_TRUE(host2.get() != nullptr); | 263 EXPECT_TRUE(host2.get() != nullptr); |
| 261 EXPECT_NE(host1.get(), host2.get()); | 264 EXPECT_NE(host1.get(), host2.get()); |
| 262 | 265 |
| 263 DrainMessageLoops(); | 266 DrainMessageLoops(); |
| 264 } | 267 } |
| 265 | 268 |
| 266 // Test to ensure SetSite and site() work properly. | 269 // Test to ensure SetSite and site() work properly. |
| 267 TEST_F(SiteInstanceTest, SetSite) { | 270 TEST_F(SiteInstanceTest, SetSite) { |
| 268 scoped_refptr<SiteInstanceImpl> instance(SiteInstanceImpl::Create(nullptr)); | 271 scoped_refptr<SiteInstanceImpl> instance(SiteInstanceImpl::Create(nullptr)); |
| 269 EXPECT_FALSE(instance->HasSite()); | 272 EXPECT_FALSE(instance->HasSite()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 EXPECT_FALSE(SiteInstance::IsSameWebSite(nullptr, url_blank, url_foo_port)); | 377 EXPECT_FALSE(SiteInstance::IsSameWebSite(nullptr, url_blank, url_foo_port)); |
| 375 | 378 |
| 376 DrainMessageLoops(); | 379 DrainMessageLoops(); |
| 377 } | 380 } |
| 378 | 381 |
| 379 // Test to ensure that there is only one SiteInstance per site in a given | 382 // Test to ensure that there is only one SiteInstance per site in a given |
| 380 // BrowsingInstance, when process-per-site is not in use. | 383 // BrowsingInstance, when process-per-site is not in use. |
| 381 TEST_F(SiteInstanceTest, OneSiteInstancePerSite) { | 384 TEST_F(SiteInstanceTest, OneSiteInstancePerSite) { |
| 382 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch( | 385 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 383 switches::kProcessPerSite)); | 386 switches::kProcessPerSite)); |
| 384 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 387 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 385 BrowsingInstance* browsing_instance = | 388 BrowsingInstance* browsing_instance = |
| 386 new BrowsingInstance(browser_context.get()); | 389 new BrowsingInstance(browser_context.get()); |
| 387 | 390 |
| 388 const GURL url_a1("http://www.google.com/1.html"); | 391 const GURL url_a1("http://www.google.com/1.html"); |
| 389 scoped_refptr<SiteInstanceImpl> site_instance_a1( | 392 scoped_refptr<SiteInstanceImpl> site_instance_a1( |
| 390 browsing_instance->GetSiteInstanceForURL(url_a1)); | 393 browsing_instance->GetSiteInstanceForURL(url_a1)); |
| 391 EXPECT_TRUE(site_instance_a1.get() != nullptr); | 394 EXPECT_TRUE(site_instance_a1.get() != nullptr); |
| 392 | 395 |
| 393 // A separate site should create a separate SiteInstance. | 396 // A separate site should create a separate SiteInstance. |
| 394 const GURL url_b1("http://www.yahoo.com/"); | 397 const GURL url_b1("http://www.yahoo.com/"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 416 new BrowsingInstance(browser_context.get()); | 419 new BrowsingInstance(browser_context.get()); |
| 417 // Ensure the new SiteInstance is ref counted so that it gets deleted. | 420 // Ensure the new SiteInstance is ref counted so that it gets deleted. |
| 418 scoped_refptr<SiteInstanceImpl> site_instance_a2_2( | 421 scoped_refptr<SiteInstanceImpl> site_instance_a2_2( |
| 419 browsing_instance2->GetSiteInstanceForURL(url_a2)); | 422 browsing_instance2->GetSiteInstanceForURL(url_a2)); |
| 420 EXPECT_NE(site_instance_a1.get(), site_instance_a2_2.get()); | 423 EXPECT_NE(site_instance_a1.get(), site_instance_a2_2.get()); |
| 421 EXPECT_FALSE( | 424 EXPECT_FALSE( |
| 422 site_instance_a1->IsRelatedSiteInstance(site_instance_a2_2.get())); | 425 site_instance_a1->IsRelatedSiteInstance(site_instance_a2_2.get())); |
| 423 | 426 |
| 424 // The two SiteInstances for http://google.com should not use the same process | 427 // The two SiteInstances for http://google.com should not use the same process |
| 425 // if process-per-site is not enabled. | 428 // if process-per-site is not enabled. |
| 426 scoped_ptr<RenderProcessHost> process_a1(site_instance_a1->GetProcess()); | 429 std::unique_ptr<RenderProcessHost> process_a1(site_instance_a1->GetProcess()); |
| 427 scoped_ptr<RenderProcessHost> process_a2_2(site_instance_a2_2->GetProcess()); | 430 std::unique_ptr<RenderProcessHost> process_a2_2( |
| 431 site_instance_a2_2->GetProcess()); |
| 428 EXPECT_NE(process_a1.get(), process_a2_2.get()); | 432 EXPECT_NE(process_a1.get(), process_a2_2.get()); |
| 429 | 433 |
| 430 // Should be able to see that we do have SiteInstances. | 434 // Should be able to see that we do have SiteInstances. |
| 431 EXPECT_TRUE(browsing_instance->HasSiteInstance( | 435 EXPECT_TRUE(browsing_instance->HasSiteInstance( |
| 432 GURL("http://mail.google.com"))); | 436 GURL("http://mail.google.com"))); |
| 433 EXPECT_TRUE(browsing_instance2->HasSiteInstance( | 437 EXPECT_TRUE(browsing_instance2->HasSiteInstance( |
| 434 GURL("http://mail.google.com"))); | 438 GURL("http://mail.google.com"))); |
| 435 EXPECT_TRUE(browsing_instance->HasSiteInstance( | 439 EXPECT_TRUE(browsing_instance->HasSiteInstance( |
| 436 GURL("http://mail.yahoo.com"))); | 440 GURL("http://mail.yahoo.com"))); |
| 437 | 441 |
| 438 // Should be able to see that we don't have SiteInstances. | 442 // Should be able to see that we don't have SiteInstances. |
| 439 EXPECT_FALSE(browsing_instance->HasSiteInstance( | 443 EXPECT_FALSE(browsing_instance->HasSiteInstance( |
| 440 GURL("https://www.google.com"))); | 444 GURL("https://www.google.com"))); |
| 441 EXPECT_FALSE(browsing_instance2->HasSiteInstance( | 445 EXPECT_FALSE(browsing_instance2->HasSiteInstance( |
| 442 GURL("http://www.yahoo.com"))); | 446 GURL("http://www.yahoo.com"))); |
| 443 | 447 |
| 444 // browsing_instances will be deleted when their SiteInstances are deleted. | 448 // browsing_instances will be deleted when their SiteInstances are deleted. |
| 445 // The processes will be unregistered when the RPH scoped_ptrs go away. | 449 // The processes will be unregistered when the RPH scoped_ptrs go away. |
| 446 | 450 |
| 447 DrainMessageLoops(); | 451 DrainMessageLoops(); |
| 448 } | 452 } |
| 449 | 453 |
| 450 // Test to ensure that there is only one RenderProcessHost per site for an | 454 // Test to ensure that there is only one RenderProcessHost per site for an |
| 451 // entire BrowserContext, if process-per-site is in use. | 455 // entire BrowserContext, if process-per-site is in use. |
| 452 TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { | 456 TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { |
| 453 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 457 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 454 switches::kProcessPerSite); | 458 switches::kProcessPerSite); |
| 455 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 459 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 456 scoped_refptr<BrowsingInstance> browsing_instance = | 460 scoped_refptr<BrowsingInstance> browsing_instance = |
| 457 new BrowsingInstance(browser_context.get()); | 461 new BrowsingInstance(browser_context.get()); |
| 458 | 462 |
| 459 const GURL url_a1("http://www.google.com/1.html"); | 463 const GURL url_a1("http://www.google.com/1.html"); |
| 460 scoped_refptr<SiteInstanceImpl> site_instance_a1( | 464 scoped_refptr<SiteInstanceImpl> site_instance_a1( |
| 461 browsing_instance->GetSiteInstanceForURL(url_a1)); | 465 browsing_instance->GetSiteInstanceForURL(url_a1)); |
| 462 EXPECT_TRUE(site_instance_a1.get() != nullptr); | 466 EXPECT_TRUE(site_instance_a1.get() != nullptr); |
| 463 scoped_ptr<RenderProcessHost> process_a1(site_instance_a1->GetProcess()); | 467 std::unique_ptr<RenderProcessHost> process_a1(site_instance_a1->GetProcess()); |
| 464 | 468 |
| 465 // A separate site should create a separate SiteInstance. | 469 // A separate site should create a separate SiteInstance. |
| 466 const GURL url_b1("http://www.yahoo.com/"); | 470 const GURL url_b1("http://www.yahoo.com/"); |
| 467 scoped_refptr<SiteInstanceImpl> site_instance_b1( | 471 scoped_refptr<SiteInstanceImpl> site_instance_b1( |
| 468 browsing_instance->GetSiteInstanceForURL(url_b1)); | 472 browsing_instance->GetSiteInstanceForURL(url_b1)); |
| 469 EXPECT_NE(site_instance_a1.get(), site_instance_b1.get()); | 473 EXPECT_NE(site_instance_a1.get(), site_instance_b1.get()); |
| 470 EXPECT_TRUE(site_instance_a1->IsRelatedSiteInstance(site_instance_b1.get())); | 474 EXPECT_TRUE(site_instance_a1->IsRelatedSiteInstance(site_instance_b1.get())); |
| 471 | 475 |
| 472 // Getting the new SiteInstance from the BrowsingInstance and from another | 476 // Getting the new SiteInstance from the BrowsingInstance and from another |
| 473 // SiteInstance in the BrowsingInstance should give the same result. | 477 // SiteInstance in the BrowsingInstance should give the same result. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 486 BrowsingInstance* browsing_instance2 = | 490 BrowsingInstance* browsing_instance2 = |
| 487 new BrowsingInstance(browser_context.get()); | 491 new BrowsingInstance(browser_context.get()); |
| 488 scoped_refptr<SiteInstanceImpl> site_instance_a1_2( | 492 scoped_refptr<SiteInstanceImpl> site_instance_a1_2( |
| 489 browsing_instance2->GetSiteInstanceForURL(url_a1)); | 493 browsing_instance2->GetSiteInstanceForURL(url_a1)); |
| 490 EXPECT_TRUE(site_instance_a1.get() != nullptr); | 494 EXPECT_TRUE(site_instance_a1.get() != nullptr); |
| 491 EXPECT_NE(site_instance_a1.get(), site_instance_a1_2.get()); | 495 EXPECT_NE(site_instance_a1.get(), site_instance_a1_2.get()); |
| 492 EXPECT_EQ(process_a1.get(), site_instance_a1_2->GetProcess()); | 496 EXPECT_EQ(process_a1.get(), site_instance_a1_2->GetProcess()); |
| 493 | 497 |
| 494 // A visit to the original site in a new BrowsingInstance (different browser | 498 // A visit to the original site in a new BrowsingInstance (different browser |
| 495 // context) should return a different SiteInstance with a different process. | 499 // context) should return a different SiteInstance with a different process. |
| 496 scoped_ptr<TestBrowserContext> browser_context2(new TestBrowserContext()); | 500 std::unique_ptr<TestBrowserContext> browser_context2( |
| 501 new TestBrowserContext()); |
| 497 BrowsingInstance* browsing_instance3 = | 502 BrowsingInstance* browsing_instance3 = |
| 498 new BrowsingInstance(browser_context2.get()); | 503 new BrowsingInstance(browser_context2.get()); |
| 499 scoped_refptr<SiteInstanceImpl> site_instance_a2_3( | 504 scoped_refptr<SiteInstanceImpl> site_instance_a2_3( |
| 500 browsing_instance3->GetSiteInstanceForURL(url_a2)); | 505 browsing_instance3->GetSiteInstanceForURL(url_a2)); |
| 501 EXPECT_TRUE(site_instance_a2_3.get() != nullptr); | 506 EXPECT_TRUE(site_instance_a2_3.get() != nullptr); |
| 502 scoped_ptr<RenderProcessHost> process_a2_3(site_instance_a2_3->GetProcess()); | 507 std::unique_ptr<RenderProcessHost> process_a2_3( |
| 508 site_instance_a2_3->GetProcess()); |
| 503 EXPECT_NE(site_instance_a1.get(), site_instance_a2_3.get()); | 509 EXPECT_NE(site_instance_a1.get(), site_instance_a2_3.get()); |
| 504 EXPECT_NE(process_a1.get(), process_a2_3.get()); | 510 EXPECT_NE(process_a1.get(), process_a2_3.get()); |
| 505 | 511 |
| 506 // Should be able to see that we do have SiteInstances. | 512 // Should be able to see that we do have SiteInstances. |
| 507 EXPECT_TRUE(browsing_instance->HasSiteInstance( | 513 EXPECT_TRUE(browsing_instance->HasSiteInstance( |
| 508 GURL("http://mail.google.com"))); // visited before | 514 GURL("http://mail.google.com"))); // visited before |
| 509 EXPECT_TRUE(browsing_instance2->HasSiteInstance( | 515 EXPECT_TRUE(browsing_instance2->HasSiteInstance( |
| 510 GURL("http://mail.google.com"))); // visited before | 516 GURL("http://mail.google.com"))); // visited before |
| 511 EXPECT_TRUE(browsing_instance->HasSiteInstance( | 517 EXPECT_TRUE(browsing_instance->HasSiteInstance( |
| 512 GURL("http://mail.yahoo.com"))); // visited before | 518 GURL("http://mail.yahoo.com"))); // visited before |
| (...skipping 28 matching lines...) Expand all Loading... |
| 541 | 547 |
| 542 // On Android by default the number of renderer hosts is unlimited and process | 548 // On Android by default the number of renderer hosts is unlimited and process |
| 543 // sharing doesn't happen. We set the override so that the test can run | 549 // sharing doesn't happen. We set the override so that the test can run |
| 544 // everywhere. | 550 // everywhere. |
| 545 RenderProcessHost::SetMaxRendererProcessCount(kMaxRendererProcessCount); | 551 RenderProcessHost::SetMaxRendererProcessCount(kMaxRendererProcessCount); |
| 546 | 552 |
| 547 ChildProcessSecurityPolicyImpl* policy = | 553 ChildProcessSecurityPolicyImpl* policy = |
| 548 ChildProcessSecurityPolicyImpl::GetInstance(); | 554 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 549 | 555 |
| 550 // Make a bunch of mock renderers so that we hit the limit. | 556 // Make a bunch of mock renderers so that we hit the limit. |
| 551 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 557 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 552 ScopedVector<MockRenderProcessHost> hosts; | 558 ScopedVector<MockRenderProcessHost> hosts; |
| 553 for (size_t i = 0; i < kMaxRendererProcessCount; ++i) | 559 for (size_t i = 0; i < kMaxRendererProcessCount; ++i) |
| 554 hosts.push_back(new MockRenderProcessHost(browser_context.get())); | 560 hosts.push_back(new MockRenderProcessHost(browser_context.get())); |
| 555 | 561 |
| 556 // Create some extension instances and make sure they share a process. | 562 // Create some extension instances and make sure they share a process. |
| 557 scoped_refptr<SiteInstanceImpl> extension1_instance( | 563 scoped_refptr<SiteInstanceImpl> extension1_instance( |
| 558 CreateSiteInstance(browser_context.get(), | 564 CreateSiteInstance(browser_context.get(), |
| 559 GURL(kPrivilegedScheme + std::string("://foo/bar")))); | 565 GURL(kPrivilegedScheme + std::string("://foo/bar")))); |
| 560 set_privileged_process_id(extension1_instance->GetProcess()->GetID()); | 566 set_privileged_process_id(extension1_instance->GetProcess()->GetID()); |
| 561 | 567 |
| 562 scoped_refptr<SiteInstanceImpl> extension2_instance( | 568 scoped_refptr<SiteInstanceImpl> extension2_instance( |
| 563 CreateSiteInstance(browser_context.get(), | 569 CreateSiteInstance(browser_context.get(), |
| 564 GURL(kPrivilegedScheme + std::string("://baz/bar")))); | 570 GURL(kPrivilegedScheme + std::string("://baz/bar")))); |
| 565 | 571 |
| 566 scoped_ptr<RenderProcessHost> extension_host( | 572 std::unique_ptr<RenderProcessHost> extension_host( |
| 567 extension1_instance->GetProcess()); | 573 extension1_instance->GetProcess()); |
| 568 EXPECT_EQ(extension1_instance->GetProcess(), | 574 EXPECT_EQ(extension1_instance->GetProcess(), |
| 569 extension2_instance->GetProcess()); | 575 extension2_instance->GetProcess()); |
| 570 | 576 |
| 571 // Create some WebUI instances and make sure they share a process. | 577 // Create some WebUI instances and make sure they share a process. |
| 572 scoped_refptr<SiteInstanceImpl> webui1_instance(CreateSiteInstance( | 578 scoped_refptr<SiteInstanceImpl> webui1_instance(CreateSiteInstance( |
| 573 browser_context.get(), GURL(kChromeUIScheme + std::string("://gpu")))); | 579 browser_context.get(), GURL(kChromeUIScheme + std::string("://gpu")))); |
| 574 policy->GrantWebUIBindings(webui1_instance->GetProcess()->GetID()); | 580 policy->GrantWebUIBindings(webui1_instance->GetProcess()->GetID()); |
| 575 | 581 |
| 576 scoped_refptr<SiteInstanceImpl> webui2_instance(CreateSiteInstance( | 582 scoped_refptr<SiteInstanceImpl> webui2_instance(CreateSiteInstance( |
| 577 browser_context.get(), | 583 browser_context.get(), |
| 578 GURL(kChromeUIScheme + std::string("://media-internals")))); | 584 GURL(kChromeUIScheme + std::string("://media-internals")))); |
| 579 | 585 |
| 580 scoped_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess()); | 586 std::unique_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess()); |
| 581 EXPECT_EQ(webui1_instance->GetProcess(), webui2_instance->GetProcess()); | 587 EXPECT_EQ(webui1_instance->GetProcess(), webui2_instance->GetProcess()); |
| 582 | 588 |
| 583 // Make sure none of differing privilege processes are mixed. | 589 // Make sure none of differing privilege processes are mixed. |
| 584 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); | 590 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); |
| 585 | 591 |
| 586 for (size_t i = 0; i < kMaxRendererProcessCount; ++i) { | 592 for (size_t i = 0; i < kMaxRendererProcessCount; ++i) { |
| 587 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); | 593 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); |
| 588 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); | 594 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); |
| 589 } | 595 } |
| 590 | 596 |
| 591 DrainMessageLoops(); | 597 DrainMessageLoops(); |
| 592 | 598 |
| 593 // Disable the process limit override. | 599 // Disable the process limit override. |
| 594 RenderProcessHost::SetMaxRendererProcessCount(0u); | 600 RenderProcessHost::SetMaxRendererProcessCount(0u); |
| 595 } | 601 } |
| 596 | 602 |
| 597 // Test to ensure that HasWrongProcessForURL behaves properly for different | 603 // Test to ensure that HasWrongProcessForURL behaves properly for different |
| 598 // types of URLs. | 604 // types of URLs. |
| 599 TEST_F(SiteInstanceTest, HasWrongProcessForURL) { | 605 TEST_F(SiteInstanceTest, HasWrongProcessForURL) { |
| 600 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 606 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 601 scoped_ptr<RenderProcessHost> host; | 607 std::unique_ptr<RenderProcessHost> host; |
| 602 scoped_refptr<SiteInstanceImpl> instance( | 608 scoped_refptr<SiteInstanceImpl> instance( |
| 603 SiteInstanceImpl::Create(browser_context.get())); | 609 SiteInstanceImpl::Create(browser_context.get())); |
| 604 | 610 |
| 605 EXPECT_FALSE(instance->HasSite()); | 611 EXPECT_FALSE(instance->HasSite()); |
| 606 EXPECT_TRUE(instance->GetSiteURL().is_empty()); | 612 EXPECT_TRUE(instance->GetSiteURL().is_empty()); |
| 607 | 613 |
| 608 instance->SetSite(GURL("http://evernote.com/")); | 614 instance->SetSite(GURL("http://evernote.com/")); |
| 609 EXPECT_TRUE(instance->HasSite()); | 615 EXPECT_TRUE(instance->HasSite()); |
| 610 | 616 |
| 611 // Check prior to "assigning" a process to the instance, which is expected | 617 // Check prior to "assigning" a process to the instance, which is expected |
| (...skipping 10 matching lines...) Expand all Loading... |
| 622 EXPECT_FALSE(instance->HasWrongProcessForURL( | 628 EXPECT_FALSE(instance->HasWrongProcessForURL( |
| 623 GURL("javascript:alert(document.location.href);"))); | 629 GURL("javascript:alert(document.location.href);"))); |
| 624 | 630 |
| 625 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://gpu"))); | 631 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://gpu"))); |
| 626 | 632 |
| 627 // Test that WebUI SiteInstances reject normal web URLs. | 633 // Test that WebUI SiteInstances reject normal web URLs. |
| 628 const GURL webui_url("chrome://gpu"); | 634 const GURL webui_url("chrome://gpu"); |
| 629 scoped_refptr<SiteInstanceImpl> webui_instance( | 635 scoped_refptr<SiteInstanceImpl> webui_instance( |
| 630 SiteInstanceImpl::Create(browser_context.get())); | 636 SiteInstanceImpl::Create(browser_context.get())); |
| 631 webui_instance->SetSite(webui_url); | 637 webui_instance->SetSite(webui_url); |
| 632 scoped_ptr<RenderProcessHost> webui_host(webui_instance->GetProcess()); | 638 std::unique_ptr<RenderProcessHost> webui_host(webui_instance->GetProcess()); |
| 633 | 639 |
| 634 // Simulate granting WebUI bindings for the process. | 640 // Simulate granting WebUI bindings for the process. |
| 635 ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings( | 641 ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings( |
| 636 webui_host->GetID()); | 642 webui_host->GetID()); |
| 637 | 643 |
| 638 EXPECT_TRUE(webui_instance->HasProcess()); | 644 EXPECT_TRUE(webui_instance->HasProcess()); |
| 639 EXPECT_FALSE(webui_instance->HasWrongProcessForURL(webui_url)); | 645 EXPECT_FALSE(webui_instance->HasWrongProcessForURL(webui_url)); |
| 640 EXPECT_TRUE(webui_instance->HasWrongProcessForURL(GURL("http://google.com"))); | 646 EXPECT_TRUE(webui_instance->HasWrongProcessForURL(GURL("http://google.com"))); |
| 641 EXPECT_TRUE(webui_instance->HasWrongProcessForURL(GURL("http://gpu"))); | 647 EXPECT_TRUE(webui_instance->HasWrongProcessForURL(GURL("http://gpu"))); |
| 642 | 648 |
| 643 // WebUI uses process-per-site, so another instance will use the same process | 649 // WebUI uses process-per-site, so another instance will use the same process |
| 644 // even if we haven't called GetProcess yet. Make sure HasWrongProcessForURL | 650 // even if we haven't called GetProcess yet. Make sure HasWrongProcessForURL |
| 645 // doesn't crash (http://crbug.com/137070). | 651 // doesn't crash (http://crbug.com/137070). |
| 646 scoped_refptr<SiteInstanceImpl> webui_instance2( | 652 scoped_refptr<SiteInstanceImpl> webui_instance2( |
| 647 SiteInstanceImpl::Create(browser_context.get())); | 653 SiteInstanceImpl::Create(browser_context.get())); |
| 648 webui_instance2->SetSite(webui_url); | 654 webui_instance2->SetSite(webui_url); |
| 649 EXPECT_FALSE(webui_instance2->HasWrongProcessForURL(webui_url)); | 655 EXPECT_FALSE(webui_instance2->HasWrongProcessForURL(webui_url)); |
| 650 EXPECT_TRUE( | 656 EXPECT_TRUE( |
| 651 webui_instance2->HasWrongProcessForURL(GURL("http://google.com"))); | 657 webui_instance2->HasWrongProcessForURL(GURL("http://google.com"))); |
| 652 | 658 |
| 653 DrainMessageLoops(); | 659 DrainMessageLoops(); |
| 654 } | 660 } |
| 655 | 661 |
| 656 // Test to ensure that HasWrongProcessForURL behaves properly even when | 662 // Test to ensure that HasWrongProcessForURL behaves properly even when |
| 657 // --site-per-process is used (http://crbug.com/160671). | 663 // --site-per-process is used (http://crbug.com/160671). |
| 658 TEST_F(SiteInstanceTest, HasWrongProcessForURLInSitePerProcess) { | 664 TEST_F(SiteInstanceTest, HasWrongProcessForURLInSitePerProcess) { |
| 659 IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess()); | 665 IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess()); |
| 660 | 666 |
| 661 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 667 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 662 scoped_ptr<RenderProcessHost> host; | 668 std::unique_ptr<RenderProcessHost> host; |
| 663 scoped_refptr<SiteInstanceImpl> instance( | 669 scoped_refptr<SiteInstanceImpl> instance( |
| 664 SiteInstanceImpl::Create(browser_context.get())); | 670 SiteInstanceImpl::Create(browser_context.get())); |
| 665 | 671 |
| 666 instance->SetSite(GURL("http://evernote.com/")); | 672 instance->SetSite(GURL("http://evernote.com/")); |
| 667 EXPECT_TRUE(instance->HasSite()); | 673 EXPECT_TRUE(instance->HasSite()); |
| 668 | 674 |
| 669 // Check prior to "assigning" a process to the instance, which is expected | 675 // Check prior to "assigning" a process to the instance, which is expected |
| 670 // to return false due to not being attached to any process yet. | 676 // to return false due to not being attached to any process yet. |
| 671 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://google.com"))); | 677 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://google.com"))); |
| 672 | 678 |
| 673 // The call to GetProcess actually creates a new real process, which works | 679 // The call to GetProcess actually creates a new real process, which works |
| 674 // fine, but might be a cause for problems in different contexts. | 680 // fine, but might be a cause for problems in different contexts. |
| 675 host.reset(instance->GetProcess()); | 681 host.reset(instance->GetProcess()); |
| 676 EXPECT_TRUE(host.get() != nullptr); | 682 EXPECT_TRUE(host.get() != nullptr); |
| 677 EXPECT_TRUE(instance->HasProcess()); | 683 EXPECT_TRUE(instance->HasProcess()); |
| 678 | 684 |
| 679 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); | 685 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); |
| 680 EXPECT_FALSE(instance->HasWrongProcessForURL( | 686 EXPECT_FALSE(instance->HasWrongProcessForURL( |
| 681 GURL("javascript:alert(document.location.href);"))); | 687 GURL("javascript:alert(document.location.href);"))); |
| 682 | 688 |
| 683 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://gpu"))); | 689 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://gpu"))); |
| 684 | 690 |
| 685 DrainMessageLoops(); | 691 DrainMessageLoops(); |
| 686 } | 692 } |
| 687 | 693 |
| 688 // Test that we do not reuse a process in process-per-site mode if it has the | 694 // Test that we do not reuse a process in process-per-site mode if it has the |
| 689 // wrong bindings for its URL. http://crbug.com/174059. | 695 // wrong bindings for its URL. http://crbug.com/174059. |
| 690 TEST_F(SiteInstanceTest, ProcessPerSiteWithWrongBindings) { | 696 TEST_F(SiteInstanceTest, ProcessPerSiteWithWrongBindings) { |
| 691 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 697 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 692 scoped_ptr<RenderProcessHost> host; | 698 std::unique_ptr<RenderProcessHost> host; |
| 693 scoped_ptr<RenderProcessHost> host2; | 699 std::unique_ptr<RenderProcessHost> host2; |
| 694 scoped_refptr<SiteInstanceImpl> instance( | 700 scoped_refptr<SiteInstanceImpl> instance( |
| 695 SiteInstanceImpl::Create(browser_context.get())); | 701 SiteInstanceImpl::Create(browser_context.get())); |
| 696 | 702 |
| 697 EXPECT_FALSE(instance->HasSite()); | 703 EXPECT_FALSE(instance->HasSite()); |
| 698 EXPECT_TRUE(instance->GetSiteURL().is_empty()); | 704 EXPECT_TRUE(instance->GetSiteURL().is_empty()); |
| 699 | 705 |
| 700 // Simulate navigating to a WebUI URL in a process that does not have WebUI | 706 // Simulate navigating to a WebUI URL in a process that does not have WebUI |
| 701 // bindings. This already requires bypassing security checks. | 707 // bindings. This already requires bypassing security checks. |
| 702 const GURL webui_url("chrome://gpu"); | 708 const GURL webui_url("chrome://gpu"); |
| 703 instance->SetSite(webui_url); | 709 instance->SetSite(webui_url); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 723 EXPECT_NE(host.get(), host2.get()); | 729 EXPECT_NE(host.get(), host2.get()); |
| 724 | 730 |
| 725 DrainMessageLoops(); | 731 DrainMessageLoops(); |
| 726 } | 732 } |
| 727 | 733 |
| 728 // Test that we do not register processes with empty sites for process-per-site | 734 // Test that we do not register processes with empty sites for process-per-site |
| 729 // mode. | 735 // mode. |
| 730 TEST_F(SiteInstanceTest, NoProcessPerSiteForEmptySite) { | 736 TEST_F(SiteInstanceTest, NoProcessPerSiteForEmptySite) { |
| 731 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 737 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 732 switches::kProcessPerSite); | 738 switches::kProcessPerSite); |
| 733 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 739 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 734 scoped_ptr<RenderProcessHost> host; | 740 std::unique_ptr<RenderProcessHost> host; |
| 735 scoped_refptr<SiteInstanceImpl> instance( | 741 scoped_refptr<SiteInstanceImpl> instance( |
| 736 SiteInstanceImpl::Create(browser_context.get())); | 742 SiteInstanceImpl::Create(browser_context.get())); |
| 737 | 743 |
| 738 instance->SetSite(GURL()); | 744 instance->SetSite(GURL()); |
| 739 EXPECT_TRUE(instance->HasSite()); | 745 EXPECT_TRUE(instance->HasSite()); |
| 740 EXPECT_TRUE(instance->GetSiteURL().is_empty()); | 746 EXPECT_TRUE(instance->GetSiteURL().is_empty()); |
| 741 host.reset(instance->GetProcess()); | 747 host.reset(instance->GetProcess()); |
| 742 | 748 |
| 743 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( | 749 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( |
| 744 browser_context.get(), GURL())); | 750 browser_context.get(), GURL())); |
| 745 | 751 |
| 746 DrainMessageLoops(); | 752 DrainMessageLoops(); |
| 747 } | 753 } |
| 748 | 754 |
| 749 TEST_F(SiteInstanceTest, DefaultSubframeSiteInstance) { | 755 TEST_F(SiteInstanceTest, DefaultSubframeSiteInstance) { |
| 750 if (AreAllSitesIsolatedForTesting()) | 756 if (AreAllSitesIsolatedForTesting()) |
| 751 return; // --top-document-isolation is not possible. | 757 return; // --top-document-isolation is not possible. |
| 752 | 758 |
| 753 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 759 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 754 switches::kTopDocumentIsolation); | 760 switches::kTopDocumentIsolation); |
| 755 | 761 |
| 756 scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); | 762 std::unique_ptr<TestBrowserContext> browser_context(new TestBrowserContext()); |
| 757 scoped_refptr<SiteInstanceImpl> main_instance = | 763 scoped_refptr<SiteInstanceImpl> main_instance = |
| 758 SiteInstanceImpl::Create(browser_context.get()); | 764 SiteInstanceImpl::Create(browser_context.get()); |
| 759 scoped_refptr<SiteInstanceImpl> subframe_instance = | 765 scoped_refptr<SiteInstanceImpl> subframe_instance = |
| 760 main_instance->GetDefaultSubframeSiteInstance(); | 766 main_instance->GetDefaultSubframeSiteInstance(); |
| 761 int subframe_instance_id = subframe_instance->GetId(); | 767 int subframe_instance_id = subframe_instance->GetId(); |
| 762 | 768 |
| 763 EXPECT_NE(main_instance, subframe_instance); | 769 EXPECT_NE(main_instance, subframe_instance); |
| 764 EXPECT_EQ(subframe_instance, main_instance->GetDefaultSubframeSiteInstance()); | 770 EXPECT_EQ(subframe_instance, main_instance->GetDefaultSubframeSiteInstance()); |
| 765 EXPECT_FALSE(main_instance->is_default_subframe_site_instance()); | 771 EXPECT_FALSE(main_instance->is_default_subframe_site_instance()); |
| 766 EXPECT_TRUE(subframe_instance->is_default_subframe_site_instance()); | 772 EXPECT_TRUE(subframe_instance->is_default_subframe_site_instance()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 789 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 795 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 790 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 796 EXPECT_EQ(0, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 791 | 797 |
| 792 // Free the subframe instance, which should free the browsing instance. | 798 // Free the subframe instance, which should free the browsing instance. |
| 793 subframe_instance = nullptr; | 799 subframe_instance = nullptr; |
| 794 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); | 800 EXPECT_EQ(1, browser_client()->GetAndClearSiteInstanceDeleteCount()); |
| 795 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); | 801 EXPECT_EQ(1, browser_client()->GetAndClearBrowsingInstanceDeleteCount()); |
| 796 } | 802 } |
| 797 | 803 |
| 798 } // namespace content | 804 } // namespace content |
| OLD | NEW |