summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 07:38:17 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 07:38:17 +0000
commit93ab5934cb37e79ed6367237eca98cf2ff9d3320 (patch)
treeb355a6f82446d075a8c78d50161863873a06844c
parent9ab0ea353453e0f9a2e97132d86d415ea4192977 (diff)
downloadchromium_src-93ab5934cb37e79ed6367237eca98cf2ff9d3320.zip
chromium_src-93ab5934cb37e79ed6367237eca98cf2ff9d3320.tar.gz
chromium_src-93ab5934cb37e79ed6367237eca98cf2ff9d3320.tar.bz2
Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile
BUG=90443 TEST=everything still works Review URL: http://codereview.chromium.org/7892007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101037 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete_history_manager_unittest.cc6
-rw-r--r--chrome/browser/chromeos/offline/offline_load_page_unittest.cc6
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings_unittest.cc7
-rw-r--r--chrome/browser/extensions/extension_webnavigation_unittest.cc4
-rw-r--r--chrome/browser/favicon/favicon_handler_unittest.cc4
-rw-r--r--chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc19
-rw-r--r--chrome/browser/notifications/desktop_notification_service_unittest.cc8
-rw-r--r--chrome/browser/notifications/notification_exceptions_table_model_unittest.cc9
-rw-r--r--chrome/browser/password_manager/password_manager_unittest.cc14
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm8
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc14
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host_unittest.cc2
-rw-r--r--chrome/browser/safe_browsing/malware_details_unittest.cc16
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc6
-rw-r--r--chrome/browser/sessions/tab_restore_service_browsertest.cc8
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc21
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc8
-rw-r--r--chrome/browser/translate/translate_manager_browsertest.cc15
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm20
-rw-r--r--chrome/browser/ui/cocoa/tab_contents/sad_tab_controller_unittest.mm12
-rw-r--r--chrome/browser/ui/cocoa/tab_contents/web_drop_target_unittest.mm6
-rw-r--r--chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc20
-rw-r--r--chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc2
-rw-r--r--chrome/browser/ui/find_bar/find_backend_unittest.cc2
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller_unittest.cc10
-rw-r--r--chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc10
-rw-r--r--chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h4
-rw-r--r--chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc4
-rw-r--r--chrome/browser/ui/webui/sync_internals_ui_unittest.cc21
-rw-r--r--chrome/browser/ui/webui/web_ui_unittest.cc2
-rw-r--r--chrome/browser/visitedlink/visitedlink_unittest.cc25
-rw-r--r--chrome/browser/web_applications/web_app_unittest.cc18
-rw-r--r--chrome/chrome_tests.gypi12
-rw-r--r--chrome/test/base/chrome_render_view_host_test_harness.cc28
-rw-r--r--chrome/test/base/chrome_render_view_host_test_harness.h29
-rw-r--r--content/browser/browser_context.h2
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc23
-rw-r--r--content/browser/renderer_host/test_render_view_host.h16
-rw-r--r--content/browser/tab_contents/navigation_controller_unittest.cc4
-rw-r--r--content/browser/tab_contents/render_view_host_manager_unittest.cc32
-rw-r--r--content/content_tests.gypi10
41 files changed, 259 insertions, 228 deletions
diff --git a/chrome/browser/autocomplete_history_manager_unittest.cc b/chrome/browser/autocomplete_history_manager_unittest.cc
index 44ad316..540e5f0 100644
--- a/chrome/browser/autocomplete_history_manager_unittest.cc
+++ b/chrome/browser/autocomplete_history_manager_unittest.cc
@@ -10,9 +10,9 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete_history_manager.h"
#include "chrome/browser/webdata/web_data_service.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,14 +27,14 @@ class MockWebDataService : public WebDataService {
void(const std::vector<webkit_glue::FormField>&)); // NOLINT
};
-class AutocompleteHistoryManagerTest : public RenderViewHostTestHarness {
+class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness {
protected:
AutocompleteHistoryManagerTest()
: ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) {
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
web_data_service_ = new MockWebDataService();
autocomplete_manager_.reset(new AutocompleteHistoryManager(
contents(), &profile_, web_data_service_));
diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
index 2bca5c5..d6b8a98 100644
--- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
+++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/offline/offline_load_page.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/view_messages.h"
@@ -35,7 +35,7 @@ class TestOfflineLoadPage : public chromeos::OfflineLoadPage {
namespace chromeos {
-class OfflineLoadPageTest : public RenderViewHostTestHarness,
+class OfflineLoadPageTest : public ChromeRenderViewHostTestHarness,
public OfflineLoadPage::Delegate {
public:
// The decision the user made.
@@ -51,7 +51,7 @@ class OfflineLoadPageTest : public RenderViewHostTestHarness,
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
user_response_ = PENDING;
}
diff --git a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
index 2345ff6..fbfe67a 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
@@ -3,18 +3,17 @@
// found in the LICENSE file.
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "net/base/cookie_monster.h"
#include "testing/gtest/include/gtest/gtest.h"
-class TabSpecificContentSettingsTest : public RenderViewHostTestHarness {
+class TabSpecificContentSettingsTest : public ChromeRenderViewHostTestHarness {
public:
TabSpecificContentSettingsTest()
- : RenderViewHostTestHarness(),
- browser_thread_(BrowserThread::UI, &message_loop_) {}
+ : browser_thread_(BrowserThread::UI, &message_loop_) {}
private:
BrowserThread browser_thread_;
diff --git a/chrome/browser/extensions/extension_webnavigation_unittest.cc b/chrome/browser/extensions/extension_webnavigation_unittest.cc
index 0f9ba6c..fbcd2ce 100644
--- a/chrome/browser/extensions/extension_webnavigation_unittest.cc
+++ b/chrome/browser/extensions/extension_webnavigation_unittest.cc
@@ -7,13 +7,13 @@
#include "base/values.h"
#include "chrome/browser/extensions/extension_webnavigation_api.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
-class FrameNavigationStateTest : public RenderViewHostTestHarness {
+class FrameNavigationStateTest : public ChromeRenderViewHostTestHarness {
};
// Test that a frame is correctly tracked, and removed once the tab contents
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc
index 8759a23..91ef6f2 100644
--- a/chrome/browser/favicon/favicon_handler_unittest.cc
+++ b/chrome/browser/favicon/favicon_handler_unittest.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/favicon/favicon_handler.h"
#include "chrome/browser/profiles/profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "ui/gfx/codec/png_codec.h"
@@ -305,7 +305,7 @@ void HistoryRequestHandler::InvokeCallback() {
callback_->Run(0, favicon_data_);
}
-class FaviconHandlerTest : public RenderViewHostTestHarness {
+class FaviconHandlerTest : public ChromeRenderViewHostTestHarness {
};
TEST_F(FaviconHandlerTest, GetFaviconFromHistory) {
diff --git a/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc b/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc
index 0c47e65..1012b63 100644
--- a/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc
+++ b/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc
@@ -8,9 +8,9 @@
#include "chrome/browser/intents/web_intents_registry.h"
#include "chrome/browser/intents/web_intents_registry_factory.h"
#include "chrome/browser/intents/web_intent_data.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -34,29 +34,27 @@ MockWebIntentsRegistry* BuildForProfile(Profile* profile) {
}
class RegisterIntentHandlerInfoBarDelegateTest
- : public RenderViewHostTestHarness {
+ : public ChromeRenderViewHostTestHarness {
protected:
RegisterIntentHandlerInfoBarDelegateTest()
: ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) {}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
- profile_.reset(new TestingProfile);
- profile_->CreateWebDataService(false);
+ profile()->CreateWebDataService(false);
- SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
- tab_contents_.reset(new TestTabContents(profile_.get(), instance));
+ SiteInstance* instance = SiteInstance::CreateSiteInstance(profile());
+ tab_contents_.reset(new TestTabContents(profile(), instance));
- web_intents_registry_ = BuildForProfile(profile_.get());
+ web_intents_registry_ = BuildForProfile(profile());
}
virtual void TearDown() {
tab_contents_.reset();
web_intents_registry_ = NULL;
- profile_.reset();
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
scoped_ptr<TestTabContents> tab_contents_;
@@ -64,7 +62,6 @@ class RegisterIntentHandlerInfoBarDelegateTest
private:
BrowserThread ui_thread_;
- scoped_ptr<TestingProfile> profile_;
DISALLOW_COPY_AND_ASSIGN(RegisterIntentHandlerInfoBarDelegateTest);
};
diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc
index 84d1b06..e777dc3 100644
--- a/chrome/browser/notifications/desktop_notification_service_unittest.cc
+++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc
@@ -9,9 +9,9 @@
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresenter.h"
@@ -93,13 +93,13 @@ class ThreadProxy : public base::RefCountedThreadSafe<ThreadProxy> {
} // namespace
-class DesktopNotificationServiceTest : public RenderViewHostTestHarness {
+class DesktopNotificationServiceTest : public ChromeRenderViewHostTestHarness {
public:
DesktopNotificationServiceTest() {
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
proxy_ = new ThreadProxy;
proxy_->PauseIOThread();
@@ -111,7 +111,7 @@ class DesktopNotificationServiceTest : public RenderViewHostTestHarness {
// The io thread's waiting on the io_event_ might hold a ref to |proxy_|,
// preventing its destruction. Clear that ref.
proxy_->DrainIOThread();
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
DesktopNotificationService* service_;
diff --git a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
index 3650cbd..86dda43 100644
--- a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
+++ b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
@@ -6,14 +6,15 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
-class NotificationExceptionsTableModelTest : public RenderViewHostTestHarness {
+class NotificationExceptionsTableModelTest
+ : public ChromeRenderViewHostTestHarness {
public:
NotificationExceptionsTableModelTest()
: ui_thread_(BrowserThread::UI, MessageLoop::current()) {
@@ -23,14 +24,14 @@ class NotificationExceptionsTableModelTest : public RenderViewHostTestHarness {
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
service_ = DesktopNotificationServiceFactory::GetForProfile(profile());
ResetModel();
}
virtual void TearDown() {
model_.reset(NULL);
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
virtual void ResetModel() {
diff --git a/chrome/browser/password_manager/password_manager_unittest.cc b/chrome/browser/password_manager/password_manager_unittest.cc
index adf4e5c..57fa2a1 100644
--- a/chrome/browser/password_manager/password_manager_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_unittest.cc
@@ -11,9 +11,9 @@
#include "chrome/browser/password_manager/password_manager_delegate.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -78,19 +78,19 @@ ACTION_P(SaveToScopedPtr, scoped) {
scoped->reset(arg0);
}
-class PasswordManagerTest : public RenderViewHostTestHarness {
+class PasswordManagerTest : public ChromeRenderViewHostTestHarness {
public:
PasswordManagerTest()
: ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) {}
protected:
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
-
store_ = new MockPasswordStore();
- profile_.reset(new TestingProfileWithPasswordStore(store_));
+ browser_context_.reset(new TestingProfileWithPasswordStore(store_));
+ ChromeRenderViewHostTestHarness::SetUp();
+
EXPECT_CALL(delegate_, GetProfileForPasswordManager())
- .WillRepeatedly(Return(profile_.get()));
+ .WillRepeatedly(Return(profile()));
manager_.reset(new PasswordManager(contents(), &delegate_));
EXPECT_CALL(delegate_, DidLastPageLoadEncounterSSLErrors())
.WillRepeatedly(Return(false));
@@ -99,6 +99,7 @@ class PasswordManagerTest : public RenderViewHostTestHarness {
virtual void TearDown() {
manager_.reset();
store_ = NULL;
+ ChromeRenderViewHostTestHarness::TearDown();
}
PasswordForm MakeSimpleForm() {
@@ -119,7 +120,6 @@ class PasswordManagerTest : public RenderViewHostTestHarness {
// We create a UI thread to satisfy PasswordStore.
BrowserThread ui_thread_;
- scoped_ptr<Profile> profile_;
scoped_refptr<MockPasswordStore> store_;
MockPasswordManagerDelegate delegate_; // Owned by manager_.
scoped_ptr<PasswordManager> manager_;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm
index 58a0974..5ee505c5 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -6,18 +6,18 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/test/cocoa_test_event_utils.h"
#include "webkit/plugins/npapi/webplugin.h"
-class RenderWidgetHostViewMacTest : public RenderViewHostTestHarness {
+class RenderWidgetHostViewMacTest : public ChromeRenderViewHostTestHarness {
public:
RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
// TestRenderViewHost's destruction assumes that its view is a
// TestRenderWidgetHostView, so store its view and reset it back to the
@@ -38,7 +38,7 @@ class RenderWidgetHostViewMacTest : public RenderViewHostTestHarness {
MessageLoop::current()->RunAllPending();
pool_.Recycle();
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
protected:
// Adds an accelerated plugin view to |rwhv_cocoa_|. Returns a handle to the
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
index a1eb9c8..d0f6144 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
@@ -17,9 +17,9 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/browser_features.h"
#include "chrome/browser/safe_browsing/client_side_detection_service.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/page_transition_types.h"
@@ -43,15 +43,15 @@ class MockClientSideDetectionService : public ClientSideDetectionService {
};
} // namespace
-class BrowserFeatureExtractorTest : public RenderViewHostTestHarness {
+class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness {
protected:
BrowserFeatureExtractorTest()
: ui_thread_(BrowserThread::UI, &message_loop_) {
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
- profile_->CreateHistoryService(true /* delete_file */, false /* no_db */);
+ ChromeRenderViewHostTestHarness::SetUp();
+ profile()->CreateHistoryService(true /* delete_file */, false /* no_db */);
service_.reset(new StrictMock<MockClientSideDetectionService>());
extractor_.reset(new BrowserFeatureExtractor(contents(), service_.get()));
num_pending_ = 0;
@@ -60,13 +60,13 @@ class BrowserFeatureExtractorTest : public RenderViewHostTestHarness {
virtual void TearDown() {
extractor_.reset();
- profile_->DestroyHistoryService();
- RenderViewHostTestHarness::TearDown();
+ profile()->DestroyHistoryService();
+ ChromeRenderViewHostTestHarness::TearDown();
ASSERT_EQ(0, num_pending_);
}
HistoryService* history_service() {
- return profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ return profile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
}
// This is similar to NavigateAndCommit that is in test_tab_contents, but
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index d11e1bf..0cd4dee 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -151,7 +151,7 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
// This needs to happen before we call the parent SetUp() function. We use
// a nice mock because other parts of the code are calling IsOffTheRecord.
mock_profile_ = new NiceMock<MockTestingProfile>();
- profile_.reset(mock_profile_);
+ browser_context_.reset(mock_profile_);
ui_thread_.reset(new BrowserThread(BrowserThread::UI, &message_loop_));
// Note: we're starting a real IO thread to make sure our DCHECKs that
diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc
index cca0b05..d2fa55c 100644
--- a/chrome/browser/safe_browsing/malware_details_unittest.cc
+++ b/chrome/browser/safe_browsing/malware_details_unittest.cc
@@ -14,10 +14,10 @@
#include "chrome/browser/safe_browsing/report.pb.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/safe_browsing/safebrowsing_messages.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/test_url_request_context_getter.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "net/base/io_buffer.h"
@@ -164,7 +164,7 @@ class MockSafeBrowsingService : public SafeBrowsingService {
} // namespace.
-class MalwareDetailsTest : public RenderViewHostTestHarness {
+class MalwareDetailsTest : public ChromeRenderViewHostTestHarness {
public:
MalwareDetailsTest()
: ui_thread_(BrowserThread::UI, &message_loop_),
@@ -173,18 +173,18 @@ class MalwareDetailsTest : public RenderViewHostTestHarness {
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
// The URLFetcher checks that the messageloop type is IO.
ASSERT_TRUE(io_thread_.StartWithOptions(
base::Thread::Options(MessageLoop::TYPE_IO, 0)));
- profile_->CreateHistoryService(true /* delete_file */, false /* no_db */);
+ profile()->CreateHistoryService(true /* delete_file */, false /* no_db */);
}
virtual void TearDown() {
io_thread_.Stop();
- profile_->DestroyHistoryService();
- RenderViewHostTestHarness::TearDown();
+ profile()->DestroyHistoryService();
+ ChromeRenderViewHostTestHarness::TearDown();
}
static bool ResourceLessThan(
@@ -206,7 +206,7 @@ class MalwareDetailsTest : public RenderViewHostTestHarness {
}
HistoryService* history_service() {
- return profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ return profile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
}
protected:
@@ -642,7 +642,7 @@ TEST_F(MalwareDetailsTest, HistoryServiceUrls) {
redirects.push_back(GURL(kSecondRedirectURL));
AddPageToHistory(baseurl, &redirects);
// Wait for history service operation finished.
- profile_->BlockUntilHistoryProcessesPendingRequests();
+ profile()->BlockUntilHistoryProcessesPendingRequests();
controller().LoadURL(GURL(kLandingURL), GURL(), PageTransition::TYPED,
std::string());
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 be30a84..9cc67c5 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -8,8 +8,8 @@
#include "chrome/browser/safe_browsing/malware_details.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/view_messages.h"
@@ -67,7 +67,7 @@ class TestSafeBrowsingBlockingPageFactory
}
};
-class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness,
+class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness,
public SafeBrowsingService::Client {
public:
// The decision the user made.
@@ -85,7 +85,7 @@ class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness,
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
SafeBrowsingBlockingPage::RegisterFactory(&factory_);
ResetUserResponse();
}
diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc
index 979528d..4895fef5 100644
--- a/chrome/browser/sessions/tab_restore_service_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc
@@ -7,9 +7,9 @@
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/render_view_test.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
@@ -32,7 +32,7 @@ class TabRestoreTimeFactory : public TabRestoreService::TimeFactory {
base::Time time_;
};
-class TabRestoreServiceTest : public RenderViewHostTestHarness {
+class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
public:
TabRestoreServiceTest() {
url1_ = GURL("http://1");
@@ -46,7 +46,7 @@ class TabRestoreServiceTest : public RenderViewHostTestHarness {
protected:
// testing::Test overrides
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
time_factory_ = new TabRestoreTimeFactory();
service_.reset(new TabRestoreService(profile(), time_factory_));
WebKit::initialize(&webkit_platform_support_);
@@ -55,7 +55,7 @@ class TabRestoreServiceTest : public RenderViewHostTestHarness {
virtual void TearDown() {
service_.reset();
delete time_factory_;
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
WebKit::shutdown();
}
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index 613a18c..d55bbe4 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -11,12 +11,12 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_pref_service.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/constrained_window.h"
#include "content/browser/tab_contents/navigation_details.h"
@@ -169,22 +169,19 @@ class TestInterstitialPageStateGuard : public TestInterstitialPage::Delegate {
TestInterstitialPage* interstitial_page_;
};
-class TabContentsTest : public RenderViewHostTestHarness {
+class TabContentsTest : public ChromeRenderViewHostTestHarness {
public:
- TabContentsTest()
- : RenderViewHostTestHarness(),
- ui_thread_(BrowserThread::UI, &message_loop_) {
+ TabContentsTest() : ui_thread_(BrowserThread::UI, &message_loop_) {
}
private:
// Supply our own profile so we use the correct profile data. The test harness
// is not supposed to overwrite a profile if it's already created.
virtual void SetUp() {
- TestingProfile* profile = new TestingProfile();
- profile_.reset(profile);
+ ChromeRenderViewHostTestHarness::SetUp();
// Set some (WebKit) user preferences.
- TestingPrefService* pref_services = profile->GetTestingPrefService();
+ TestingPrefService* pref_services = profile()->GetTestingPrefService();
#if defined(TOOLKIT_USES_GTK)
pref_services->SetUserPref(prefs::kUsesSystemTheme,
Value::CreateBooleanValue(false));
@@ -199,14 +196,6 @@ class TabContentsTest : public RenderViewHostTestHarness {
Value::CreateBooleanValue(true));
pref_services->SetUserPref("webkit.webprefs.foo",
Value::CreateStringValue("bar"));
-
- RenderViewHostTestHarness::SetUp();
- }
-
- virtual void TearDown() {
- RenderViewHostTestHarness::TearDown();
-
- profile_.reset(NULL);
}
BrowserThread ui_thread_;
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 4b1f221..5d65899 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -25,9 +25,9 @@
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -147,11 +147,9 @@ class TabStripDummyDelegate : public TabStripModelDelegate {
DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate);
};
-class TabStripModelTest : public RenderViewHostTestHarness {
+class TabStripModelTest : public ChromeRenderViewHostTestHarness {
public:
- TabStripModelTest()
- : RenderViewHostTestHarness(),
- browser_thread_(BrowserThread::UI, &message_loop_) {
+ TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) {
}
TabContentsWrapper* CreateTabContents() {
diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc
index 102a022..03ff8e5 100644
--- a/chrome/browser/translate/translate_manager_browsertest.cc
+++ b/chrome/browser/translate/translate_manager_browsertest.cc
@@ -27,7 +27,6 @@
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/mock_render_process_host.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/notification_details.h"
@@ -154,13 +153,13 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness,
protected:
virtual void SetUp() {
// Access the TranslateManager singleton so it is created before we call
- // RenderViewHostTestHarness::SetUp() to match what's done in Chrome, where
- // the TranslateManager is created before the TabContents. This matters as
- // they both register for similar events and we want the notifications to
- // happen in the same sequence (TranslateManager first, TabContents second).
- // Also clears the translate script so it is fetched everytime and sets the
- // expiration delay to a large value by default (in case it was zeroed in
- // a previous test).
+ // TabContentsWrapperTestHarness::SetUp() to match what's done in Chrome,
+ // where the TranslateManager is created before the TabContents. This
+ // matters as they both register for similar events and we want the
+ // notifications to happen in the same sequence (TranslateManager first,
+ // TabContents second). Also clears the translate script so it is fetched
+ // everytime and sets the expiration delay to a large value by default (in
+ // case it was zeroed in a previous test).
TranslateManager::GetInstance()->ClearTranslateScript();
TranslateManager::GetInstance()->
set_translate_script_expiration_delay(60 * 60 * 1000);
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
index a58c9be..cb40b3b 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
@@ -10,8 +10,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#include "chrome/browser/ui/cocoa/notifications/balloon_controller.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
// Subclass balloon controller and mock out the initialization of the RVH.
@interface TestBalloonController : BalloonController {
@@ -45,7 +45,7 @@ class MockBalloonCollection : public BalloonCollection {
Balloons balloons_;
};
-class BalloonControllerTest : public RenderViewHostTestHarness {
+class BalloonControllerTest : public ChromeRenderViewHostTestHarness {
public:
BalloonControllerTest() :
ui_thread_(BrowserThread::UI, MessageLoop::current()),
@@ -53,23 +53,23 @@ class BalloonControllerTest : public RenderViewHostTestHarness {
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
CocoaTest::BootstrapCocoa();
- profile_.reset(new TestingProfile());
- profile_->CreateRequestContext();
- browser_.reset(new Browser(Browser::TYPE_TABBED, profile_.get()));
+ profile()->CreateRequestContext();
+ browser_.reset(new Browser(Browser::TYPE_TABBED, profile()));
collection_.reset(new MockBalloonCollection());
}
virtual void TearDown() {
+ collection_.reset();
+ browser_.reset();
MessageLoop::current()->RunAllPending();
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
protected:
BrowserThread ui_thread_;
BrowserThread io_thread_;
- scoped_ptr<TestingProfile> profile_;
scoped_ptr<Browser> browser_;
scoped_ptr<BalloonCollection> collection_;
};
@@ -79,7 +79,7 @@ TEST_F(BalloonControllerTest, ShowAndCloseTest) {
ASCIIToUTF16("http://www.google.com"), string16(),
new NotificationObjectProxy(-1, -1, -1, false));
scoped_ptr<Balloon> balloon(
- new Balloon(n, profile_.get(), collection_.get()));
+ new Balloon(n, profile(), collection_.get()));
balloon->SetPosition(gfx::Point(1, 1), false);
balloon->set_content_size(gfx::Size(100, 100));
@@ -95,7 +95,7 @@ TEST_F(BalloonControllerTest, SizesTest) {
ASCIIToUTF16("http://www.google.com"), string16(),
new NotificationObjectProxy(-1, -1, -1, false));
scoped_ptr<Balloon> balloon(
- new Balloon(n, profile_.get(), collection_.get()));
+ new Balloon(n, profile(), collection_.get()));
balloon->SetPosition(gfx::Point(1, 1), false);
balloon->set_content_size(gfx::Size(100, 100));
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 06d62f6..0ddf62f 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
@@ -8,8 +8,8 @@
#import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
#import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
#import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
@interface SadTabView (ExposedForTesting)
@@ -25,16 +25,16 @@
namespace {
-class SadTabControllerTest : public RenderViewHostTestHarness {
+class SadTabControllerTest : public ChromeRenderViewHostTestHarness {
public:
SadTabControllerTest() : test_window_(nil) {
link_clicked_ = false;
}
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
- // Inherting from RenderViewHostTestHarness means we can't inherit from
- // from CocoaTest, so do a bootstrap and create test window.
+ ChromeRenderViewHostTestHarness::SetUp();
+ // Inherting from ChromeRenderViewHostTestHarness means we can't inherit
+ // from from CocoaTest, so do a bootstrap and create test window.
CocoaTest::BootstrapCocoa();
test_window_ = [[CocoaTestHelperWindow alloc] init];
if (base::debug::BeingDebugged()) {
@@ -47,7 +47,7 @@ class SadTabControllerTest : public RenderViewHostTestHarness {
virtual void TearDown() {
[test_window_ close];
test_window_ = nil;
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
// Creates the controller and adds its view to contents, caller has ownership.
diff --git a/chrome/browser/ui/cocoa/tab_contents/web_drop_target_unittest.mm b/chrome/browser/ui/cocoa/tab_contents/web_drop_target_unittest.mm
index c2957dc..1d578de 100644
--- a/chrome/browser/ui/cocoa/tab_contents/web_drop_target_unittest.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/web_drop_target_unittest.mm
@@ -9,16 +9,16 @@
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#import "chrome/browser/ui/cocoa/drag_util.h"
#import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
#include "webkit/glue/webdropdata.h"
-class WebDropTargetTest : public RenderViewHostTestHarness {
+class WebDropTargetTest : public ChromeRenderViewHostTestHarness {
public:
virtual void SetUp() {
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
CocoaTest::BootstrapCocoa();
drop_target_.reset([[WebDropTarget alloc] initWithTabContents:contents()]);
}
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
index ef8faf7..67f9af9 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
@@ -27,7 +27,7 @@ class ContentSettingBubbleModelTest : public TabContentsWrapperTestHarness {
bool expect_reload_hint) {
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, contents_wrapper(), profile_.get(),
+ NULL, contents_wrapper(), profile(),
CONTENT_SETTINGS_TYPE_GEOLOCATION));
const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content();
@@ -52,7 +52,7 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, contents_wrapper(), profile_.get(),
+ NULL, contents_wrapper(), profile(),
CONTENT_SETTINGS_TYPE_IMAGES));
const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content();
@@ -71,7 +71,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) {
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, contents_wrapper(), profile_.get(),
+ NULL, contents_wrapper(), profile(),
CONTENT_SETTINGS_TYPE_COOKIES));
const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content();
@@ -90,7 +90,7 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) {
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, contents_wrapper(), profile_.get(),
+ NULL, contents_wrapper(), profile(),
CONTENT_SETTINGS_TYPE_PLUGINS));
const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content();
@@ -107,7 +107,7 @@ TEST_F(ContentSettingBubbleModelTest, MultiplePlugins) {
cmd->AppendSwitch(switches::kEnableResourceContentSettings);
cmd->AppendSwitch(switches::kEnableClickToPlay);
- HostContentSettingsMap* map = profile_->GetHostContentSettingsMap();
+ HostContentSettingsMap* map = profile()->GetHostContentSettingsMap();
std::string fooPlugin = "foo";
std::string barPlugin = "bar";
@@ -135,7 +135,7 @@ TEST_F(ContentSettingBubbleModelTest, MultiplePlugins) {
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, contents_wrapper(), profile_.get(),
+ NULL, contents_wrapper(), profile(),
CONTENT_SETTINGS_TYPE_PLUGINS));
const ContentSettingBubbleModel::BubbleContent& bubble_content =
content_setting_bubble_model->bubble_content();
@@ -184,7 +184,7 @@ TEST_F(ContentSettingBubbleModelTest, Geolocation) {
// Add it to the content map, should now have a clear link.
HostContentSettingsMap* setting_map =
- profile_->GetHostContentSettingsMap();
+ profile()->GetHostContentSettingsMap();
setting_map->SetContentSetting(
ContentSettingsPattern::FromURLNoWildcard(frame1_url),
ContentSettingsPattern::FromURLNoWildcard(page_url),
@@ -194,7 +194,7 @@ TEST_F(ContentSettingBubbleModelTest, Geolocation) {
CheckGeolocationBubble(1, true, false);
// Change the default to allow: no message needed.
- profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
+ profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW);
CheckGeolocationBubble(1, false, false);
@@ -203,7 +203,7 @@ TEST_F(ContentSettingBubbleModelTest, Geolocation) {
CheckGeolocationBubble(2, false, true);
// Change the default to block: offer a clear link for the persisted frame 1.
- profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
+ profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_BLOCK);
CheckGeolocationBubble(2, true, false);
}
@@ -213,7 +213,7 @@ TEST_F(ContentSettingBubbleModelTest, FileURL) {
NavigateAndCommit(GURL(file_url));
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, contents_wrapper(), profile_.get(),
+ NULL, contents_wrapper(), profile(),
CONTENT_SETTINGS_TYPE_IMAGES));
std::string title =
content_setting_bubble_model->bubble_content().radio_group.radio_items[0];
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
index 785ea44..e2c50a9 100644
--- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
@@ -49,7 +49,7 @@ TEST_F(ContentSettingImageModelTest, UpdateFromTabContents) {
TEST_F(ContentSettingImageModelTest, CookieAccessed) {
TabSpecificContentSettings* content_settings =
contents_wrapper()->content_settings();
- profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
+ profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
scoped_ptr<ContentSettingImageModel> content_setting_image_model(
ContentSettingImageModel::CreateContentSettingImageModel(
diff --git a/chrome/browser/ui/find_bar/find_backend_unittest.cc b/chrome/browser/ui/find_bar/find_backend_unittest.cc
index ba99a88..ad61231 100644
--- a/chrome/browser/ui/find_bar/find_backend_unittest.cc
+++ b/chrome/browser/ui/find_bar/find_backend_unittest.cc
@@ -42,7 +42,7 @@ TEST_F(FindBackendTest, InternalState) {
EXPECT_EQ(string16(), find_tab_helper->find_text());
// Get another TabContents object ready.
- TestTabContents* contents2 = new TestTabContents(profile_.get(), NULL);
+ TestTabContents* contents2 = new TestTabContents(profile(), NULL);
TabContentsWrapper wrapper2(contents2);
FindTabHelper* find_tab_helper2 = wrapper2.find_tab_helper();
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_unittest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_unittest.cc
index 407d709..958d409 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller_unittest.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller_unittest.cc
@@ -124,12 +124,12 @@ class WebIntentPickerControllerTest : public TabContentsWrapperTestHarness {
virtual void SetUp() {
TabContentsWrapperTestHarness::SetUp();
- profile_->CreateFaviconService();
- profile_->CreateWebDataService(true);
- web_data_service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
- favicon_service_ = profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
+ profile()->CreateFaviconService();
+ profile()->CreateWebDataService(true);
+ web_data_service_ = profile()->GetWebDataService(Profile::EXPLICIT_ACCESS);
+ favicon_service_ = profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
WebIntentsRegistry *registry =
- WebIntentsRegistryFactory::GetForProfile(profile_.get());
+ WebIntentsRegistryFactory::GetForProfile(profile());
registry->Initialize(web_data_service_);
picker_factory_ = new WebIntentPickerFactoryMock();
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 34f2985..26fcc08 100644
--- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc
@@ -9,7 +9,7 @@
#include "content/browser/tab_contents/test_tab_contents.h"
TabContentsWrapperTestHarness::TabContentsWrapperTestHarness()
- : RenderViewHostTestHarness() {
+ : ChromeRenderViewHostTestHarness() {
}
TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() {
@@ -29,6 +29,8 @@ void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) {
}
void TabContentsWrapperTestHarness::SetUp() {
+ if (!browser_context_.get())
+ browser_context_.reset(new TestingProfile());
SetContents(CreateTestTabContents());
}
@@ -36,10 +38,10 @@ void TabContentsWrapperTestHarness::TearDown() {
contents_wrapper_.reset();
// Make sure that we flush any messages related to TabContents destruction
- // before we destroy the profile.
+ // before we destroy the browser context.
MessageLoop::current()->RunAllPending();
- // Release the profile on the UI thread.
- message_loop_.DeleteSoon(FROM_HERE, profile_.release());
+ // Release the browser context on the UI thread.
+ message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
message_loop_.RunAllPending();
}
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 fa01a23..2c050ee 100644
--- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h
+++ b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h
@@ -7,11 +7,11 @@
#pragma once
#include "base/compiler_specific.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
class TabContentsWrapper;
-class TabContentsWrapperTestHarness : public RenderViewHostTestHarness {
+class TabContentsWrapperTestHarness : public ChromeRenderViewHostTestHarness {
public:
TabContentsWrapperTestHarness();
virtual ~TabContentsWrapperTestHarness();
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
index 568ce44..9267b50 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
@@ -11,9 +11,9 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/url_constants.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -52,7 +52,7 @@ class FaviconDelegate : public ui::MenuModelDelegate {
} // namespace
-class BackFwdMenuModelTest : public RenderViewHostTestHarness {
+class BackFwdMenuModelTest : public ChromeRenderViewHostTestHarness {
public:
BackFwdMenuModelTest()
: ui_thread_(BrowserThread::UI, &message_loop_) {
diff --git a/chrome/browser/ui/webui/sync_internals_ui_unittest.cc b/chrome/browser/ui/webui/sync_internals_ui_unittest.cc
index eefe4fb..0c66340 100644
--- a/chrome/browser/ui/webui/sync_internals_ui_unittest.cc
+++ b/chrome/browser/ui/webui/sync_internals_ui_unittest.cc
@@ -14,9 +14,9 @@
#include "chrome/browser/sync/js/js_event_details.h"
#include "chrome/browser/sync/js/js_test_util.h"
#include "chrome/browser/sync/profile_sync_service_mock.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/profile_mock.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -43,7 +43,7 @@ class TestSyncInternalsUI : public SyncInternalsUI {
};
// Tests with non-NULL ProfileSyncService.
-class SyncInternalsUITestWithService : public RenderViewHostTestHarness {
+class SyncInternalsUITestWithService : public ChromeRenderViewHostTestHarness {
protected:
SyncInternalsUITestWithService() {}
@@ -54,9 +54,9 @@ class SyncInternalsUITestWithService : public RenderViewHostTestHarness {
StrictMock<ProfileSyncServiceMock> profile_sync_service_mock;
EXPECT_CALL(*profile_mock, GetProfileSyncService())
.WillOnce(Return(&profile_sync_service_mock));
- profile_.reset(profile_mock);
+ browser_context_.reset(profile_mock);
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
EXPECT_CALL(profile_sync_service_mock, GetJsController())
.WillOnce(Return(mock_js_controller_.AsWeakPtr()));
@@ -65,7 +65,7 @@ class SyncInternalsUITestWithService : public RenderViewHostTestHarness {
{
// Needed by |test_sync_internals_ui_|'s constructor. The
- // message loop is provided by RenderViewHostTestHarness.
+ // message loop is provided by ChromeRenderViewHostTestHarness.
BrowserThread ui_thread_(BrowserThread::UI,
MessageLoopForUI::current());
// |test_sync_internals_ui_|'s constructor triggers all the
@@ -85,7 +85,7 @@ class SyncInternalsUITestWithService : public RenderViewHostTestHarness {
RemoveJsEventHandler(test_sync_internals_ui_.get()));
test_sync_internals_ui_.reset();
- RenderViewHostTestHarness::TearDown();
+ ChromeRenderViewHostTestHarness::TearDown();
}
StrictMock<browser_sync::MockJsController> mock_js_controller_;
@@ -124,7 +124,8 @@ TEST_F(SyncInternalsUITestWithService, OnWebUISendBasic) {
}
// Tests with NULL ProfileSyncService.
-class SyncInternalsUITestWithoutService : public RenderViewHostTestHarness {
+class SyncInternalsUITestWithoutService
+ : public ChromeRenderViewHostTestHarness {
protected:
SyncInternalsUITestWithoutService() {}
@@ -134,13 +135,13 @@ class SyncInternalsUITestWithoutService : public RenderViewHostTestHarness {
NiceMock<ProfileMock>* profile_mock = new NiceMock<ProfileMock>();
EXPECT_CALL(*profile_mock, GetProfileSyncService())
.WillOnce(Return(static_cast<ProfileSyncService*>(NULL)));
- profile_.reset(profile_mock);
+ browser_context_.reset(profile_mock);
- RenderViewHostTestHarness::SetUp();
+ ChromeRenderViewHostTestHarness::SetUp();
{
// Needed by |test_sync_internals_ui_|'s constructor. The
- // message loop is provided by RenderViewHostTestHarness.
+ // message loop is provided by ChromeRenderViewHostTestHarness.
BrowserThread ui_thread_(BrowserThread::UI,
MessageLoopForUI::current());
// |test_sync_internals_ui_|'s constructor triggers all the
diff --git a/chrome/browser/ui/webui/web_ui_unittest.cc b/chrome/browser/ui/webui/web_ui_unittest.cc
index 30e0b63..ee231e1 100644
--- a/chrome/browser/ui/webui/web_ui_unittest.cc
+++ b/chrome/browser/ui/webui/web_ui_unittest.cc
@@ -95,7 +95,7 @@ TEST_F(WebUITest, WebUIToStandard) {
// slightly different than the very-first-navigation case since the
// SiteInstance will be the same (the original TabContents must still be
// alive), which will trigger different behavior in RenderViewHostManager.
- TestTabContents* contents2 = new TestTabContents(profile_.get(), NULL);
+ TestTabContents* contents2 = new TestTabContents(profile(), NULL);
TabContentsWrapper wrapper2(contents2);
DoNavigationTest(&wrapper2, 101);
diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc
index 3d5d59e..720b90b 100644
--- a/chrome/browser/visitedlink/visitedlink_unittest.cc
+++ b/chrome/browser/visitedlink/visitedlink_unittest.cc
@@ -16,10 +16,10 @@
#include "chrome/browser/visitedlink/visitedlink_event_listener.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/visitedlink_slave.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/browser_render_process_host.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/common/notification_service.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -563,28 +563,23 @@ class VisitedLinkRenderProcessHostFactory
DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory);
};
-class VisitedLinkEventsTest : public RenderViewHostTestHarness {
+class VisitedLinkEventsTest : public ChromeRenderViewHostTestHarness {
public:
VisitedLinkEventsTest()
- : RenderViewHostTestHarness(),
- ui_thread_(BrowserThread::UI, &message_loop_),
+ : ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_) {}
- ~VisitedLinkEventsTest() {
- // This ends up using the file thread to schedule the delete.
- profile_.reset();
- message_loop_.RunAllPending();
- }
+ virtual ~VisitedLinkEventsTest() {}
virtual void SetFactoryMode() {}
virtual void SetUp() {
SetFactoryMode();
event_listener_.reset(new VisitedLinkEventListener());
rvh_factory_.set_render_process_host_factory(&vc_rph_factory_);
- profile_.reset(new VisitCountingProfile(event_listener_.get()));
- RenderViewHostTestHarness::SetUp();
+ browser_context_.reset(new VisitCountingProfile(event_listener_.get()));
+ ChromeRenderViewHostTestHarness::SetUp();
}
VisitCountingProfile* profile() const {
- return static_cast<VisitCountingProfile*>(profile_.get());
+ return static_cast<VisitCountingProfile*>(browser_context_.get());
}
void WaitForCoalescense() {
@@ -607,7 +602,7 @@ class VisitedLinkEventsTest : public RenderViewHostTestHarness {
TEST_F(VisitedLinkEventsTest, Coalescense) {
// add some URLs to master.
- VisitedLinkMaster* master = profile_->GetVisitedLinkMaster();
+ VisitedLinkMaster* master = profile()->GetVisitedLinkMaster();
// Add a few URLs.
master->AddURL(GURL("http://acidtests.org/"));
master->AddURL(GURL("http://google.com/"));
@@ -659,7 +654,7 @@ TEST_F(VisitedLinkEventsTest, Coalescense) {
}
TEST_F(VisitedLinkEventsTest, Basics) {
- VisitedLinkMaster* master = profile_->GetVisitedLinkMaster();
+ VisitedLinkMaster* master = profile()->GetVisitedLinkMaster();
rvh()->CreateRenderView(string16());
// Add a few URLs.
@@ -683,7 +678,7 @@ TEST_F(VisitedLinkEventsTest, Basics) {
}
TEST_F(VisitedLinkEventsTest, TabVisibility) {
- VisitedLinkMaster* master = profile_->GetVisitedLinkMaster();
+ VisitedLinkMaster* master = profile()->GetVisitedLinkMaster();
rvh()->CreateRenderView(string16());
// Simulate tab becoming inactive.
diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc
index cff6853..8219e69 100644
--- a/chrome/browser/web_applications/web_app_unittest.cc
+++ b/chrome/browser/web_applications/web_app_unittest.cc
@@ -16,26 +16,10 @@
class WebApplicationTest : public TabContentsWrapperTestHarness {
public:
- WebApplicationTest()
- : TabContentsWrapperTestHarness(),
- ui_thread_(BrowserThread::UI, &message_loop_) {
+ WebApplicationTest() : ui_thread_(BrowserThread::UI, &message_loop_) {
}
private:
- // Supply our own profile so we use the correct profile data. The test harness
- // is not supposed to overwrite a profile if it's already created.
- virtual void SetUp() {
- profile_.reset(new TestingProfile());
-
- TabContentsWrapperTestHarness::SetUp();
- }
-
- virtual void TearDown() {
- TabContentsWrapperTestHarness::TearDown();
-
- profile_.reset(NULL);
- }
-
BrowserThread ui_thread_;
};
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 49e6e18..d525b53 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -154,6 +154,8 @@
'test/base/chrome_process_util.cc',
'test/base/chrome_process_util.h',
'test/base/chrome_process_util_mac.cc',
+ 'test/base/chrome_render_view_host_test_harness.cc',
+ 'test/base/chrome_render_view_host_test_harness.h',
'test/base/chrome_test_suite.cc',
'test/base/chrome_test_suite.h',
'test/base/in_process_browser_test.cc',
@@ -198,15 +200,7 @@
# production code code in libbrowser (in chrome.gyp).
#'../content/browser/net/url_request_mock_http_job.cc',
#'../content/browser/net/url_request_mock_http_job.h',
- '../content/browser/renderer_host/mock_render_process_host.cc',
- '../content/browser/renderer_host/mock_render_process_host.h',
- '../content/browser/renderer_host/test_backing_store.cc',
- '../content/browser/renderer_host/test_backing_store.h',
- '../content/browser/renderer_host/test_render_view_host.cc',
- '../content/browser/renderer_host/test_render_view_host.h',
'../content/browser/ssl/ssl_client_auth_handler_mock.h',
- '../content/browser/tab_contents/test_tab_contents.cc',
- '../content/browser/tab_contents/test_tab_contents.h',
'../content/common/notification_observer_mock.cc',
'../content/common/notification_observer_mock.h',
'../ui/gfx/image/image_unittest_util.h',
@@ -1830,10 +1824,8 @@
'tools/convert_dict/convert_dict_unittest.cc',
'../content/browser/debugger/devtools_manager_unittest.cc',
'../content/browser/download/download_file_unittest.cc',
- '../content/browser/download/save_package_unittest.cc',
'../content/browser/in_process_webkit/dom_storage_unittest.cc',
'../content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc',
- '../content/browser/renderer_host/render_view_host_unittest.cc',
'../content/browser/renderer_host/render_widget_host_unittest.cc',
'../content/browser/renderer_host/text_input_client_mac_unittest.mm',
'../content/browser/site_instance_unittest.cc',
diff --git a/chrome/test/base/chrome_render_view_host_test_harness.cc b/chrome/test/base/chrome_render_view_host_test_harness.cc
new file mode 100644
index 0000000..d75bb8d
--- /dev/null
+++ b/chrome/test/base/chrome_render_view_host_test_harness.cc
@@ -0,0 +1,28 @@
+// 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.
+
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
+
+#include "chrome/test/base/testing_profile.h"
+
+ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness()
+ : RenderViewHostTestHarness() {
+}
+
+ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() {
+}
+
+TestingProfile* ChromeRenderViewHostTestHarness::profile() {
+ return static_cast<TestingProfile*>(browser_context_.get());
+}
+
+void ChromeRenderViewHostTestHarness::SetUp() {
+ if (!browser_context_.get())
+ browser_context_.reset(new TestingProfile());
+ RenderViewHostTestHarness::SetUp();
+}
+
+void ChromeRenderViewHostTestHarness::TearDown() {
+ RenderViewHostTestHarness::TearDown();
+}
diff --git a/chrome/test/base/chrome_render_view_host_test_harness.h b/chrome/test/base/chrome_render_view_host_test_harness.h
new file mode 100644
index 0000000..a51bf04
--- /dev/null
+++ b/chrome/test/base/chrome_render_view_host_test_harness.h
@@ -0,0 +1,29 @@
+// 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.
+
+#ifndef CHROME_TEST_BASE_CHROME_RENDER_VIEW_HOST_TEST_HARNESS_H_
+#define CHROME_TEST_BASE_CHROME_RENDER_VIEW_HOST_TEST_HARNESS_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "content/browser/renderer_host/test_render_view_host.h"
+
+class TestingProfile;
+
+// Wrapper around RenderViewHostTestHarness that uses a TestingProfile as
+// browser context instead of a TestBrowserContext.
+class ChromeRenderViewHostTestHarness : public RenderViewHostTestHarness {
+ public:
+ ChromeRenderViewHostTestHarness();
+ virtual ~ChromeRenderViewHostTestHarness();
+
+ TestingProfile* profile();
+
+ protected:
+ // testing::Test
+ virtual void SetUp() OVERRIDE;
+ virtual void TearDown() OVERRIDE;
+};
+
+#endif // CHROME_TEST_BASE_CHROME_RENDER_VIEW_HOST_TEST_HARNESS_H_
diff --git a/content/browser/browser_context.h b/content/browser/browser_context.h
index 15125ca..feda556 100644
--- a/content/browser/browser_context.h
+++ b/content/browser/browser_context.h
@@ -41,6 +41,8 @@ class ResourceContext;
// It lives on the UI thread.
class BrowserContext {
public:
+ virtual ~BrowserContext() {};
+
// Returns the path of the directory where this context's data is stored.
virtual FilePath GetPath() = 0;
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index 1ddb875..9303f86 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_url_handler.h"
#include "content/browser/renderer_host/test_backing_store.h"
#include "content/browser/renderer_host/test_render_view_host.h"
@@ -12,6 +11,7 @@
#include "content/common/content_client.h"
#include "content/common/dom_storage_common.h"
#include "content/common/view_messages.h"
+#include "content/test/test_browser_context.h"
#include "ui/gfx/rect.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
@@ -307,8 +307,8 @@ TestRenderViewHost* RenderViewHostTestHarness::active_rvh() {
return pending_rvh() ? pending_rvh() : rvh();
}
-TestingProfile* RenderViewHostTestHarness::profile() {
- return profile_.get();
+content::BrowserContext* RenderViewHostTestHarness::browser_context() {
+ return browser_context_.get();
}
MockRenderProcessHost* RenderViewHostTestHarness::process() {
@@ -326,14 +326,15 @@ void RenderViewHostTestHarness::SetContents(TestTabContents* contents) {
}
TestTabContents* RenderViewHostTestHarness::CreateTestTabContents() {
- // See comment above profile_ decl for why we check for NULL here.
- if (!profile_.get())
- profile_.reset(new TestingProfile());
+ // See comment above browser_context_ decl for why we check for NULL here.
+ if (!browser_context_.get())
+ browser_context_.reset(new TestBrowserContext());
// This will be deleted when the TabContents goes away.
- SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
+ SiteInstance* instance =
+ SiteInstance::CreateSiteInstance(browser_context_.get());
- return new TestTabContents(profile_.get(), instance);
+ return new TestTabContents(browser_context_.get(), instance);
}
void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) {
@@ -355,10 +356,10 @@ void RenderViewHostTestHarness::TearDown() {
SetContents(NULL);
// Make sure that we flush any messages related to TabContents destruction
- // before we destroy the profile.
+ // before we destroy the browser context.
MessageLoop::current()->RunAllPending();
- // Release the profile on the UI thread.
- message_loop_.DeleteSoon(FROM_HERE, profile_.release());
+ // Release the browser context on the UI thread.
+ message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
message_loop_.RunAllPending();
}
diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h
index 8761a93..8c66291 100644
--- a/content/browser/renderer_host/test_render_view_host.h
+++ b/content/browser/renderer_host/test_render_view_host.h
@@ -17,13 +17,16 @@
#include "content/common/page_transition_types.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace content {
+class BrowserContext;
+}
+
namespace gfx {
class Rect;
}
class NavigationController;
class SiteInstance;
-class TestingProfile;
class TestTabContents;
struct WebMenuItem;
struct ViewHostMsg_FrameNavigate_Params;
@@ -292,7 +295,7 @@ class RenderViewHostTestHarness : public testing::Test {
TestRenderViewHost* rvh();
TestRenderViewHost* pending_rvh();
TestRenderViewHost* active_rvh();
- TestingProfile* profile();
+ content::BrowserContext* browser_context();
MockRenderProcessHost* process();
// Frees the current tab contents for tests that want to test destruction.
@@ -317,10 +320,11 @@ class RenderViewHostTestHarness : public testing::Test {
virtual void SetUp();
virtual void TearDown();
- // This profile will be created in SetUp if it has not already been created.
- // This allows tests to override the profile if they so choose in their own
- // SetUp function before calling the base class's (us) SetUp().
- scoped_ptr<TestingProfile> profile_;
+ // This browser context will be created in SetUp if it has not already been
+ // created. This allows tests to override the browser context if they so
+ // choose in their own SetUp function before calling the base class's (us)
+ // SetUp().
+ scoped_ptr<content::BrowserContext> browser_context_;
MessageLoopForUI message_loop_;
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc
index 5d6d953..88ad37b 100644
--- a/content/browser/tab_contents/navigation_controller_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc
@@ -16,8 +16,8 @@
// #include "chrome/browser/sessions/session_service_factory.h"
// #include "chrome/browser/sessions/session_service_test_helper.h"
// #include "chrome/browser/sessions/session_types.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_details.h"
@@ -36,7 +36,7 @@ using base::Time;
// NavigationControllerTest ----------------------------------------------------
-class NavigationControllerTest : public RenderViewHostTestHarness {
+class NavigationControllerTest : public ChromeRenderViewHostTestHarness {
public:
NavigationControllerTest() {}
};
diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc
index b9ed739..4b07ea18 100644
--- a/content/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "content/browser/browser_url_handler.h"
-#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
@@ -20,7 +20,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webkit_glue.h"
-class RenderViewHostManagerTest : public RenderViewHostTestHarness {
+class RenderViewHostManagerTest : public ChromeRenderViewHostTestHarness {
public:
void NavigateActiveAndCommit(const GURL& url) {
// Note: we navigate the active RenderViewHost because previous navigations
@@ -67,7 +67,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) {
NavigateActiveAndCommit(kDestUrl);
// Make a second tab.
- TestTabContents contents2(profile_.get(), NULL);
+ TestTabContents contents2(profile(), NULL);
// Load the two URLs in the second tab. Note that the first navigation creates
// a RVH that's not pending (since there is no cross-site transition), so
@@ -167,13 +167,13 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) {
// Tests the Init function by checking the initial RenderViewHost.
TEST_F(RenderViewHostManagerTest, Init) {
// Using TestingProfile.
- SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
+ SiteInstance* instance = SiteInstance::CreateSiteInstance(profile());
EXPECT_FALSE(instance->has_site());
- TestTabContents tab_contents(profile_.get(), instance);
+ TestTabContents tab_contents(profile(), instance);
RenderViewHostManager manager(&tab_contents, &tab_contents);
- manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
+ manager.Init(profile(), instance, MSG_ROUTING_NONE);
RenderViewHost* host = manager.current_host();
ASSERT_TRUE(host);
@@ -188,16 +188,16 @@ TEST_F(RenderViewHostManagerTest, Init) {
TEST_F(RenderViewHostManagerTest, Navigate) {
TestNotificationTracker notifications;
- SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
+ SiteInstance* instance = SiteInstance::CreateSiteInstance(profile());
- TestTabContents tab_contents(profile_.get(), instance);
+ TestTabContents tab_contents(profile(), instance);
notifications.ListenFor(content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(&tab_contents.controller()));
// Create.
RenderViewHostManager manager(&tab_contents, &tab_contents);
- manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
+ manager.Init(profile(), instance, MSG_ROUTING_NONE);
RenderViewHost* host;
@@ -266,12 +266,12 @@ TEST_F(RenderViewHostManagerTest, Navigate) {
// Tests WebUI creation.
TEST_F(RenderViewHostManagerTest, WebUI) {
BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current());
- SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
+ SiteInstance* instance = SiteInstance::CreateSiteInstance(profile());
- TestTabContents tab_contents(profile_.get(), instance);
+ TestTabContents tab_contents(profile(), instance);
RenderViewHostManager manager(&tab_contents, &tab_contents);
- manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
+ manager.Init(profile(), instance, MSG_ROUTING_NONE);
const GURL kUrl(chrome::kTestNewTabURL);
NavigationEntry entry(NULL /* instance */, -1 /* page_id */, kUrl,
@@ -305,10 +305,10 @@ TEST_F(RenderViewHostManagerTest, WebUI) {
// Regression test for bug 46290.
TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) {
BrowserThread thread(BrowserThread::UI, &message_loop_);
- SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
- TestTabContents tab_contents(profile_.get(), instance);
+ SiteInstance* instance = SiteInstance::CreateSiteInstance(profile());
+ TestTabContents tab_contents(profile(), instance);
RenderViewHostManager manager(&tab_contents, &tab_contents);
- manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
+ manager.Init(profile(), instance, MSG_ROUTING_NONE);
// NTP is a Web UI page.
const GURL kNtpUrl(chrome::kTestNewTabURL);
@@ -321,7 +321,7 @@ TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) {
// Rewrite so it looks like chrome://about/memory
bool reverse_on_redirect = false;
BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
- &about_url, profile_.get(), &reverse_on_redirect);
+ &about_url, profile(), &reverse_on_redirect);
NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url,
GURL() /* referrer */, string16() /* title */,
PageTransition::TYPED);
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index fb1f4e0..c8bdd38 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -34,6 +34,14 @@
'browser/renderer_host/dummy_resource_handler.h',
'browser/renderer_host/media/mock_media_observer.cc',
'browser/renderer_host/media/mock_media_observer.h',
+ 'browser/renderer_host/test_backing_store.cc',
+ 'browser/renderer_host/test_backing_store.h',
+ 'browser/renderer_host/test_render_view_host.cc',
+ 'browser/renderer_host/test_render_view_host.h',
+ 'browser/renderer_host/mock_render_process_host.cc',
+ 'browser/renderer_host/mock_render_process_host.h',
+ 'browser/tab_contents/test_tab_contents.cc',
+ 'browser/tab_contents/test_tab_contents.h',
'common/test_url_constants.cc',
'common/test_url_constants.h',
'gpu/gpu_idirect3d9_mock_win.cc',
@@ -93,6 +101,7 @@
'browser/device_orientation/provider_unittest.cc',
'browser/download/base_file_unittest.cc',
'browser/download/download_status_updater_unittest.cc',
+ 'browser/download/save_package_unittest.cc',
'browser/geolocation/device_data_provider_unittest.cc',
'browser/geolocation/geolocation_provider_unittest.cc',
'browser/geolocation/gps_location_provider_unittest_linux.cc',
@@ -113,6 +122,7 @@
'browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc',
'browser/renderer_host/media/video_capture_host_unittest.cc',
'browser/renderer_host/media/video_capture_manager_unittest.cc',
+ 'browser/renderer_host/render_view_host_unittest.cc',
'browser/renderer_host/resource_dispatcher_host_unittest.cc',
'browser/renderer_host/resource_queue_unittest.cc',
'browser/resolve_proxy_msg_helper_unittest.cc',