summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-07 17:55:50 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-07 17:55:50 +0000
commitfadc607b6dd990f37f88be954ee8593ba3cc6a38 (patch)
treee256676526459af214e2be3c12d5fd2b3533f504 /chrome
parent20532328921c20eeb6c49a8921bca8b044d73791 (diff)
downloadchromium_src-fadc607b6dd990f37f88be954ee8593ba3cc6a38.zip
chromium_src-fadc607b6dd990f37f88be954ee8593ba3cc6a38.tar.gz
chromium_src-fadc607b6dd990f37f88be954ee8593ba3cc6a38.tar.bz2
Clean up warnings found in our testing code.
Time wise, this only speeds things up by a minute, which I think is within the margin of error. I can't get a good size measurement since we aren't building .a files for a lot of this code. BUG=none TEST=compiles Review URL: http://codereview.chromium.org/6312137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/prefs/testing_pref_store.cc26
-rw-r--r--chrome/browser/prefs/testing_pref_store.h14
-rw-r--r--chrome/browser/sync/js_test_util.cc16
-rw-r--r--chrome/browser/sync/js_test_util.h12
-rw-r--r--chrome/browser/tab_contents/test_tab_contents.h7
-rw-r--r--chrome/chrome_tests.gypi12
-rw-r--r--chrome/test/in_process_browser_test.cc4
-rw-r--r--chrome/test/in_process_browser_test.h4
-rw-r--r--chrome/test/testing_profile.cc242
-rw-r--r--chrome/test/testing_profile.h167
-rw-r--r--chrome/test/ui/ui_test.cc4
-rw-r--r--chrome/test/ui/ui_test.h4
-rw-r--r--chrome/test/ui_test_utils.cc20
-rw-r--r--chrome/test/ui_test_utils.h22
14 files changed, 408 insertions, 146 deletions
diff --git a/chrome/browser/prefs/testing_pref_store.cc b/chrome/browser/prefs/testing_pref_store.cc
index 39c20f2..89394bd 100644
--- a/chrome/browser/prefs/testing_pref_store.cc
+++ b/chrome/browser/prefs/testing_pref_store.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.
@@ -9,7 +9,9 @@
TestingPrefStore::TestingPrefStore()
: read_only_(true),
prefs_written_(false),
- init_complete_(false) { }
+ init_complete_(false) {}
+
+TestingPrefStore::~TestingPrefStore() {}
PrefStore::ReadResult TestingPrefStore::GetValue(const std::string& key,
Value** value) const {
@@ -24,6 +26,10 @@ void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) {
observers_.RemoveObserver(observer);
}
+bool TestingPrefStore::IsInitializationComplete() const {
+ return init_complete_;
+}
+
void TestingPrefStore::SetValue(const std::string& key, Value* value) {
if (prefs_.SetValue(key, value))
NotifyPrefValueChanged(key);
@@ -38,6 +44,10 @@ void TestingPrefStore::RemoveValue(const std::string& key) {
NotifyPrefValueChanged(key);
}
+bool TestingPrefStore::ReadOnly() const {
+ return read_only_;
+}
+
PersistentPrefStore::PrefReadError TestingPrefStore::ReadPrefs() {
prefs_.Clear();
return PersistentPrefStore::PREF_READ_ERROR_NONE;
@@ -98,3 +108,15 @@ bool TestingPrefStore::GetBoolean(const std::string& key, bool* value) const {
return stored_value->GetAsBoolean(value);
}
+
+void TestingPrefStore::set_read_only(bool read_only) {
+ read_only_ = read_only;
+}
+
+void TestingPrefStore::set_prefs_written(bool status) {
+ prefs_written_ = status;
+}
+
+bool TestingPrefStore::get_prefs_written() {
+ return prefs_written_;
+}
diff --git a/chrome/browser/prefs/testing_pref_store.h b/chrome/browser/prefs/testing_pref_store.h
index 555ee69..5502ad2 100644
--- a/chrome/browser/prefs/testing_pref_store.h
+++ b/chrome/browser/prefs/testing_pref_store.h
@@ -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.
@@ -20,19 +20,19 @@ class DictionaryValue;
class TestingPrefStore : public PersistentPrefStore {
public:
TestingPrefStore();
- virtual ~TestingPrefStore() {}
+ virtual ~TestingPrefStore();
// Overriden from PrefStore.
virtual ReadResult GetValue(const std::string& key, Value** result) const;
virtual void AddObserver(PrefStore::Observer* observer);
virtual void RemoveObserver(PrefStore::Observer* observer);
- virtual bool IsInitializationComplete() const { return init_complete_; }
+ virtual bool IsInitializationComplete() const;
// PersistentPrefStore overrides:
virtual void SetValue(const std::string& key, Value* value);
virtual void SetValueSilently(const std::string& key, Value* value);
virtual void RemoveValue(const std::string& key);
- virtual bool ReadOnly() const { return read_only_; }
+ virtual bool ReadOnly() const;
virtual PersistentPrefStore::PrefReadError ReadPrefs();
virtual bool WritePrefs();
virtual void ScheduleWritePrefs() {}
@@ -55,9 +55,9 @@ class TestingPrefStore : public PersistentPrefStore {
// Getter and Setter methods for setting and getting the state of the
// |TestingPrefStore|.
- virtual void set_read_only(bool read_only) { read_only_ = read_only; }
- virtual void set_prefs_written(bool status) { prefs_written_ = status; }
- virtual bool get_prefs_written() { return prefs_written_; }
+ virtual void set_read_only(bool read_only);
+ virtual void set_prefs_written(bool status);
+ virtual bool get_prefs_written();
private:
// Stores the preference values.
diff --git a/chrome/browser/sync/js_test_util.cc b/chrome/browser/sync/js_test_util.cc
index 3c736c7..bd4f9c0 100644
--- a/chrome/browser/sync/js_test_util.cc
+++ b/chrome/browser/sync/js_test_util.cc
@@ -56,5 +56,21 @@ class HasArgsMatcher
return HasArgs(JsArgList(expected_args));
}
+MockJsBackend::MockJsBackend() {}
+
+MockJsBackend::~MockJsBackend() {}
+
+MockJsFrontend::MockJsFrontend() {}
+
+MockJsFrontend::~MockJsFrontend() {}
+
+MockJsEventHandler::MockJsEventHandler() {}
+
+MockJsEventHandler::~MockJsEventHandler() {}
+
+MockJsEventRouter::MockJsEventRouter() {}
+
+MockJsEventRouter::~MockJsEventRouter() {}
+
} // namespace browser_sync
diff --git a/chrome/browser/sync/js_test_util.h b/chrome/browser/sync/js_test_util.h
index 71badb3..23a8dad 100644
--- a/chrome/browser/sync/js_test_util.h
+++ b/chrome/browser/sync/js_test_util.h
@@ -37,6 +37,9 @@ void PrintTo(const JsArgList& args, ::std::ostream* os);
class MockJsBackend : public JsBackend {
public:
+ MockJsBackend();
+ ~MockJsBackend();
+
MOCK_METHOD1(SetParentJsEventRouter, void(JsEventRouter*));
MOCK_METHOD0(RemoveParentJsEventRouter, void());
MOCK_CONST_METHOD0(GetParentJsEventRouter, const JsEventRouter*());
@@ -46,6 +49,9 @@ class MockJsBackend : public JsBackend {
class MockJsFrontend : public JsFrontend {
public:
+ MockJsFrontend();
+ ~MockJsFrontend();
+
MOCK_METHOD1(AddHandler, void(JsEventHandler*));
MOCK_METHOD1(RemoveHandler, void(JsEventHandler*));
MOCK_METHOD3(ProcessMessage,
@@ -55,11 +61,17 @@ class MockJsFrontend : public JsFrontend {
class MockJsEventHandler : public JsEventHandler {
public:
+ MockJsEventHandler();
+ ~MockJsEventHandler();
+
MOCK_METHOD2(HandleJsEvent, void(const ::std::string&, const JsArgList&));
};
class MockJsEventRouter : public JsEventRouter {
public:
+ MockJsEventRouter();
+ ~MockJsEventRouter();
+
MOCK_METHOD3(RouteJsEvent,
void(const ::std::string&, const JsArgList&,
const JsEventHandler*));
diff --git a/chrome/browser/tab_contents/test_tab_contents.h b/chrome/browser/tab_contents/test_tab_contents.h
index 21bc096..729730b 100644
--- a/chrome/browser/tab_contents/test_tab_contents.h
+++ b/chrome/browser/tab_contents/test_tab_contents.h
@@ -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.
@@ -50,8 +50,9 @@ class TestTabContents : public TabContents {
}
// Prevent interaction with views.
- bool CreateRenderViewForRenderManager(RenderViewHost* render_view_host);
- void UpdateRenderViewSizeForRenderManager() {}
+ virtual bool CreateRenderViewForRenderManager(
+ RenderViewHost* render_view_host);
+ virtual void UpdateRenderViewSizeForRenderManager() {}
// Returns a clone of this TestTabContents. The returned object is also a
// TestTabContents. The caller owns the returned object.
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index fb8b576..c2eea8b 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -127,6 +127,8 @@
'test/chrome_process_util.cc',
'test/chrome_process_util.h',
'test/chrome_process_util_mac.cc',
+ 'test/in_process_browser_test.cc',
+ 'test/in_process_browser_test.h',
'test/model_test_utils.cc',
'test/model_test_utils.h',
'test/profile_mock.cc',
@@ -364,8 +366,6 @@
'browser/ui/views/bookmark_bar_view_test.cc',
'browser/ui/views/find_bar_host_interactive_uitest.cc',
'browser/ui/views/tabs/tab_dragging_test.cc',
- 'test/in_process_browser_test.cc',
- 'test/in_process_browser_test.h',
'test/interactive_ui/fast_shutdown_interactive_uitest.cc',
'test/interactive_ui/infobars_uitest.cc',
'test/interactive_ui/keyboard_access_uitest.cc',
@@ -2218,8 +2218,6 @@
'renderer/translate_helper_browsertest.cc',
'test/automation/dom_automation_browsertest.cc',
'test/gpu/gpu_browsertest.cc',
- 'test/in_process_browser_test.cc',
- 'test/in_process_browser_test.h',
'test/out_of_proc_test_runner.cc',
'test/render_view_test.cc',
'test/render_view_test.h',
@@ -2398,8 +2396,6 @@
'sources': [
'app/chrome_dll.rc',
'browser/safe_browsing/safe_browsing_test.cc',
- 'test/in_process_browser_test.cc',
- 'test/in_process_browser_test.h',
'test/out_of_proc_test_runner.cc',
],
'conditions': [
@@ -2918,8 +2914,6 @@
'browser/sessions/session_service_test_helper.cc',
'browser/sync/glue/session_model_associator.cc',
'test/bookmark_load_observer.h',
- 'test/in_process_browser_test.cc',
- 'test/in_process_browser_test.h',
'test/out_of_proc_test_runner.cc',
'test/live_sync/bookmark_model_verifier.cc',
'test/live_sync/bookmark_model_verifier.h',
@@ -3067,8 +3061,6 @@
'defines': [ 'ALLOW_IN_PROC_BROWSER_TEST' ],
'sources': [
'test/gpu/gpu_pixel_browsertest.cc',
- 'test/in_process_browser_test.cc',
- 'test/in_process_browser_test.h',
'test/out_of_proc_test_runner.cc',
],
'conditions': [
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 3b8c6df..06bfe14 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -265,6 +265,10 @@ void InProcessBrowserTest::AddTabAtIndex(
AddTabAtIndexToBrowser(browser(), index, url, transition);
}
+bool InProcessBrowserTest::SetUpUserDataDirectory() {
+ return true;
+}
+
// Creates a browser with a single tab (about:blank), waits for the tab to
// finish loading and shows the browser.
Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
diff --git a/chrome/test/in_process_browser_test.h b/chrome/test/in_process_browser_test.h
index 169ad47..ad82890 100644
--- a/chrome/test/in_process_browser_test.h
+++ b/chrome/test/in_process_browser_test.h
@@ -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.
@@ -114,7 +114,7 @@ class InProcessBrowserTest : public testing::Test {
// If a test wishes to set up some initial non-empty state in the user data
// directory before the browser starts up, it can do so here. Returns true if
// successful.
- virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT { return true; }
+ virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT;
// We need these special methods because InProcessBrowserTest::SetUp is the
// bottom of the stack that winds up calling your test method, so it is not
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 00af1d1..e7102df 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -360,22 +360,110 @@ TestingPrefService* TestingProfile::GetTestingPrefService() {
return testing_prefs_;
}
+ProfileId TestingProfile::GetRuntimeId() {
+ return reinterpret_cast<ProfileId>(this);
+ }
+
+bool TestingProfile::IsOffTheRecord() {
+ return off_the_record_;
+}
+
+Profile* TestingProfile::GetOffTheRecordProfile() {
+ return NULL;
+}
+
+bool TestingProfile::HasOffTheRecordProfile() {
+ return false;
+}
+
+Profile* TestingProfile::GetOriginalProfile() {
+ return this;
+}
+
+ChromeAppCacheService* TestingProfile::GetAppCacheService() {
+ return NULL;
+}
+
webkit_database::DatabaseTracker* TestingProfile::GetDatabaseTracker() {
if (!db_tracker_)
db_tracker_ = new webkit_database::DatabaseTracker(GetPath(), false);
return db_tracker_;
}
+VisitedLinkMaster* TestingProfile::GetVisitedLinkMaster() {
+ return NULL;
+}
+
ExtensionService* TestingProfile::GetExtensionService() {
return extensions_service_.get();
}
+UserScriptMaster* TestingProfile::GetUserScriptMaster() {
+ return NULL;
+}
+
+ExtensionDevToolsManager* TestingProfile::GetExtensionDevToolsManager() {
+ return NULL;
+}
+
+ExtensionProcessManager* TestingProfile::GetExtensionProcessManager() {
+ return NULL;
+}
+
+ExtensionMessageService* TestingProfile::GetExtensionMessageService() {
+ return NULL;
+}
+
+ExtensionEventRouter* TestingProfile::GetExtensionEventRouter() {
+ return NULL;
+}
+
+ExtensionIOEventRouter* TestingProfile::GetExtensionIOEventRouter() {
+ return NULL;
+}
+
+SSLHostState* TestingProfile::GetSSLHostState() {
+ return NULL;
+}
+
+net::TransportSecurityState* TestingProfile::GetTransportSecurityState() {
+ return NULL;
+}
+
+FaviconService* TestingProfile::GetFaviconService(ServiceAccessType access) {
+ return favicon_service_.get();
+}
+
+HistoryService* TestingProfile::GetHistoryService(ServiceAccessType access) {
+ return history_service_.get();
+}
+
+HistoryService* TestingProfile::GetHistoryServiceWithoutCreating() {
+ return history_service_.get();
+}
+
net::CookieMonster* TestingProfile::GetCookieMonster() {
if (!GetRequestContext())
return NULL;
return GetRequestContext()->GetCookieStore()->GetCookieMonster();
}
+AutocompleteClassifier* TestingProfile::GetAutocompleteClassifier() {
+ return autocomplete_classifier_.get();
+}
+
+WebDataService* TestingProfile::GetWebDataService(ServiceAccessType access) {
+ return web_data_service_.get();
+}
+
+WebDataService* TestingProfile::GetWebDataServiceWithoutCreating() {
+ return web_data_service_.get();
+}
+
+PasswordStore* TestingProfile::GetPasswordStore(ServiceAccessType access) {
+ return NULL;
+}
+
void TestingProfile::InitThemes() {
if (!created_theme_provider_) {
#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
@@ -388,6 +476,15 @@ void TestingProfile::InitThemes() {
}
}
+const Extension* TestingProfile::GetTheme() {
+ return NULL;
+}
+
+BrowserThemeProvider* TestingProfile::GetThemeProvider() {
+ InitThemes();
+ return theme_provider_.get();
+}
+
void TestingProfile::SetPrefService(PrefService* prefs) {
DCHECK(!prefs_.get());
prefs_.reset(prefs);
@@ -408,10 +505,42 @@ PrefService* TestingProfile::GetPrefs() {
return prefs_.get();
}
+TemplateURLModel* TestingProfile::GetTemplateURLModel() {
+ return template_url_model_.get();
+}
+
+TemplateURLFetcher* TestingProfile::GetTemplateURLFetcher() {
+ return template_url_fetcher_.get();
+}
+
history::TopSites* TestingProfile::GetTopSites() {
return top_sites_.get();
}
+history::TopSites* TestingProfile::GetTopSitesWithoutCreating() {
+ return top_sites_.get();
+}
+
+DownloadManager* TestingProfile::GetDownloadManager() {
+ return NULL;
+}
+
+PersonalDataManager* TestingProfile::GetPersonalDataManager() {
+ return NULL;
+}
+
+fileapi::SandboxedFileSystemContext* TestingProfile::GetFileSystemContext() {
+ return NULL;
+}
+
+BrowserSignin* TestingProfile::GetBrowserSignin() {
+ return NULL;
+}
+
+bool TestingProfile::HasCreatedDownloadManager() const {
+ return false;
+}
+
URLRequestContextGetter* TestingProfile::GetRequestContext() {
return request_context_.get();
}
@@ -425,12 +554,24 @@ void TestingProfile::ResetRequestContext() {
request_context_ = NULL;
}
+URLRequestContextGetter* TestingProfile::GetRequestContextForMedia() {
+ return NULL;
+}
+
URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() {
if (!extensions_request_context_)
extensions_request_context_ = new TestExtensionURLRequestContextGetter();
return extensions_request_context_.get();
}
+net::SSLConfigService* TestingProfile::GetSSLConfigService() {
+ return NULL;
+}
+
+UserStyleSheetWatcher* TestingProfile::GetUserStyleSheetWatcher() {
+ return NULL;
+}
+
FindBarState* TestingProfile::GetFindBarState() {
if (!find_bar_state_.get())
find_bar_state_.reset(new FindBarState());
@@ -461,6 +602,58 @@ TestingProfile::GetGeolocationPermissionContext() {
return geolocation_permission_context_.get();
}
+HostZoomMap* TestingProfile::GetHostZoomMap() {
+ return NULL;
+}
+
+SessionService* TestingProfile::GetSessionService() {
+ return session_service_.get();
+}
+
+bool TestingProfile::HasSessionService() const {
+ return (session_service_.get() != NULL);
+}
+
+bool TestingProfile::HasProfileSyncService() const {
+ return (profile_sync_service_.get() != NULL);
+}
+
+std::wstring TestingProfile::GetName() {
+ return std::wstring();
+}
+
+std::wstring TestingProfile::GetID() {
+ return id_;
+}
+
+void TestingProfile::SetID(const std::wstring& id) {
+ id_ = id;
+}
+
+bool TestingProfile::DidLastSessionExitCleanly() {
+ return last_session_exited_cleanly_;
+}
+
+BookmarkModel* TestingProfile::GetBookmarkModel() {
+ return bookmark_bar_model_.get();
+}
+
+bool TestingProfile::IsSameProfile(Profile *p) {
+ return this == p;
+}
+
+base::Time TestingProfile::GetStartTime() const {
+ return start_time_;
+}
+
+TabRestoreService* TestingProfile::GetTabRestoreService() {
+ return NULL;
+}
+
+SpellCheckHost* TestingProfile::GetSpellCheckHost() {
+ return NULL;
+}
+
void TestingProfile::set_session_service(SessionService* session_service) {
session_service_ = session_service;
}
@@ -471,6 +664,10 @@ WebKitContext* TestingProfile::GetWebKitContext() {
return webkit_context_;
}
+WebKitContext* TestingProfile::GetOffTheRecordWebKitContext() {
+ return NULL;
+}
+
NTPResourceCache* TestingProfile::GetNTPResourceCache() {
if (!ntp_resource_cache_.get())
ntp_resource_cache_.reset(new NTPResourceCache(this));
@@ -486,6 +683,23 @@ DesktopNotificationService* TestingProfile::GetDesktopNotificationService() {
return desktop_notification_service_.get();
}
+BackgroundContentsService*
+TestingProfile::GetBackgroundContentsService() const {
+ return NULL;
+}
+
+StatusTray* TestingProfile::GetStatusTray() {
+ return NULL;
+}
+
+FilePath TestingProfile::last_selected_directory() {
+ return last_selected_directory_;
+}
+
+void TestingProfile::set_last_selected_directory(const FilePath& path) {
+ last_selected_directory_ = path;
+}
+
PrefProxyConfigTracker* TestingProfile::GetProxyConfigTracker() {
if (!pref_proxy_config_tracker_)
pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs());
@@ -525,6 +739,34 @@ ProfileSyncService* TestingProfile::GetProfileSyncService(
return profile_sync_service_.get();
}
+CloudPrintProxyService* TestingProfile::GetCloudPrintProxyService() {
+ return NULL;
+}
+
+ChromeBlobStorageContext* TestingProfile::GetBlobStorageContext() {
+ return NULL;
+}
+
+ExtensionInfoMap* TestingProfile::GetExtensionInfoMap() {
+ return NULL;
+}
+
+PromoCounter* TestingProfile::GetInstantPromoCounter() {
+ return NULL;
+}
+
+policy::ProfilePolicyContext* TestingProfile::GetPolicyContext() {
+ return NULL;
+}
+
+PrerenderManager* TestingProfile::GetPrerenderManager() {
+ return NULL;
+}
+
+PrefService* TestingProfile::GetOffTheRecordPrefs() {
+ return NULL;
+}
+
void TestingProfile::DestroyWebDataService() {
if (!web_data_service_.get())
return;
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index fc561d4..ee16eb6 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -121,9 +121,7 @@ class TestingProfile : public Profile {
TestingPrefService* GetTestingPrefService();
- virtual ProfileId GetRuntimeId() {
- return reinterpret_cast<ProfileId>(this);
- }
+ virtual ProfileId GetRuntimeId();
virtual FilePath GetPath();
@@ -131,39 +129,29 @@ class TestingProfile : public Profile {
void set_off_the_record(bool off_the_record) {
off_the_record_ = off_the_record;
}
- virtual bool IsOffTheRecord() { return off_the_record_; }
- virtual Profile* GetOffTheRecordProfile() { return NULL; }
+ virtual bool IsOffTheRecord();
+ virtual Profile* GetOffTheRecordProfile();
virtual void DestroyOffTheRecordProfile() {}
- virtual bool HasOffTheRecordProfile() { return false; }
+ virtual bool HasOffTheRecordProfile();
- virtual Profile* GetOriginalProfile() { return this; }
- virtual ChromeAppCacheService* GetAppCacheService() { return NULL; }
+ virtual Profile* GetOriginalProfile();
+ virtual ChromeAppCacheService* GetAppCacheService();
virtual webkit_database::DatabaseTracker* GetDatabaseTracker();
- virtual VisitedLinkMaster* GetVisitedLinkMaster() { return NULL; }
+ virtual VisitedLinkMaster* GetVisitedLinkMaster();
virtual ExtensionService* GetExtensionService();
- virtual UserScriptMaster* GetUserScriptMaster() { return NULL; }
- virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() {
- return NULL;
- }
- virtual ExtensionProcessManager* GetExtensionProcessManager() { return NULL; }
- virtual ExtensionMessageService* GetExtensionMessageService() { return NULL; }
- virtual ExtensionEventRouter* GetExtensionEventRouter() { return NULL; }
- virtual ExtensionIOEventRouter* GetExtensionIOEventRouter() { return NULL; }
- virtual SSLHostState* GetSSLHostState() { return NULL; }
- virtual net::TransportSecurityState* GetTransportSecurityState() {
- return NULL;
- }
- virtual FaviconService* GetFaviconService(ServiceAccessType access) {
- return favicon_service_.get();
- }
- virtual HistoryService* GetHistoryService(ServiceAccessType access) {
- return history_service_.get();
- }
- virtual HistoryService* GetHistoryServiceWithoutCreating() {
- return history_service_.get();
- }
+ virtual UserScriptMaster* GetUserScriptMaster();
+ virtual ExtensionDevToolsManager* GetExtensionDevToolsManager();
+ virtual ExtensionProcessManager* GetExtensionProcessManager();
+ virtual ExtensionMessageService* GetExtensionMessageService();
+ virtual ExtensionEventRouter* GetExtensionEventRouter();
+ virtual ExtensionIOEventRouter* GetExtensionIOEventRouter();
+ virtual SSLHostState* GetSSLHostState();
+ virtual net::TransportSecurityState* GetTransportSecurityState();
+ virtual FaviconService* GetFaviconService(ServiceAccessType access);
+ virtual HistoryService* GetHistoryService(ServiceAccessType access);
+ virtual HistoryService* GetHistoryServiceWithoutCreating();
void set_has_history_service(bool has_history_service) {
has_history_service_ = has_history_service;
}
@@ -171,50 +159,31 @@ class TestingProfile : public Profile {
// this by calling CreateRequestContext(). See the note at GetRequestContext
// for more information.
net::CookieMonster* GetCookieMonster();
- virtual AutocompleteClassifier* GetAutocompleteClassifier() {
- return autocomplete_classifier_.get();
- }
- virtual WebDataService* GetWebDataService(ServiceAccessType access) {
- return web_data_service_.get();
- }
- virtual WebDataService* GetWebDataServiceWithoutCreating() {
- return web_data_service_.get();
- }
- virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
- return NULL;
- }
+ virtual AutocompleteClassifier* GetAutocompleteClassifier();
+ virtual WebDataService* GetWebDataService(ServiceAccessType access);
+ virtual WebDataService* GetWebDataServiceWithoutCreating();
+ virtual PasswordStore* GetPasswordStore(ServiceAccessType access);
// Sets the profile's PrefService. If a pref service hasn't been explicitly
// set GetPrefs creates one, so normally you need not invoke this. If you need
// to set a pref service you must invoke this before GetPrefs.
// TestingPrefService takes ownership of |prefs|.
void SetPrefService(PrefService* prefs);
virtual PrefService* GetPrefs();
- virtual TemplateURLModel* GetTemplateURLModel() {
- return template_url_model_.get();
- }
- virtual TemplateURLFetcher* GetTemplateURLFetcher() {
- return template_url_fetcher_.get();
- }
+ virtual TemplateURLModel* GetTemplateURLModel();
+ virtual TemplateURLFetcher* GetTemplateURLFetcher();
virtual history::TopSites* GetTopSites();
- virtual history::TopSites* GetTopSitesWithoutCreating() {
- return top_sites_.get();
- }
- virtual DownloadManager* GetDownloadManager() { return NULL; }
- virtual PersonalDataManager* GetPersonalDataManager() { return NULL; }
- virtual fileapi::SandboxedFileSystemContext* GetFileSystemContext() {
- return NULL;
- }
- virtual BrowserSignin* GetBrowserSignin() { return NULL; }
- virtual bool HasCreatedDownloadManager() const { return false; }
+ virtual history::TopSites* GetTopSitesWithoutCreating();
+ virtual DownloadManager* GetDownloadManager();
+ virtual PersonalDataManager* GetPersonalDataManager();
+ virtual fileapi::SandboxedFileSystemContext* GetFileSystemContext();
+ virtual BrowserSignin* GetBrowserSignin();
+ virtual bool HasCreatedDownloadManager() const;
virtual void InitThemes();
virtual void SetTheme(const Extension* extension) {}
virtual void SetNativeTheme() {}
virtual void ClearTheme() {}
- virtual const Extension* GetTheme() { return NULL; }
- virtual BrowserThemeProvider* GetThemeProvider() {
- InitThemes();
- return theme_provider_.get();
- }
+ virtual const Extension* GetTheme();
+ virtual BrowserThemeProvider* GetThemeProvider();
// Returns a testing ContextGetter (if one has been created via
// CreateRequestContext) or NULL. This is not done on-demand for two reasons:
@@ -230,68 +199,52 @@ class TestingProfile : public Profile {
// down the IO thread to avoid leaks).
void ResetRequestContext();
- virtual URLRequestContextGetter* GetRequestContextForMedia() { return NULL; }
+ virtual URLRequestContextGetter* GetRequestContextForMedia();
virtual URLRequestContextGetter* GetRequestContextForExtensions();
- virtual net::SSLConfigService* GetSSLConfigService() { return NULL; }
- virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() { return NULL; }
+ virtual net::SSLConfigService* GetSSLConfigService();
+ virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher();
virtual FindBarState* GetFindBarState();
virtual HostContentSettingsMap* GetHostContentSettingsMap();
virtual GeolocationContentSettingsMap* GetGeolocationContentSettingsMap();
virtual GeolocationPermissionContext* GetGeolocationPermissionContext();
- virtual HostZoomMap* GetHostZoomMap() { return NULL; }
+ virtual HostZoomMap* GetHostZoomMap();
void set_session_service(SessionService* session_service);
- virtual SessionService* GetSessionService() { return session_service_.get(); }
+ virtual SessionService* GetSessionService();
virtual void ShutdownSessionService() {}
- virtual bool HasSessionService() const {
- return (session_service_.get() != NULL);
- }
- virtual bool HasProfileSyncService() const {
- return (profile_sync_service_.get() != NULL);
- }
- virtual std::wstring GetName() { return std::wstring(); }
+ virtual bool HasSessionService() const;
+ virtual bool HasProfileSyncService() const;
+ virtual std::wstring GetName();
virtual void SetName(const std::wstring& name) {}
- virtual std::wstring GetID() { return id_; }
- virtual void SetID(const std::wstring& id) { id_ = id; }
+ virtual std::wstring GetID();
+ virtual void SetID(const std::wstring& id);
void set_last_session_exited_cleanly(bool value) {
last_session_exited_cleanly_ = value;
}
- virtual bool DidLastSessionExitCleanly() {
- return last_session_exited_cleanly_;
- }
+ virtual bool DidLastSessionExitCleanly();
virtual void MergeResourceString(int message_id,
std::wstring* output_string) {}
virtual void MergeResourceInteger(int message_id, int* output_value) {}
virtual void MergeResourceBoolean(int message_id, bool* output_value) {}
- virtual BookmarkModel* GetBookmarkModel() {
- return bookmark_bar_model_.get();
- }
- virtual bool IsSameProfile(Profile *p) { return this == p; }
- virtual base::Time GetStartTime() const { return start_time_; }
- virtual TabRestoreService* GetTabRestoreService() { return NULL; }
+ virtual BookmarkModel* GetBookmarkModel();
+ virtual bool IsSameProfile(Profile *p);
+ virtual base::Time GetStartTime() const;
+ virtual TabRestoreService* GetTabRestoreService();
virtual void ResetTabRestoreService() {}
- virtual SpellCheckHost* GetSpellCheckHost() { return NULL; }
+ virtual SpellCheckHost* GetSpellCheckHost();
virtual void ReinitializeSpellCheckHost(bool force) { }
virtual WebKitContext* GetWebKitContext();
- virtual WebKitContext* GetOffTheRecordWebKitContext() { return NULL; }
+ virtual WebKitContext* GetOffTheRecordWebKitContext();
virtual void MarkAsCleanShutdown() {}
virtual void InitExtensions() {}
virtual void InitWebResources() {}
virtual NTPResourceCache* GetNTPResourceCache();
virtual DesktopNotificationService* GetDesktopNotificationService();
- virtual BackgroundContentsService* GetBackgroundContentsService() const {
- return NULL;
- }
- virtual StatusTray* GetStatusTray() {
- return NULL;
- }
- virtual FilePath last_selected_directory() {
- return last_selected_directory_;
- }
- virtual void set_last_selected_directory(const FilePath& path) {
- last_selected_directory_ = path;
- }
+ virtual BackgroundContentsService* GetBackgroundContentsService() const;
+ virtual StatusTray* GetStatusTray();
+ virtual FilePath last_selected_directory();
+ virtual void set_last_selected_directory(const FilePath& path);
#if defined(OS_CHROMEOS)
virtual chromeos::ProxyConfigServiceImpl*
GetChromeOSProxyConfigServiceImpl() {
@@ -315,13 +268,13 @@ class TestingProfile : public Profile {
virtual ProfileSyncService* GetProfileSyncService();
virtual ProfileSyncService* GetProfileSyncService(
const std::string& cros_notes);
- virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; }
- virtual ChromeBlobStorageContext* GetBlobStorageContext() { return NULL; }
- virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; }
- virtual PromoCounter* GetInstantPromoCounter() { return NULL; }
- virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; }
- virtual PrerenderManager* GetPrerenderManager() { return NULL; }
- virtual PrefService* GetOffTheRecordPrefs() { return NULL; }
+ virtual CloudPrintProxyService* GetCloudPrintProxyService();
+ virtual ChromeBlobStorageContext* GetBlobStorageContext();
+ virtual ExtensionInfoMap* GetExtensionInfoMap();
+ virtual PromoCounter* GetInstantPromoCounter();
+ virtual policy::ProfilePolicyContext* GetPolicyContext();
+ virtual PrerenderManager* GetPrerenderManager();
+ virtual PrefService* GetOffTheRecordPrefs();
protected:
base::Time start_time_;
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 7161942..2424006 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -169,6 +169,10 @@ ProxyLauncher* UITestBase::CreateProxyLauncher() {
return new AnonymousProxyLauncher(false);
}
+bool UITestBase::ShouldFilterInet() {
+ return true;
+}
+
void UITestBase::SetLaunchSwitches() {
// We need cookies on file:// for things like the page cycler.
if (enable_file_cookies_)
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 989f760..5901a87 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -284,9 +284,7 @@ class UITestBase {
return state;
}
- virtual bool ShouldFilterInet() {
- return true;
- }
+ virtual bool ShouldFilterInet();
// Extra command-line switches that need to be passed to the browser are
// added in this function. Add new command-line switches here.
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 873bfe1..436273b 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.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.
@@ -873,6 +873,20 @@ TestWebSocketServer::~TestWebSocketServer() {
base::LaunchApp(*cmd_line.get(), true, false, NULL);
}
+TestNotificationObserver::TestNotificationObserver()
+ : source_(NotificationService::AllSources()) {
+}
+
+TestNotificationObserver::~TestNotificationObserver() {}
+
+void TestNotificationObserver::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ source_ = source;
+ details_ = details;
+ MessageLoopForUI::current()->Quit();
+}
+
WindowedNotificationObserver::WindowedNotificationObserver(
NotificationType notification_type,
const NotificationSource& source)
@@ -882,6 +896,8 @@ WindowedNotificationObserver::WindowedNotificationObserver(
registrar_.Add(this, notification_type, waiting_for_);
}
+WindowedNotificationObserver::~WindowedNotificationObserver() {}
+
void WindowedNotificationObserver::Wait() {
if (waiting_for_ == NotificationService::AllSources()) {
LOG(FATAL) << "Wait called when monitoring all sources. You must use "
@@ -926,6 +942,8 @@ DOMMessageQueue::DOMMessageQueue() {
NotificationService::AllSources());
}
+DOMMessageQueue::~DOMMessageQueue() {}
+
void DOMMessageQueue::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h
index 97fe557..dc00afa 100644
--- a/chrome/test/ui_test_utils.h
+++ b/chrome/test/ui_test_utils.h
@@ -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.
@@ -358,16 +358,8 @@ class TestWebSocketServer {
// is received. It also records the source and details of the notification.
class TestNotificationObserver : public NotificationObserver {
public:
- TestNotificationObserver() : source_(NotificationService::AllSources()) {
- }
-
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- source_ = source;
- details_ = details;
- MessageLoopForUI::current()->Quit();
- }
+ TestNotificationObserver();
+ virtual ~TestNotificationObserver();
const NotificationSource& source() const {
return source_;
@@ -377,6 +369,11 @@ class TestNotificationObserver : public NotificationObserver {
return details_;
}
+ // NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
NotificationSource source_;
NotificationDetails details_;
@@ -401,6 +398,7 @@ class WindowedNotificationObserver : public NotificationObserver {
* NotificationService::AllSources(). */
WindowedNotificationObserver(NotificationType notification_type,
const NotificationSource& source);
+ virtual ~WindowedNotificationObserver();
/* Wait until the specified notification occurs. You must have specified a
* source in the arguments to the constructor in order to use this function.
@@ -425,6 +423,7 @@ class WindowedNotificationObserver : public NotificationObserver {
*/
void WaitFor(const NotificationSource& source);
+ // NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -529,6 +528,7 @@ class DOMMessageQueue : public NotificationObserver {
// DOMAutomationController. Do not construct this until the browser has
// started.
DOMMessageQueue();
+ virtual ~DOMMessageQueue();
// Wait for the next message to arrive. |message| will be set to the next
// message, if not null. Returns true on success.