Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: content/browser/site_instance_unittest.cc

Issue 8400060: Switch content tests to use BrowserThreadImpl directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_impl.h"
8 #include "content/browser/browsing_instance.h" 9 #include "content/browser/browsing_instance.h"
9 #include "content/browser/child_process_security_policy.h" 10 #include "content/browser/child_process_security_policy.h"
10 #include "content/browser/mock_content_browser_client.h" 11 #include "content/browser/mock_content_browser_client.h"
11 #include "content/browser/renderer_host/browser_render_process_host.h" 12 #include "content/browser/renderer_host/browser_render_process_host.h"
12 #include "content/browser/renderer_host/render_view_host.h" 13 #include "content/browser/renderer_host/render_view_host.h"
13 #include "content/browser/renderer_host/test_render_view_host.h" 14 #include "content/browser/renderer_host/test_render_view_host.h"
14 #include "content/browser/site_instance.h" 15 #include "content/browser/site_instance.h"
15 #include "content/browser/tab_contents/navigation_entry.h" 16 #include "content/browser/tab_contents/navigation_entry.h"
16 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
17 #include "content/browser/webui/empty_web_ui_factory.h" 18 #include "content/browser/webui/empty_web_ui_factory.h"
18 #include "content/public/common/content_client.h" 19 #include "content/public/common/content_client.h"
19 #include "content/public/common/content_constants.h" 20 #include "content/public/common/content_constants.h"
20 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
21 #include "content/test/test_browser_context.h" 22 #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 using content::BrowserThreadImpl;
27
26 namespace { 28 namespace {
27 29
28 const char kSameAsAnyInstanceURL[] = "about:internets"; 30 const char kSameAsAnyInstanceURL[] = "about:internets";
29 31
30 const char kPrivilegedScheme[] = "privileged"; 32 const char kPrivilegedScheme[] = "privileged";
31 33
32 class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory { 34 class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory {
33 public: 35 public:
34 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, 36 virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
35 const GURL& url) const OVERRIDE { 37 const GURL& url) const OVERRIDE {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 virtual void TearDown() { 110 virtual void TearDown() {
109 content::GetContentClient()->set_browser(old_browser_client_); 111 content::GetContentClient()->set_browser(old_browser_client_);
110 } 112 }
111 113
112 void SetPrivilegedProcessId(int process_id) { 114 void SetPrivilegedProcessId(int process_id) {
113 browser_client_.SetPrivilegedProcessId(process_id); 115 browser_client_.SetPrivilegedProcessId(process_id);
114 } 116 }
115 117
116 private: 118 private:
117 MessageLoopForUI message_loop_; 119 MessageLoopForUI message_loop_;
118 content::TestBrowserThread ui_thread_; 120 BrowserThreadImpl ui_thread_;
119 121
120 SiteInstanceTestBrowserClient browser_client_; 122 SiteInstanceTestBrowserClient browser_client_;
121 content::ContentBrowserClient* old_browser_client_; 123 content::ContentBrowserClient* old_browser_client_;
122 }; 124 };
123 125
124 class TestBrowsingInstance : public BrowsingInstance { 126 class TestBrowsingInstance : public BrowsingInstance {
125 public: 127 public:
126 TestBrowsingInstance(content::BrowserContext* browser_context, 128 TestBrowsingInstance(content::BrowserContext* browser_context,
127 int* deleteCounter) 129 int* deleteCounter)
128 : BrowsingInstance(browser_context), 130 : BrowsingInstance(browser_context),
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // Make sure none of differing privilege processes are mixed. 561 // Make sure none of differing privilege processes are mixed.
560 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); 562 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess());
561 563
562 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { 564 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) {
563 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); 565 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]);
564 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); 566 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]);
565 } 567 }
566 568
567 STLDeleteContainerPointers(hosts.begin(), hosts.end()); 569 STLDeleteContainerPointers(hosts.begin(), hosts.end());
568 } 570 }
OLDNEW
« no previous file with comments | « content/browser/resolve_proxy_msg_helper_unittest.cc ('k') | content/browser/speech/speech_recognizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698