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

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

Issue 9706012: Add abstractions that let embedders drive tests of WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove CONTENT_EXPORT on statically linked functions. Merge to head for commit. Created 8 years, 9 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_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 class SiteInstanceTest : public testing::Test { 111 class SiteInstanceTest : public testing::Test {
112 public: 112 public:
113 SiteInstanceTest() 113 SiteInstanceTest()
114 : ui_thread_(BrowserThread::UI, &message_loop_), 114 : ui_thread_(BrowserThread::UI, &message_loop_),
115 old_client_(NULL), 115 old_client_(NULL),
116 old_browser_client_(NULL) { 116 old_browser_client_(NULL) {
117 } 117 }
118 118
119 virtual void SetUp() { 119 virtual void SetUp() {
120 old_client_ = content::GetContentClient(); 120 old_client_ = content::GetContentClient();
121 old_browser_client_ = content::GetContentClient()->browser();
121 content::SetContentClient(&client_); 122 content::SetContentClient(&client_);
122 old_browser_client_ = content::GetContentClient()->browser();
123 content::GetContentClient()->set_browser(&browser_client_); 123 content::GetContentClient()->set_browser(&browser_client_);
124 url_util::AddStandardScheme(kPrivilegedScheme); 124 url_util::AddStandardScheme(kPrivilegedScheme);
125 url_util::AddStandardScheme(chrome::kChromeUIScheme); 125 url_util::AddStandardScheme(chrome::kChromeUIScheme);
126 } 126 }
127 127
128 virtual void TearDown() { 128 virtual void TearDown() {
129 content::GetContentClient()->set_browser(old_browser_client_); 129 content::GetContentClient()->set_browser(old_browser_client_);
130 content::SetContentClient(old_client_); 130 content::SetContentClient(old_client_);
131 } 131 }
132 132
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 host.reset(instance->GetProcess()); 614 host.reset(instance->GetProcess());
615 EXPECT_TRUE(host.get() != NULL); 615 EXPECT_TRUE(host.get() != NULL);
616 EXPECT_TRUE(instance->HasProcess()); 616 EXPECT_TRUE(instance->HasProcess());
617 617
618 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); 618 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com")));
619 EXPECT_FALSE(instance->HasWrongProcessForURL( 619 EXPECT_FALSE(instance->HasWrongProcessForURL(
620 GURL("javascript:alert(document.location.href);"))); 620 GURL("javascript:alert(document.location.href);")));
621 621
622 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); 622 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings")));
623 } 623 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698