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

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

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slight tweaking for comments Created 9 years, 4 months 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
« no previous file with comments | « content/browser/site_instance.cc ('k') | content/browser/ssl/ssl_policy_backend.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/test/testing_profile.h" 8 #include "chrome/test/testing_profile.h"
9 #include "content/browser/browser_thread.h" 9 #include "content/browser/browser_thread.h"
10 #include "content/browser/browsing_instance.h" 10 #include "content/browser/browsing_instance.h"
(...skipping 10 matching lines...) Expand all
21 #include "content/common/content_constants.h" 21 #include "content/common/content_constants.h"
22 #include "content/common/url_constants.h" 22 #include "content/common/url_constants.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 namespace { 25 namespace {
26 26
27 const char kSameAsAnyInstanceURL[] = "about:internets"; 27 const char kSameAsAnyInstanceURL[] = "about:internets";
28 28
29 class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory { 29 class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory {
30 public: 30 public:
31 virtual bool UseWebUIForURL(Profile* profile, const GURL& url) const { 31 virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
32 const GURL& url) const OVERRIDE {
32 return HasWebUIScheme(url); 33 return HasWebUIScheme(url);
33 } 34 }
34 virtual bool HasWebUIScheme(const GURL& url) const { 35 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
35 return url.SchemeIs(chrome::kChromeUIScheme); 36 return url.SchemeIs(chrome::kChromeUIScheme);
36 } 37 }
37 }; 38 };
38 39
39 class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient { 40 class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient {
40 public: 41 public:
41 virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE { 42 virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE {
42 return &factory_; 43 return &factory_;
43 } 44 }
44 45
45 virtual bool ShouldUseProcessPerSite(Profile* profile, 46 virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
46 const GURL& effective_url) OVERRIDE { 47 const GURL& effective_url) OVERRIDE {
47 return false; 48 return false;
48 } 49 }
49 50
50 virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE { 51 virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE {
51 return url == GURL(kSameAsAnyInstanceURL) || 52 return url == GURL(kSameAsAnyInstanceURL) ||
52 url == GURL(chrome::kAboutCrashURL); 53 url == GURL(chrome::kAboutCrashURL);
53 } 54 }
54 55
55 virtual GURL GetEffectiveURL(Profile* profile, const GURL& url) OVERRIDE { 56 virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
57 const GURL& url) OVERRIDE {
56 return url; 58 return url;
57 } 59 }
58 60
59 private: 61 private:
60 SiteInstanceTestWebUIFactory factory_; 62 SiteInstanceTestWebUIFactory factory_;
61 }; 63 };
62 64
63 class SiteInstanceTest : public testing::Test { 65 class SiteInstanceTest : public testing::Test {
64 public: 66 public:
65 SiteInstanceTest() 67 SiteInstanceTest()
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // Make sure none of differing privilege processes are mixed. 513 // Make sure none of differing privilege processes are mixed.
512 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); 514 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess());
513 515
514 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { 516 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) {
515 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); 517 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]);
516 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); 518 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]);
517 } 519 }
518 520
519 STLDeleteContainerPointers(hosts.begin(), hosts.end()); 521 STLDeleteContainerPointers(hosts.begin(), hosts.end());
520 } 522 }
OLDNEW
« no previous file with comments | « content/browser/site_instance.cc ('k') | content/browser/ssl/ssl_policy_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698