| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
| 10 #include "content/browser/browsing_instance.h" | 10 #include "content/browser/browsing_instance.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // browsing_instance is now deleted | 242 // browsing_instance is now deleted |
| 243 | 243 |
| 244 // Ensure that instances are deleted when their RenderViewHosts are gone. | 244 // Ensure that instances are deleted when their RenderViewHosts are gone. |
| 245 scoped_ptr<content::TestBrowserContext> browser_context( | 245 scoped_ptr<content::TestBrowserContext> browser_context( |
| 246 new content::TestBrowserContext()); | 246 new content::TestBrowserContext()); |
| 247 instance = | 247 instance = |
| 248 TestSiteInstance::CreateTestSiteInstance(browser_context.get(), | 248 TestSiteInstance::CreateTestSiteInstance(browser_context.get(), |
| 249 &site_delete_counter, | 249 &site_delete_counter, |
| 250 &browsing_delete_counter); | 250 &browsing_delete_counter); |
| 251 { | 251 { |
| 252 WebContentsImpl web_contents(browser_context.get(), instance, | 252 scoped_ptr<WebContentsImpl> web_contents( |
| 253 MSG_ROUTING_NONE, NULL, NULL, NULL); | 253 WebContentsImpl::Create(browser_context.get(), instance, |
| 254 MSG_ROUTING_NONE, NULL)); |
| 254 EXPECT_EQ(1, site_delete_counter); | 255 EXPECT_EQ(1, site_delete_counter); |
| 255 EXPECT_EQ(1, browsing_delete_counter); | 256 EXPECT_EQ(1, browsing_delete_counter); |
| 256 } | 257 } |
| 257 | 258 |
| 258 // Make sure that we flush any messages related to the above WebContentsImpl | 259 // Make sure that we flush any messages related to the above WebContentsImpl |
| 259 // destruction. | 260 // destruction. |
| 260 MessageLoop::current()->RunAllPending(); | 261 MessageLoop::current()->RunAllPending(); |
| 261 | 262 |
| 262 EXPECT_EQ(2, site_delete_counter); | 263 EXPECT_EQ(2, site_delete_counter); |
| 263 EXPECT_EQ(2, browsing_delete_counter); | 264 EXPECT_EQ(2, browsing_delete_counter); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 host.reset(instance->GetProcess()); | 644 host.reset(instance->GetProcess()); |
| 644 EXPECT_TRUE(host.get() != NULL); | 645 EXPECT_TRUE(host.get() != NULL); |
| 645 EXPECT_TRUE(instance->HasProcess()); | 646 EXPECT_TRUE(instance->HasProcess()); |
| 646 | 647 |
| 647 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); | 648 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); |
| 648 EXPECT_FALSE(instance->HasWrongProcessForURL( | 649 EXPECT_FALSE(instance->HasWrongProcessForURL( |
| 649 GURL("javascript:alert(document.location.href);"))); | 650 GURL("javascript:alert(document.location.href);"))); |
| 650 | 651 |
| 651 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); | 652 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); |
| 652 } | 653 } |
| OLD | NEW |