| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stl_util-inl.h" | 5 #include "base/stl_util-inl.h" |
| 6 #include "base/string16.h" | 6 #include "base/string16.h" |
| 7 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 7 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 8 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual content::WebUIFactory* GetWebUIFactory() { | 43 virtual content::WebUIFactory* GetWebUIFactory() { |
| 44 return &factory_; | 44 return &factory_; |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 SiteInstanceTestWebUIFactory factory_; | 48 SiteInstanceTestWebUIFactory factory_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class SiteInstanceTest : public testing::Test { | 51 class SiteInstanceTest : public testing::Test { |
| 52 public: | 52 public: |
| 53 SiteInstanceTest() : old_browser_client_(NULL) { |
| 54 } |
| 55 |
| 53 virtual void SetUp() { | 56 virtual void SetUp() { |
| 57 old_browser_client_ = content::GetContentClient()->browser(); |
| 54 content::GetContentClient()->set_browser(&browser_client_); | 58 content::GetContentClient()->set_browser(&browser_client_); |
| 55 } | 59 } |
| 56 | 60 |
| 61 virtual void TearDown() { |
| 62 content::GetContentClient()->set_browser(old_browser_client_); |
| 63 } |
| 64 |
| 57 private: | 65 private: |
| 58 MessageLoopForUI message_loop_; | 66 MessageLoopForUI message_loop_; |
| 59 | 67 |
| 60 SiteInstanceTestBrowserClient browser_client_; | 68 SiteInstanceTestBrowserClient browser_client_; |
| 69 content::ContentBrowserClient* old_browser_client_; |
| 61 }; | 70 }; |
| 62 | 71 |
| 63 class TestBrowsingInstance : public BrowsingInstance { | 72 class TestBrowsingInstance : public BrowsingInstance { |
| 64 public: | 73 public: |
| 65 TestBrowsingInstance(Profile* profile, int* deleteCounter) | 74 TestBrowsingInstance(Profile* profile, int* deleteCounter) |
| 66 : BrowsingInstance(profile), | 75 : BrowsingInstance(profile), |
| 67 use_process_per_site(false), | 76 use_process_per_site(false), |
| 68 deleteCounter_(deleteCounter) { | 77 deleteCounter_(deleteCounter) { |
| 69 } | 78 } |
| 70 | 79 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 GURL("chrome-extension://baz/bar"))); | 565 GURL("chrome-extension://baz/bar"))); |
| 557 EXPECT_EQ(s5a, s5b); | 566 EXPECT_EQ(s5a, s5b); |
| 558 | 567 |
| 559 // The derived profiles with the different sites. | 568 // The derived profiles with the different sites. |
| 560 scoped_refptr<SiteInstance> s6a(instance1->GetSiteInstanceForURL( | 569 scoped_refptr<SiteInstance> s6a(instance1->GetSiteInstanceForURL( |
| 561 GURL("chrome-extension://baz/bar"))); | 570 GURL("chrome-extension://baz/bar"))); |
| 562 scoped_refptr<SiteInstance> s6b(instance3->GetSiteInstanceForURL( | 571 scoped_refptr<SiteInstance> s6b(instance3->GetSiteInstanceForURL( |
| 563 GURL("chrome-extension://foo/boo"))); | 572 GURL("chrome-extension://foo/boo"))); |
| 564 EXPECT_NE(s6a, s6b); | 573 EXPECT_NE(s6a, s6b); |
| 565 } | 574 } |
| OLD | NEW |