summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 18:19:59 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 18:19:59 +0000
commit97e780da17ba0e8933e690e33751e19c5fe1bbb9 (patch)
tree000fd0f30e238c1f523a92e7094ad1bbc0cd7bb5 /chrome
parent7ffdf6ebd685eee46e65dbdc03862b79fa0522f5 (diff)
downloadchromium_src-97e780da17ba0e8933e690e33751e19c5fe1bbb9.zip
chromium_src-97e780da17ba0e8933e690e33751e19c5fe1bbb9.tar.gz
chromium_src-97e780da17ba0e8933e690e33751e19c5fe1bbb9.tar.bz2
Make contents settable in RVHTH.
Add ability to swap out the TestTabContents in RenderViewHostTestHarness/TabContentsWrapperTestHarness. BUG=71097 TEST=no visible change Review URL: http://codereview.chromium.org/6720050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/offline/offline_load_page_unittest.cc4
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_unittest.cc4
-rw-r--r--chrome/browser/safe_browsing/malware_details_unittest.cc6
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc8
-rw-r--r--chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm2
-rw-r--r--chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc6
-rw-r--r--chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h2
7 files changed, 19 insertions, 13 deletions
diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
index 5e722d6..c9dce52 100644
--- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
+++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -65,7 +65,7 @@ class OfflineLoadPageTest : public RenderViewHostTestHarness,
void Navigate(const char* url, int page_id) {
ViewHostMsg_FrameNavigate_Params params;
InitNavigateParams(&params, page_id, GURL(url), PageTransition::TYPED);
- contents()->TestDidNavigate(contents_->render_view_host(), params);
+ contents()->TestDidNavigate(contents()->render_view_host(), params);
}
void ShowInterstitial(const char* url) {
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
index b1c1b69..bb31fdf 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -176,10 +176,10 @@ void GeolocationPermissionContextTests::SetUp() {
RenderViewHostTestHarness::SetUp();
GeolocationArbitrator::SetDependencyFactoryForTest(
dependency_factory_.get());
- SiteInstance* site_instance = contents_->GetSiteInstance();
+ SiteInstance* site_instance = contents()->GetSiteInstance();
tab_contents_with_pending_infobar_ =
new TestTabContentsWithPendingInfoBar(profile_.get(), site_instance);
- contents_.reset(tab_contents_with_pending_infobar_);
+ SetContents(tab_contents_with_pending_infobar_);
geolocation_permission_context_ =
new GeolocationPermissionContext(profile());
}
diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc
index 3ec7f32..043f766 100644
--- a/chrome/browser/safe_browsing/malware_details_unittest.cc
+++ b/chrome/browser/safe_browsing/malware_details_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -48,8 +48,8 @@ class MalwareDetailsTest : public RenderViewHostTestHarness {
resource->url = url;
resource->resource_type = resource_type;
resource->threat_type = SafeBrowsingService::URL_MALWARE;
- resource->render_process_host_id = contents_->GetRenderProcessHost()->id();
- resource->render_view_id = contents_->render_view_host()->routing_id();
+ resource->render_process_host_id = contents()->GetRenderProcessHost()->id();
+ resource->render_view_id = contents()->render_view_host()->routing_id();
}
void VerifyResults(const ClientMalwareReportRequest& report_pb,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index c6858c7..1bf5ddf 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -101,7 +101,7 @@ class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness,
void Navigate(const char* url, int page_id) {
ViewHostMsg_FrameNavigate_Params params;
InitNavigateParams(&params, page_id, GURL(url), PageTransition::TYPED);
- contents()->TestDidNavigate(contents_->render_view_host(), params);
+ contents()->TestDidNavigate(contents()->render_view_host(), params);
}
void GoBackCrossSite() {
@@ -113,7 +113,7 @@ class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness,
ViewHostMsg_FrameNavigate_Params params;
InitNavigateParams(&params, entry->page_id(), GURL(entry->url()),
PageTransition::TYPED);
- contents()->TestDidNavigate(contents_->pending_rvh(), params);
+ contents()->TestDidNavigate(contents()->pending_rvh(), params);
}
void ShowInterstitial(ResourceType::Type resource_type,
@@ -160,8 +160,8 @@ class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness,
resource->url = url;
resource->resource_type = resource_type;
resource->threat_type = SafeBrowsingService::URL_MALWARE;
- resource->render_process_host_id = contents_->GetRenderProcessHost()->id();
- resource->render_view_id = contents_->render_view_host()->routing_id();
+ resource->render_process_host_id = contents()->GetRenderProcessHost()->id();
+ resource->render_view_id = contents()->render_view_host()->routing_id();
}
UserResponse user_response_;
diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm
index 4067b5a..d772d5e 100644
--- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm
@@ -82,7 +82,7 @@ TEST_F(SadTabControllerTest, WithTabContents) {
}
TEST_F(SadTabControllerTest, WithoutTabContents) {
- contents_.reset();
+ DeleteContents();
scoped_nsobject<SadTabController> controller(CreateController());
EXPECT_TRUE(controller);
NSButton* link = GetLinkButton(controller);
diff --git a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
index 28aa5a4..8ae1173 100644
--- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
@@ -23,8 +23,12 @@ TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() {
return contents_wrapper_.get();
}
+void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) {
+ contents_wrapper_.reset(new TabContentsWrapper(contents));
+}
+
void TabContentsWrapperTestHarness::SetUp() {
- contents_wrapper_.reset(new TabContentsWrapper(CreateTestTabContents()));
+ SetContents(CreateTestTabContents());
}
void TabContentsWrapperTestHarness::TearDown() {
diff --git a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h
index bf15c88..7dc578c 100644
--- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h
+++ b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h
@@ -19,6 +19,8 @@ class TabContentsWrapperTestHarness : public RenderViewHostTestHarness {
virtual TestTabContents* contents() OVERRIDE;
TabContentsWrapper* contents_wrapper();
+ void SetContents(TestTabContents* contents);
+
protected:
// testing::Test
virtual void SetUp() OVERRIDE;