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

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

Issue 9221017: Hide BrowsingInstance from all but SiteInstance, as intended by design. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 11 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
OLDNEW
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/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/browser_thread_impl.h"
9 #include "content/browser/browsing_instance.h" 9 #include "content/browser/browsing_instance.h"
10 #include "content/browser/child_process_security_policy.h" 10 #include "content/browser/child_process_security_policy.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Overrides BrowsingInstance::ShouldUseProcessPerSite so that we can test 126 // Overrides BrowsingInstance::ShouldUseProcessPerSite so that we can test
127 // both alternatives without using command-line switches. 127 // both alternatives without using command-line switches.
128 bool ShouldUseProcessPerSite(const GURL& url) { 128 bool ShouldUseProcessPerSite(const GURL& url) {
129 return use_process_per_site_; 129 return use_process_per_site_;
130 } 130 }
131 131
132 void set_use_process_per_site(bool use_process_per_site) { 132 void set_use_process_per_site(bool use_process_per_site) {
133 use_process_per_site_ = use_process_per_site; 133 use_process_per_site_ = use_process_per_site;
134 } 134 }
135 135
136 // Make a few methods public for tests.
137 using BrowsingInstance::ShouldUseProcessPerSite;
138 using BrowsingInstance::browser_context;
139 using BrowsingInstance::HasSiteInstance;
140 using BrowsingInstance::GetSiteInstanceForURL;
141 using BrowsingInstance::RegisterSiteInstance;
142 using BrowsingInstance::UnregisterSiteInstance;
143
136 private: 144 private:
137 virtual ~TestBrowsingInstance() { 145 virtual ~TestBrowsingInstance() {
138 (*delete_counter_)++; 146 (*delete_counter_)++;
139 } 147 }
140 148
141 // Set by individual tests. 149 // Set by individual tests.
142 bool use_process_per_site_; 150 bool use_process_per_site_;
143 151
144 int* delete_counter_; 152 int* delete_counter_;
145 }; 153 };
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 host.reset(instance->GetProcess()); 582 host.reset(instance->GetProcess());
575 EXPECT_TRUE(host.get() != NULL); 583 EXPECT_TRUE(host.get() != NULL);
576 EXPECT_TRUE(instance->HasProcess()); 584 EXPECT_TRUE(instance->HasProcess());
577 585
578 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); 586 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com")));
579 EXPECT_FALSE(instance->HasWrongProcessForURL( 587 EXPECT_FALSE(instance->HasWrongProcessForURL(
580 GURL("javascript:alert(document.location.href);"))); 588 GURL("javascript:alert(document.location.href);")));
581 589
582 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); 590 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings")));
583 } 591 }
OLDNEW
« no previous file with comments | « content/browser/site_instance.cc ('k') | content/browser/tab_contents/render_view_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698