diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 21:30:50 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 21:30:50 +0000 |
commit | b6ce91bbe84f6009d6549c8041c33dc1fd94f4ad (patch) | |
tree | 8518833f158525d88d7486a3d983faf432f902eb /chrome | |
parent | 082223051a90ca04363453fbef0f33a05a8c1a8f (diff) | |
download | chromium_src-b6ce91bbe84f6009d6549c8041c33dc1fd94f4ad.zip chromium_src-b6ce91bbe84f6009d6549c8041c33dc1fd94f4ad.tar.gz chromium_src-b6ce91bbe84f6009d6549c8041c33dc1fd94f4ad.tar.bz2 |
Even more test cleanup.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6471013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74484 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
24 files changed, 295 insertions, 143 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 164d084..366530d 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -331,6 +331,8 @@ TabAppendedNotificationObserver::TabAppendedNotificationObserver( reply_message_(reply_message) { } +TabAppendedNotificationObserver::~TabAppendedNotificationObserver() {} + void TabAppendedNotificationObserver::ObserveTab( NavigationController* controller) { if (!automation_) @@ -357,6 +359,8 @@ TabClosedNotificationObserver::TabClosedNotificationObserver( for_browser_command_(false) { } +TabClosedNotificationObserver::~TabClosedNotificationObserver() {} + void TabClosedNotificationObserver::ObserveTab( NavigationController* controller) { if (!automation_) @@ -686,6 +690,8 @@ BrowserClosedNotificationObserver::BrowserClosedNotificationObserver( Source<Browser>(browser)); } +BrowserClosedNotificationObserver::~BrowserClosedNotificationObserver() {} + void BrowserClosedNotificationObserver::Observe( NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -727,6 +733,9 @@ BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver( NotificationService::AllSources()); } +BrowserCountChangeNotificationObserver:: +~BrowserCountChangeNotificationObserver() {} + void BrowserCountChangeNotificationObserver::Observe( NotificationType type, const NotificationSource& source, @@ -969,6 +978,8 @@ DomOperationObserver::DomOperationObserver() { NotificationService::AllSources()); } +DomOperationObserver::~DomOperationObserver() {} + void DomOperationObserver::Observe( NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -983,6 +994,8 @@ DomOperationMessageSender::DomOperationMessageSender( : automation_(automation->AsWeakPtr()) { } +DomOperationMessageSender::~DomOperationMessageSender() {} + void DomOperationMessageSender::OnDomOperationCompleted( const std::string& json) { if (!automation_) @@ -1118,6 +1131,8 @@ TabLanguageDeterminedObserver::TabLanguageDeterminedObserver( Source<TabContents>(tab_contents)); } +TabLanguageDeterminedObserver::~TabLanguageDeterminedObserver() {} + void TabLanguageDeterminedObserver::Observe( NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -1181,6 +1196,8 @@ InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, CheckCount(); } +InfoBarCountObserver::~InfoBarCountObserver() {} + void InfoBarCountObserver::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -1300,6 +1317,9 @@ AutomationProviderDownloadItemObserver::AutomationProviderDownloadItemObserver( downloads_(downloads) { } +AutomationProviderDownloadItemObserver:: +~AutomationProviderDownloadItemObserver() {} + void AutomationProviderDownloadItemObserver::OnDownloadUpdated( DownloadItem* download) { } @@ -1330,6 +1350,9 @@ AutomationProviderDownloadUpdatedObserver( wait_for_open_(wait_for_open) { } +AutomationProviderDownloadUpdatedObserver:: +~AutomationProviderDownloadUpdatedObserver() {} + void AutomationProviderDownloadUpdatedObserver::OnDownloadUpdated( DownloadItem* download) { // If this observer is watching for open, only send the reply if the download @@ -1375,6 +1398,9 @@ AutomationProviderDownloadModelChangedObserver( download_manager_(download_manager) { } +AutomationProviderDownloadModelChangedObserver:: +~AutomationProviderDownloadModelChangedObserver() {} + void AutomationProviderDownloadModelChangedObserver::ModelChanged() { download_manager_->RemoveObserver(this); @@ -1390,6 +1416,9 @@ AutomationProviderSearchEngineObserver::AutomationProviderSearchEngineObserver( reply_message_(reply_message) { } +AutomationProviderSearchEngineObserver:: +~AutomationProviderSearchEngineObserver() {} + void AutomationProviderSearchEngineObserver::OnTemplateURLModelChanged() { TemplateURLModel* url_model = provider_->profile()->GetTemplateURLModel(); url_model->RemoveObserver(this); @@ -1406,6 +1435,8 @@ AutomationProviderHistoryObserver::AutomationProviderHistoryObserver( reply_message_(reply_message) { } +AutomationProviderHistoryObserver::~AutomationProviderHistoryObserver() {} + void AutomationProviderHistoryObserver::HistoryQueryComplete( HistoryService::Handle request_handle, history::QueryResults* results) { @@ -1446,6 +1477,9 @@ AutomationProviderImportSettingsObserver( reply_message_(reply_message) { } +AutomationProviderImportSettingsObserver:: +~AutomationProviderImportSettingsObserver() {} + void AutomationProviderImportSettingsObserver::ImportStarted() { } @@ -1470,6 +1504,9 @@ AutomationProviderGetPasswordsObserver::AutomationProviderGetPasswordsObserver( reply_message_(reply_message) { } +AutomationProviderGetPasswordsObserver:: +~AutomationProviderGetPasswordsObserver() {} + void AutomationProviderGetPasswordsObserver::OnPasswordStoreRequestDone( int handle, const std::vector<webkit_glue::PasswordForm*>& result) { if (!provider_) { @@ -1514,6 +1551,9 @@ AutomationProviderBrowsingDataObserver::AutomationProviderBrowsingDataObserver( reply_message_(reply_message) { } +AutomationProviderBrowsingDataObserver:: +~AutomationProviderBrowsingDataObserver() {} + void AutomationProviderBrowsingDataObserver::OnBrowsingDataRemoverDone() { if (provider_) AutomationJSONReply(provider_, reply_message_.release()).SendSuccess(NULL); @@ -1563,6 +1603,8 @@ SavePackageNotificationObserver::SavePackageNotificationObserver( source); } +SavePackageNotificationObserver::~SavePackageNotificationObserver() {} + void SavePackageNotificationObserver::Observe( NotificationType type, const NotificationSource& source, @@ -1588,6 +1630,8 @@ PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation, image_path_(path), received_width_(false) {} +PageSnapshotTaker::~PageSnapshotTaker() {} + void PageSnapshotTaker::Start() { ExecuteScript(L"window.domAutomationController.send(document.width);"); } @@ -1753,6 +1797,8 @@ AutocompleteEditFocusedObserver::AutocompleteEditFocusedObserver( registrar_.Add(this, NotificationType::AUTOCOMPLETE_EDIT_FOCUSED, source); } +AutocompleteEditFocusedObserver::~AutocompleteEditFocusedObserver() {} + void AutocompleteEditFocusedObserver::Observe( NotificationType type, const NotificationSource& source, @@ -1803,6 +1849,8 @@ GetActiveNotificationsObserver::GetActiveNotificationsObserver( } } +GetActiveNotificationsObserver::~GetActiveNotificationsObserver() {} + void GetActiveNotificationsObserver::Observe( NotificationType type, const NotificationSource& source, @@ -1864,6 +1912,8 @@ RendererProcessClosedObserver::RendererProcessClosedObserver( NotificationService::AllSources()); } +RendererProcessClosedObserver::~RendererProcessClosedObserver() {} + void RendererProcessClosedObserver::Observe( NotificationType type, const NotificationSource& source, @@ -1887,6 +1937,8 @@ InputEventAckNotificationObserver::InputEventAckNotificationObserver( NotificationService::AllSources()); } +InputEventAckNotificationObserver::~InputEventAckNotificationObserver() {} + void InputEventAckNotificationObserver::Observe( NotificationType type, const NotificationSource& source, diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index a64bf29..0ffc85f 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -54,7 +54,7 @@ class Message; class InitialLoadObserver : public NotificationObserver { public: InitialLoadObserver(size_t tab_count, AutomationProvider* automation); - ~InitialLoadObserver(); + virtual ~InitialLoadObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -91,7 +91,7 @@ class InitialLoadObserver : public NotificationObserver { class NewTabUILoadObserver : public NotificationObserver { public: explicit NewTabUILoadObserver(AutomationProvider* automation); - ~NewTabUILoadObserver(); + virtual ~NewTabUILoadObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -109,7 +109,7 @@ class NavigationControllerRestoredObserver : public NotificationObserver { NavigationControllerRestoredObserver(AutomationProvider* automation, NavigationController* controller, IPC::Message* reply_message); - ~NavigationControllerRestoredObserver(); + virtual ~NavigationControllerRestoredObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -134,7 +134,7 @@ class NavigationNotificationObserver : public NotificationObserver { IPC::Message* reply_message, int number_of_navigations, bool include_current_navigation); - ~NavigationNotificationObserver(); + virtual ~NavigationNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -176,6 +176,7 @@ class TabAppendedNotificationObserver : public TabStripNotificationObserver { TabAppendedNotificationObserver(Browser* parent, AutomationProvider* automation, IPC::Message* reply_message); + virtual ~TabAppendedNotificationObserver(); virtual void ObserveTab(NavigationController* controller); @@ -192,6 +193,7 @@ class TabClosedNotificationObserver : public TabStripNotificationObserver { TabClosedNotificationObserver(AutomationProvider* automation, bool wait_until_closed, IPC::Message* reply_message); + virtual ~TabClosedNotificationObserver(); virtual void ObserveTab(NavigationController* controller); @@ -220,7 +222,7 @@ class TabCountChangeObserver : public TabStripModelObserver { virtual void TabStripModelDeleted(); private: - ~TabCountChangeObserver(); + virtual ~TabCountChangeObserver(); // Checks if the current tab count matches our target, and if so, // sends the reply message and deletes self. @@ -243,7 +245,7 @@ class ExtensionInstallNotificationObserver : public NotificationObserver { ExtensionInstallNotificationObserver(AutomationProvider* automation, int id, IPC::Message* reply_message); - ~ExtensionInstallNotificationObserver(); + virtual ~ExtensionInstallNotificationObserver(); // Implementation of NotificationObserver. virtual void Observe(NotificationType type, @@ -270,7 +272,7 @@ class ExtensionReadyNotificationObserver : public NotificationObserver { AutomationProvider* automation, int id, IPC::Message* reply_message); - ~ExtensionReadyNotificationObserver(); + virtual ~ExtensionReadyNotificationObserver(); // Implementation of NotificationObserver. virtual void Observe(NotificationType type, @@ -291,7 +293,7 @@ class ExtensionReadyNotificationObserver : public NotificationObserver { class ExtensionUnloadNotificationObserver : public NotificationObserver { public: ExtensionUnloadNotificationObserver(); - ~ExtensionUnloadNotificationObserver(); + virtual ~ExtensionUnloadNotificationObserver(); // Implementation of NotificationObserver. virtual void Observe(NotificationType type, @@ -313,7 +315,7 @@ class ExtensionTestResultNotificationObserver : public NotificationObserver { public: explicit ExtensionTestResultNotificationObserver( AutomationProvider* automation); - ~ExtensionTestResultNotificationObserver(); + virtual ~ExtensionTestResultNotificationObserver(); // Implementation of NotificationObserver. virtual void Observe(NotificationType type, @@ -344,7 +346,7 @@ class BrowserOpenedNotificationObserver : public NotificationObserver { public: BrowserOpenedNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message); - ~BrowserOpenedNotificationObserver(); + virtual ~BrowserOpenedNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -366,6 +368,7 @@ class BrowserClosedNotificationObserver : public NotificationObserver { BrowserClosedNotificationObserver(Browser* browser, AutomationProvider* automation, IPC::Message* reply_message); + virtual ~BrowserClosedNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -387,6 +390,7 @@ class BrowserCountChangeNotificationObserver : public NotificationObserver { BrowserCountChangeNotificationObserver(int target_count, AutomationProvider* automation, IPC::Message* reply_message); + virtual ~BrowserCountChangeNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -405,7 +409,7 @@ class AppModalDialogShownObserver : public NotificationObserver { public: AppModalDialogShownObserver(AutomationProvider* automation, IPC::Message* reply_message); - ~AppModalDialogShownObserver(); + virtual ~AppModalDialogShownObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -421,7 +425,7 @@ class AppModalDialogShownObserver : public NotificationObserver { class ExecuteBrowserCommandObserver : public NotificationObserver { public: - ~ExecuteBrowserCommandObserver(); + virtual ~ExecuteBrowserCommandObserver(); static bool CreateAndRegisterObserver(AutomationProvider* automation, Browser* browser, @@ -454,7 +458,7 @@ class FindInPageNotificationObserver : public NotificationObserver { TabContents* parent_tab, bool reply_with_json, IPC::Message* reply_message); - ~FindInPageNotificationObserver(); + virtual ~FindInPageNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -485,7 +489,7 @@ class FindInPageNotificationObserver : public NotificationObserver { class DomOperationObserver : public NotificationObserver { public: DomOperationObserver(); - virtual ~DomOperationObserver() {} + virtual ~DomOperationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -502,6 +506,7 @@ class DomOperationObserver : public NotificationObserver { class DomOperationMessageSender : public DomOperationObserver { public: explicit DomOperationMessageSender(AutomationProvider* automation); + virtual ~DomOperationMessageSender(); virtual void OnDomOperationCompleted(const std::string& json); @@ -515,7 +520,7 @@ class DocumentPrintedNotificationObserver : public NotificationObserver { public: DocumentPrintedNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message); - ~DocumentPrintedNotificationObserver(); + virtual ~DocumentPrintedNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); @@ -577,6 +582,7 @@ class TabLanguageDeterminedObserver : public NotificationObserver { IPC::Message* reply_message, TabContents* tab_contents, TranslateInfoBarDelegate* translate_bar); + virtual ~TabLanguageDeterminedObserver(); // NotificationObserver interface. virtual void Observe(NotificationType type, @@ -599,6 +605,7 @@ class InfoBarCountObserver : public NotificationObserver { IPC::Message* reply_message, TabContents* tab_contents, size_t target_count); + virtual ~InfoBarCountObserver(); // NotificationObserver interface. virtual void Observe(NotificationType type, @@ -713,6 +720,7 @@ class AutomationProviderDownloadItemObserver : public DownloadItem::Observer { AutomationProvider* provider, IPC::Message* reply_message, int downloads); + virtual ~AutomationProviderDownloadItemObserver(); virtual void OnDownloadUpdated(DownloadItem* download); virtual void OnDownloadFileCompleted(DownloadItem* download); @@ -735,6 +743,7 @@ class AutomationProviderDownloadUpdatedObserver AutomationProvider* provider, IPC::Message* reply_message, bool wait_for_open); + virtual ~AutomationProviderDownloadUpdatedObserver(); virtual void OnDownloadUpdated(DownloadItem* download); virtual void OnDownloadOpened(DownloadItem* download); @@ -757,6 +766,7 @@ class AutomationProviderDownloadModelChangedObserver AutomationProvider* provider, IPC::Message* reply_message, DownloadManager* download_manager); + virtual ~AutomationProviderDownloadModelChangedObserver(); virtual void ModelChanged(); @@ -776,6 +786,7 @@ class AutomationProviderSearchEngineObserver AutomationProviderSearchEngineObserver( AutomationProvider* provider, IPC::Message* reply_message); + virtual ~AutomationProviderSearchEngineObserver(); virtual void OnTemplateURLModelChanged(); @@ -792,6 +803,7 @@ class AutomationProviderHistoryObserver { AutomationProviderHistoryObserver( AutomationProvider* provider, IPC::Message* reply_message); + virtual ~AutomationProviderHistoryObserver(); void HistoryQueryComplete(HistoryService::Handle request_handle, history::QueryResults* results); @@ -808,6 +820,7 @@ class AutomationProviderImportSettingsObserver AutomationProviderImportSettingsObserver( AutomationProvider* provider, IPC::Message* reply_message); + virtual ~AutomationProviderImportSettingsObserver(); virtual void ImportStarted(); virtual void ImportItemStarted(importer::ImportItem item); @@ -825,6 +838,7 @@ class AutomationProviderGetPasswordsObserver AutomationProviderGetPasswordsObserver( AutomationProvider* provider, IPC::Message* reply_message); + virtual ~AutomationProviderGetPasswordsObserver(); virtual void OnPasswordStoreRequestDone( int handle, const std::vector<webkit_glue::PasswordForm*>& result); @@ -841,6 +855,7 @@ class AutomationProviderBrowsingDataObserver AutomationProviderBrowsingDataObserver( AutomationProvider* provider, IPC::Message* reply_message); + virtual ~AutomationProviderBrowsingDataObserver(); virtual void OnBrowsingDataRemoverDone(); @@ -856,7 +871,7 @@ class OmniboxAcceptNotificationObserver : public NotificationObserver { OmniboxAcceptNotificationObserver(NavigationController* controller, AutomationProvider* automation, IPC::Message* reply_message); - ~OmniboxAcceptNotificationObserver(); + virtual ~OmniboxAcceptNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -877,7 +892,7 @@ class SavePackageNotificationObserver : public NotificationObserver { SavePackageNotificationObserver(SavePackage* save_package, AutomationProvider* automation, IPC::Message* reply_message); - virtual ~SavePackageNotificationObserver() {} + virtual ~SavePackageNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -899,6 +914,7 @@ class PageSnapshotTaker : public DomOperationObserver { IPC::Message* reply_message, RenderViewHost* render_view, const FilePath& path); + virtual ~PageSnapshotTaker(); // Start the process of taking a snapshot of the entire page. void Start(); @@ -960,6 +976,7 @@ class AutocompleteEditFocusedObserver : public NotificationObserver { AutocompleteEditFocusedObserver(AutomationProvider* automation, AutocompleteEditModel* autocomplete_edit, IPC::Message* reply_message); + virtual ~AutocompleteEditFocusedObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -980,6 +997,7 @@ class GetActiveNotificationsObserver : public NotificationObserver { public: GetActiveNotificationsObserver(AutomationProvider* automation, IPC::Message* reply_message); + virtual ~GetActiveNotificationsObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -1019,6 +1037,7 @@ class RendererProcessClosedObserver : public NotificationObserver { public: RendererProcessClosedObserver(AutomationProvider* automation, IPC::Message* reply_message); + virtual ~RendererProcessClosedObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -1039,6 +1058,7 @@ class InputEventAckNotificationObserver : public NotificationObserver { InputEventAckNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message, int event_type); + virtual ~InputEventAckNotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, @@ -1063,7 +1083,7 @@ class NewTabObserver : public NotificationObserver { const NotificationDetails& details) OVERRIDE; private: - ~NewTabObserver(); + virtual ~NewTabObserver(); NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; @@ -1086,7 +1106,7 @@ class WaitForProcessLauncherThreadToGoIdleObserver friend class BrowserThread; friend class DeleteTask<WaitForProcessLauncherThreadToGoIdleObserver>; - ~WaitForProcessLauncherThreadToGoIdleObserver(); + virtual ~WaitForProcessLauncherThreadToGoIdleObserver(); void RunOnProcessLauncherThread(); void RunOnUIThread(); diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 0c3e081..7de163d 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/content_settings/host_content_settings_map_unittest.h" - #include "base/auto_reset.h" #include "base/command_line.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "chrome/browser/content_settings/content_settings_details.h" +#include "chrome/browser/content_settings/host_content_settings_map.h" +#include "chrome/browser/content_settings/stub_settings_observer.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -19,7 +19,6 @@ #include "net/base/static_cookie_policy.h" #include "testing/gtest/include/gtest/gtest.h" - namespace { bool SettingsEqual(const ContentSettings& settings1, diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.h b/chrome/browser/content_settings/host_content_settings_map_unittest.h deleted file mode 100644 index ba56ab4..0000000 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2010 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_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_ -#define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_ -#pragma once - -#include "chrome/browser/content_settings/content_settings_details.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/common/notification_service.h" -#include "googleurl/src/gurl.h" - -class HostContentSettingsMap; - -class StubSettingsObserver : public NotificationObserver { - public: - StubSettingsObserver() : last_notifier(NULL), counter(0) { - registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, - NotificationService::AllSources()); - } - - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - ++counter; - Source<HostContentSettingsMap> content_settings(source); - Details<ContentSettingsDetails> settings_details(details); - last_notifier = content_settings.ptr(); - last_pattern = settings_details.ptr()->pattern(); - last_update_all = settings_details.ptr()->update_all(); - last_update_all_types = settings_details.ptr()->update_all_types(); - last_type = settings_details.ptr()->type(); - // This checks that calling a Get function from an observer doesn't - // deadlock. - last_notifier->GetContentSettings(GURL("http://random-hostname.com/")); - } - - HostContentSettingsMap* last_notifier; - ContentSettingsPattern last_pattern; - bool last_update_all; - bool last_update_all_types; - int counter; - ContentSettingsType last_type; - - private: - NotificationRegistrar registrar_; -}; -#endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_ diff --git a/chrome/browser/content_settings/mock_content_settings_provider.cc b/chrome/browser/content_settings/mock_content_settings_provider.cc index 9e888e9..f73280f 100644 --- a/chrome/browser/content_settings/mock_content_settings_provider.cc +++ b/chrome/browser/content_settings/mock_content_settings_provider.cc @@ -40,6 +40,29 @@ bool MockDefaultProvider::DefaultSettingIsManaged( void MockDefaultProvider::ResetToDefaults() { } +MockProvider::MockProvider() + : requesting_url_pattern_(ContentSettingsPattern()), + embedding_url_pattern_(ContentSettingsPattern()), + content_type_(CONTENT_SETTINGS_TYPE_COOKIES), + resource_identifier_(""), + setting_(CONTENT_SETTING_DEFAULT), + read_only_(false) {} + +MockProvider::MockProvider(ContentSettingsPattern requesting_url_pattern, + ContentSettingsPattern embedding_url_pattern, + ContentSettingsType content_type, + ResourceIdentifier resource_identifier, + ContentSetting setting, + bool read_only) + : requesting_url_pattern_(requesting_url_pattern), + embedding_url_pattern_(embedding_url_pattern), + content_type_(content_type), + resource_identifier_(resource_identifier), + setting_(setting), + read_only_(read_only) {} + +MockProvider::~MockProvider() {} + ContentSetting MockProvider::GetContentSetting( const GURL& requesting_url, const GURL& embedding_url, diff --git a/chrome/browser/content_settings/mock_content_settings_provider.h b/chrome/browser/content_settings/mock_content_settings_provider.h index 1446d10..4393868 100644 --- a/chrome/browser/content_settings/mock_content_settings_provider.h +++ b/chrome/browser/content_settings/mock_content_settings_provider.h @@ -43,29 +43,14 @@ class MockDefaultProvider : public DefaultProviderInterface { // The class MockProvider is a mock for a non default content settings provider. class MockProvider : public ProviderInterface { public: - MockProvider() - : requesting_url_pattern_(ContentSettingsPattern()), - embedding_url_pattern_(ContentSettingsPattern()), - content_type_(CONTENT_SETTINGS_TYPE_COOKIES), - resource_identifier_(""), - setting_(CONTENT_SETTING_DEFAULT), - read_only_(false) {} - - MockProvider( - ContentSettingsPattern requesting_url_pattern, - ContentSettingsPattern embedding_url_pattern, - ContentSettingsType content_type, - ResourceIdentifier resource_identifier, - ContentSetting setting, - bool read_only) - : requesting_url_pattern_(requesting_url_pattern), - embedding_url_pattern_(embedding_url_pattern), - content_type_(content_type), - resource_identifier_(resource_identifier), - setting_(setting), - read_only_(read_only) {} - - virtual ~MockProvider() {} + MockProvider(); + MockProvider(ContentSettingsPattern requesting_url_pattern, + ContentSettingsPattern embedding_url_pattern, + ContentSettingsType content_type, + ResourceIdentifier resource_identifier, + ContentSetting setting, + bool read_only); + virtual ~MockProvider(); // ProviderInterface implementation virtual ContentSetting GetContentSetting( diff --git a/chrome/browser/content_settings/policy_content_settings_provider_unittest.cc b/chrome/browser/content_settings/policy_content_settings_provider_unittest.cc index 807689e..6aa9a88 100644 --- a/chrome/browser/content_settings/policy_content_settings_provider_unittest.cc +++ b/chrome/browser/content_settings/policy_content_settings_provider_unittest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/content_settings/policy_content_settings_provider.h" -#include "chrome/browser/content_settings/host_content_settings_map_unittest.h" +#include "chrome/browser/browser_thread.h" +#include "chrome/browser/content_settings/stub_settings_observer.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/content_settings/pref_content_settings_provider.cc b/chrome/browser/content_settings/pref_content_settings_provider.cc index a0ada34..bb6360e 100644 --- a/chrome/browser/content_settings/pref_content_settings_provider.cc +++ b/chrome/browser/content_settings/pref_content_settings_provider.cc @@ -89,6 +89,11 @@ ContentSetting ClickToPlayFixup(ContentSettingsType content_type, namespace content_settings { +struct PrefProvider::ExtendedContentSettings { + ContentSettings content_settings; + ResourceContentSettings content_settings_for_resources; +}; + PrefDefaultProvider::PrefDefaultProvider(Profile* profile) : profile_(profile), is_off_the_record_(profile_->IsOffTheRecord()), diff --git a/chrome/browser/content_settings/pref_content_settings_provider.h b/chrome/browser/content_settings/pref_content_settings_provider.h index 31ccdb1..b4631b8 100644 --- a/chrome/browser/content_settings/pref_content_settings_provider.h +++ b/chrome/browser/content_settings/pref_content_settings_provider.h @@ -136,10 +136,7 @@ class PrefProvider : public ProviderInterface, typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting> ResourceContentSettings; - struct ExtendedContentSettings { - ContentSettings content_settings; - ResourceContentSettings content_settings_for_resources; - }; + struct ExtendedContentSettings; typedef std::map<std::string, ExtendedContentSettings> HostContentSettings; diff --git a/chrome/browser/content_settings/pref_content_settings_provider_unittest.cc b/chrome/browser/content_settings/pref_content_settings_provider_unittest.cc index 14dfebb..80b62c3 100644 --- a/chrome/browser/content_settings/pref_content_settings_provider_unittest.cc +++ b/chrome/browser/content_settings/pref_content_settings_provider_unittest.cc @@ -6,16 +6,17 @@ #include "base/auto_reset.h" #include "base/command_line.h" -#include "chrome/browser/content_settings/host_content_settings_map_unittest.h" +#include "chrome/browser/browser_thread.h" +#include "chrome/browser/content_settings/stub_settings_observer.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" +#include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" - namespace content_settings { class PrefDefaultProviderTest : public testing::Test { diff --git a/chrome/browser/content_settings/stub_settings_observer.cc b/chrome/browser/content_settings/stub_settings_observer.cc new file mode 100644 index 0000000..b042412 --- /dev/null +++ b/chrome/browser/content_settings/stub_settings_observer.cc @@ -0,0 +1,33 @@ +// 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/browser/content_settings/stub_settings_observer.h" + +#include "chrome/browser/content_settings/host_content_settings_map.h" +#include "googleurl/src/gurl.h" + +StubSettingsObserver::StubSettingsObserver() + : last_notifier(NULL), + counter(0) { + registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, + NotificationService::AllSources()); +} + +StubSettingsObserver::~StubSettingsObserver() {} + +void StubSettingsObserver::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + ++counter; + Source<HostContentSettingsMap> content_settings(source); + Details<ContentSettingsDetails> settings_details(details); + last_notifier = content_settings.ptr(); + last_pattern = settings_details.ptr()->pattern(); + last_update_all = settings_details.ptr()->update_all(); + last_update_all_types = settings_details.ptr()->update_all_types(); + last_type = settings_details.ptr()->type(); + // This checks that calling a Get function from an observer doesn't + // deadlock. + last_notifier->GetContentSettings(GURL("http://random-hostname.com/")); +} diff --git a/chrome/browser/content_settings/stub_settings_observer.h b/chrome/browser/content_settings/stub_settings_observer.h new file mode 100644 index 0000000..452de07 --- /dev/null +++ b/chrome/browser/content_settings/stub_settings_observer.h @@ -0,0 +1,36 @@ +// 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_BROWSER_CONTENT_SETTINGS_STUB_SETTINGS_OBSERVER_H_ +#define CHROME_BROWSER_CONTENT_SETTINGS_STUB_SETTINGS_OBSERVER_H_ +#pragma once + +#include "chrome/browser/content_settings/content_settings_details.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" +#include "chrome/common/notification_service.h" + +class HostContentSettingsMap; + +class StubSettingsObserver : public NotificationObserver { + public: + StubSettingsObserver(); + virtual ~StubSettingsObserver(); + + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + HostContentSettingsMap* last_notifier; + ContentSettingsPattern last_pattern; + bool last_update_all; + bool last_update_all_types; + int counter; + ContentSettingsType last_type; + + private: + NotificationRegistrar registrar_; +}; + +#endif // CHROME_BROWSER_CONTENT_SETTINGS_STUB_SETTINGS_OBSERVER_H_ diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc index 8d03b2a..ccf43f2 100644 --- a/chrome/browser/cookies_tree_model_unittest.cc +++ b/chrome/browser/cookies_tree_model_unittest.cc @@ -6,7 +6,7 @@ #include <string> -#include "chrome/browser/content_settings/host_content_settings_map_unittest.h" +#include "chrome/browser/content_settings/stub_settings_observer.h" #include "chrome/browser/mock_browsing_data_appcache_helper.h" #include "chrome/browser/mock_browsing_data_database_helper.h" #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc index 84cc4a6..f877473 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc +++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc @@ -48,10 +48,38 @@ static const char* kSemaphoreName = "chromium.listen_socket"; #endif +ListenSocketTestAction::ListenSocketTestAction() : action_(ACTION_NONE) {} + +ListenSocketTestAction::ListenSocketTestAction(ActionType action) + : action_(action) {} + +ListenSocketTestAction::ListenSocketTestAction(ActionType action, + std::string data) + : action_(action), + data_(data) {} + +ListenSocketTestAction::ListenSocketTestAction( + ActionType action, + const DevToolsRemoteMessage& message) + : action_(action), + message_(message) {} + +ListenSocketTestAction::~ListenSocketTestAction() {} + ListenSocket* DevToolsRemoteListenSocketTester::DoListen() { return DevToolsRemoteListenSocket::Listen(kLoopback, kTestPort, this); } +DevToolsRemoteListenSocketTester::DevToolsRemoteListenSocketTester() + : semaphore_(NULL), + thread_(NULL), + loop_(NULL), + server_(NULL), + connection_(NULL), + test_socket_(INVALID_SOCKET) { + memset(&lock_, 0, sizeof(lock_)); +} + void DevToolsRemoteListenSocketTester::SetUp() { #if defined(OS_WIN) InitializeCriticalSection(&lock_); @@ -322,6 +350,7 @@ void DevToolsRemoteListenSocketTester::TestServerSend() { ASSERT_STREQ(buf, kChromeDevToolsHandshake); } +DevToolsRemoteListenSocketTester::~DevToolsRemoteListenSocketTester() {} class DevToolsRemoteListenSocketTest: public PlatformTest { public: diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h index 6bba3ba..537b881 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h +++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h @@ -54,16 +54,12 @@ enum ActionType { class ListenSocketTestAction { public: - ListenSocketTestAction() : action_(ACTION_NONE) {} - explicit ListenSocketTestAction(ActionType action) - : action_(action) {} - ListenSocketTestAction(ActionType action, std::string data) - : action_(action), - data_(data) {} + ListenSocketTestAction(); + explicit ListenSocketTestAction(ActionType action); + ListenSocketTestAction(ActionType action, std::string data); ListenSocketTestAction(ActionType action, - const DevToolsRemoteMessage& message) - : action_(action), - message_(message) {} + const DevToolsRemoteMessage& message); + ~ListenSocketTestAction(); const std::string data() const { return data_; } const DevToolsRemoteMessage message() { return message_; } @@ -81,15 +77,7 @@ class ListenSocketTestAction { class DevToolsRemoteListenSocketTester : public DevToolsRemoteListener { public: - DevToolsRemoteListenSocketTester() - : semaphore_(NULL), - thread_(NULL), - loop_(NULL), - server_(NULL), - connection_(NULL), - test_socket_(INVALID_SOCKET) { - memset(&lock_, 0, sizeof(lock_)); - } + DevToolsRemoteListenSocketTester(); virtual void SetUp(); virtual void TearDown(); @@ -135,7 +123,7 @@ class DevToolsRemoteListenSocketTester : virtual ListenSocket* DoListen(); private: - virtual ~DevToolsRemoteListenSocketTester() {} + virtual ~DevToolsRemoteListenSocketTester(); }; #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_UNITTEST_H_ diff --git a/chrome/browser/dom_ui/dom_ui_browsertest.cc b/chrome/browser/dom_ui/dom_ui_browsertest.cc index 28ed0a0..d8eb0b2 100644 --- a/chrome/browser/dom_ui/dom_ui_browsertest.cc +++ b/chrome/browser/dom_ui/dom_ui_browsertest.cc @@ -17,6 +17,8 @@ static const FilePath::CharType* kDOMUILibraryJS = static const FilePath::CharType* kDOMUITestFolder = FILE_PATH_LITERAL("dom_ui"); +DOMUITest::~DOMUITest() {} + bool DOMUITest::RunDOMUITest(const FilePath::CharType* src_path) { std::string content; BuildJavaScriptTest(FilePath(src_path), &content); diff --git a/chrome/browser/dom_ui/dom_ui_browsertest.h b/chrome/browser/dom_ui/dom_ui_browsertest.h index 4b3a120..4aeb9e8 100644 --- a/chrome/browser/dom_ui/dom_ui_browsertest.h +++ b/chrome/browser/dom_ui/dom_ui_browsertest.h @@ -22,6 +22,8 @@ class WebUIMessageHandler; // and the lone test within this class. class DOMUITest : public InProcessBrowserTest { public: + virtual ~DOMUITest(); + bool RunDOMUITest(const FilePath::CharType* src_path); protected: diff --git a/chrome/browser/geolocation/fake_access_token_store.cc b/chrome/browser/geolocation/fake_access_token_store.cc new file mode 100644 index 0000000..1865436 --- /dev/null +++ b/chrome/browser/geolocation/fake_access_token_store.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/browser/geolocation/fake_access_token_store.h" + +FakeAccessTokenStore::FakeAccessTokenStore() {} + +void FakeAccessTokenStore::NotifyDelegateTokensLoaded() { + CHECK(request_ != NULL); + request_->ForwardResult(MakeTuple(access_token_set_)); + request_ = NULL; +} + +void FakeAccessTokenStore::DoLoadAccessTokens( + scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request) { + DCHECK(request_ == NULL) + << "Fake token store currently only allows one request at a time"; + request_ = request; +} + +void FakeAccessTokenStore::SaveAccessToken( + const GURL& server_url, const string16& access_token) { + DCHECK(server_url.is_valid()); + access_token_set_[server_url] = access_token; +} + +FakeAccessTokenStore::~FakeAccessTokenStore() {} diff --git a/chrome/browser/geolocation/fake_access_token_store.h b/chrome/browser/geolocation/fake_access_token_store.h index 5c68267..8a4a9f6 100644 --- a/chrome/browser/geolocation/fake_access_token_store.h +++ b/chrome/browser/geolocation/fake_access_token_store.h @@ -12,32 +12,21 @@ // A fake (non-persisted) access token store instance useful for testing. class FakeAccessTokenStore : public AccessTokenStore { public: - FakeAccessTokenStore() {} + FakeAccessTokenStore(); - void NotifyDelegateTokensLoaded() { - CHECK(request_ != NULL); - request_->ForwardResult(MakeTuple(access_token_set_)); - request_ = NULL; - } + void NotifyDelegateTokensLoaded(); // AccessTokenStore virtual void DoLoadAccessTokens( - scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request) { - DCHECK(request_ == NULL) - << "Fake token store currently only allows one request at a time"; - request_ = request; - } + scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request); virtual void SaveAccessToken( - const GURL& server_url, const string16& access_token) { - DCHECK(server_url.is_valid()); - access_token_set_[server_url] = access_token; - } + const GURL& server_url, const string16& access_token); AccessTokenSet access_token_set_; scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request_; private: - virtual ~FakeAccessTokenStore() {} + virtual ~FakeAccessTokenStore(); DISALLOW_COPY_AND_ASSIGN(FakeAccessTokenStore); }; diff --git a/chrome/browser/mock_plugin_exceptions_table_model.cc b/chrome/browser/mock_plugin_exceptions_table_model.cc index 1c88524..281777b 100644 --- a/chrome/browser/mock_plugin_exceptions_table_model.cc +++ b/chrome/browser/mock_plugin_exceptions_table_model.cc @@ -4,6 +4,13 @@ #include "chrome/browser/mock_plugin_exceptions_table_model.h" +MockPluginExceptionsTableModel::MockPluginExceptionsTableModel( + HostContentSettingsMap* map, + HostContentSettingsMap* otr_map) + : PluginExceptionsTableModel(map, otr_map) {} + +MockPluginExceptionsTableModel::~MockPluginExceptionsTableModel() {} + void MockPluginExceptionsTableModel::set_plugins( std::vector<webkit::npapi::PluginGroup>& plugins) { plugins_ = plugins; diff --git a/chrome/browser/mock_plugin_exceptions_table_model.h b/chrome/browser/mock_plugin_exceptions_table_model.h index c63d67f..1fae316 100644 --- a/chrome/browser/mock_plugin_exceptions_table_model.h +++ b/chrome/browser/mock_plugin_exceptions_table_model.h @@ -13,9 +13,8 @@ class MockPluginExceptionsTableModel : public PluginExceptionsTableModel { public: MockPluginExceptionsTableModel(HostContentSettingsMap* map, - HostContentSettingsMap* otr_map) - : PluginExceptionsTableModel(map, otr_map) {} - virtual ~MockPluginExceptionsTableModel() {} + HostContentSettingsMap* otr_map); + virtual ~MockPluginExceptionsTableModel(); void set_plugins(std::vector<webkit::npapi::PluginGroup>& plugins); diff --git a/chrome/browser/prefs/proxy_config_dictionary.cc b/chrome/browser/prefs/proxy_config_dictionary.cc index f0e1e6f..cc8719a 100644 --- a/chrome/browser/prefs/proxy_config_dictionary.cc +++ b/chrome/browser/prefs/proxy_config_dictionary.cc @@ -29,6 +29,8 @@ ProxyConfigDictionary::ProxyConfigDictionary(const DictionaryValue* dict) : dict_(dict->DeepCopy()) { } +ProxyConfigDictionary::~ProxyConfigDictionary() {} + bool ProxyConfigDictionary::GetMode(ProxyPrefs::ProxyMode* out) const { std::string mode_str; return dict_->GetString(kProxyMode, &mode_str) diff --git a/chrome/browser/prefs/proxy_config_dictionary.h b/chrome/browser/prefs/proxy_config_dictionary.h index ae5c80e..b54d1e6 100644 --- a/chrome/browser/prefs/proxy_config_dictionary.h +++ b/chrome/browser/prefs/proxy_config_dictionary.h @@ -27,6 +27,7 @@ class ProxyConfigDictionary { public: // Creates a deep copy of |dict| and leaves ownership to caller. explicit ProxyConfigDictionary(const DictionaryValue* dict); + ~ProxyConfigDictionary(); bool GetMode(ProxyPrefs::ProxyMode* out) const; bool GetPacUrl(std::string* out) const; diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 3c18cdd..e99c6fd 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1173,11 +1173,12 @@ 'browser/content_settings/content_settings_pattern_unittest.cc', 'browser/content_settings/content_settings_provider_unittest.cc', 'browser/content_settings/host_content_settings_map_unittest.cc', - 'browser/content_settings/host_content_settings_map_unittest.h', - 'browser/content_settings/policy_content_settings_provider_unittest.cc', - 'browser/content_settings/pref_content_settings_provider_unittest.cc', 'browser/content_settings/mock_content_settings_provider.cc', 'browser/content_settings/mock_content_settings_provider.h', + 'browser/content_settings/policy_content_settings_provider_unittest.cc', + 'browser/content_settings/pref_content_settings_provider_unittest.cc', + 'browser/content_settings/stub_settings_observer.cc', + 'browser/content_settings/stub_settings_observer.h', 'browser/cookies_tree_model_unittest.cc', 'browser/debugger/devtools_manager_unittest.cc', 'browser/device_orientation/provider_unittest.cc', @@ -1223,6 +1224,7 @@ 'browser/extensions/user_script_master_unittest.cc', 'browser/first_run/first_run_unittest.cc', 'browser/geolocation/device_data_provider_unittest.cc', + 'browser/geolocation/fake_access_token_store.cc', 'browser/geolocation/fake_access_token_store.h', 'browser/geolocation/gateway_data_provider_common_unittest.cc', 'browser/geolocation/geolocation_content_settings_map_unittest.cc', |