| 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "content/browser/browser_thread.h" | |
| 9 #include "content/browser/browsing_instance.h" | 8 #include "content/browser/browsing_instance.h" |
| 10 #include "content/browser/child_process_security_policy.h" | 9 #include "content/browser/child_process_security_policy.h" |
| 11 #include "content/browser/mock_content_browser_client.h" | 10 #include "content/browser/mock_content_browser_client.h" |
| 12 #include "content/browser/renderer_host/browser_render_process_host.h" | 11 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 13 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
| 14 #include "content/browser/renderer_host/test_render_view_host.h" | 13 #include "content/browser/renderer_host/test_render_view_host.h" |
| 15 #include "content/browser/site_instance.h" | 14 #include "content/browser/site_instance.h" |
| 16 #include "content/browser/tab_contents/navigation_entry.h" | 15 #include "content/browser/tab_contents/navigation_entry.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "content/browser/webui/empty_web_ui_factory.h" | 17 #include "content/browser/webui/empty_web_ui_factory.h" |
| 19 #include "content/common/content_constants.h" | 18 #include "content/common/content_constants.h" |
| 20 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
| 22 #include "content/test/test_browser_context.h" | 21 #include "content/test/test_browser_context.h" |
| 22 #include "content/test/test_browser_thread.h" |
| 23 #include "googleurl/src/url_util.h" | 23 #include "googleurl/src/url_util.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const char kSameAsAnyInstanceURL[] = "about:internets"; | 28 const char kSameAsAnyInstanceURL[] = "about:internets"; |
| 29 | 29 |
| 30 const char kPrivilegedScheme[] = "privileged"; | 30 const char kPrivilegedScheme[] = "privileged"; |
| 31 | 31 |
| 32 class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory { | 32 class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 virtual void TearDown() { | 108 virtual void TearDown() { |
| 109 content::GetContentClient()->set_browser(old_browser_client_); | 109 content::GetContentClient()->set_browser(old_browser_client_); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SetPrivilegedProcessId(int process_id) { | 112 void SetPrivilegedProcessId(int process_id) { |
| 113 browser_client_.SetPrivilegedProcessId(process_id); | 113 browser_client_.SetPrivilegedProcessId(process_id); |
| 114 } | 114 } |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 MessageLoopForUI message_loop_; | 117 MessageLoopForUI message_loop_; |
| 118 BrowserThread ui_thread_; | 118 content::TestBrowserThread ui_thread_; |
| 119 | 119 |
| 120 SiteInstanceTestBrowserClient browser_client_; | 120 SiteInstanceTestBrowserClient browser_client_; |
| 121 content::ContentBrowserClient* old_browser_client_; | 121 content::ContentBrowserClient* old_browser_client_; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 class TestBrowsingInstance : public BrowsingInstance { | 124 class TestBrowsingInstance : public BrowsingInstance { |
| 125 public: | 125 public: |
| 126 TestBrowsingInstance(content::BrowserContext* browser_context, | 126 TestBrowsingInstance(content::BrowserContext* browser_context, |
| 127 int* deleteCounter) | 127 int* deleteCounter) |
| 128 : BrowsingInstance(browser_context), | 128 : BrowsingInstance(browser_context), |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // Make sure none of differing privilege processes are mixed. | 559 // Make sure none of differing privilege processes are mixed. |
| 560 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); | 560 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); |
| 561 | 561 |
| 562 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { | 562 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { |
| 563 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); | 563 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); |
| 564 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); | 564 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); |
| 565 } | 565 } |
| 566 | 566 |
| 567 STLDeleteContainerPointers(hosts.begin(), hosts.end()); | 567 STLDeleteContainerPointers(hosts.begin(), hosts.end()); |
| 568 } | 568 } |
| OLD | NEW |