diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 20:44:00 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 20:44:00 +0000 |
commit | 28dc42112899ad4c118cb55ddb3af6437471243f (patch) | |
tree | 7a536b151c9e2137c9249e85b01f9e649216367c | |
parent | b2c71fa0ab3d6a1ef3a8d47b4a827d3539208da6 (diff) | |
download | chromium_src-28dc42112899ad4c118cb55ddb3af6437471243f.zip chromium_src-28dc42112899ad4c118cb55ddb3af6437471243f.tar.gz chromium_src-28dc42112899ad4c118cb55ddb3af6437471243f.tar.bz2 |
Another big out-of-lining of test code. Hits a lot of gmock objects
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6413036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74168 0039d316-1c4b-4281-b951-d872f2087c98
35 files changed, 287 insertions, 143 deletions
diff --git a/chrome/browser/policy/asynchronous_policy_loader_unittest.cc b/chrome/browser/policy/asynchronous_policy_loader_unittest.cc index 44ab3c2..b3e4534 100644 --- a/chrome/browser/policy/asynchronous_policy_loader_unittest.cc +++ b/chrome/browser/policy/asynchronous_policy_loader_unittest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/policy/asynchronous_policy_provider.h" #include "chrome/browser/policy/asynchronous_policy_test_base.h" #include "chrome/browser/policy/mock_configuration_policy_provider.h" +#include "chrome/browser/policy/mock_configuration_policy_store.h" #include "testing/gmock/include/gmock/gmock.h" using ::testing::_; diff --git a/chrome/browser/policy/asynchronous_policy_test_base.cc b/chrome/browser/policy/asynchronous_policy_test_base.cc new file mode 100644 index 0000000..eadf41f --- /dev/null +++ b/chrome/browser/policy/asynchronous_policy_test_base.cc @@ -0,0 +1,31 @@ +// 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/policy/asynchronous_policy_test_base.h" + +#include "chrome/browser/policy/mock_configuration_policy_store.h" + +namespace policy { + +ProviderDelegateMock::ProviderDelegateMock() + : AsynchronousPolicyProvider::Delegate() {} + +ProviderDelegateMock::~ProviderDelegateMock() {} + +AsynchronousPolicyTestBase::AsynchronousPolicyTestBase() + : ui_thread_(BrowserThread::UI, &loop_), + file_thread_(BrowserThread::FILE, &loop_) {} + +AsynchronousPolicyTestBase::~AsynchronousPolicyTestBase() {} + +void AsynchronousPolicyTestBase::SetUp() { + delegate_.reset(new ProviderDelegateMock()); + store_.reset(new MockConfigurationPolicyStore); +} + +void AsynchronousPolicyTestBase::TearDown() { + loop_.RunAllPending(); +} + +} // namespace policy diff --git a/chrome/browser/policy/asynchronous_policy_test_base.h b/chrome/browser/policy/asynchronous_policy_test_base.h index 0281afd..f567f63 100644 --- a/chrome/browser/policy/asynchronous_policy_test_base.h +++ b/chrome/browser/policy/asynchronous_policy_test_base.h @@ -9,17 +9,18 @@ #include "base/message_loop.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/policy/asynchronous_policy_provider.h" -#include "chrome/browser/policy/mock_configuration_policy_store.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace policy { +class MockConfigurationPolicyStore; + // A delegate for testing that can feed arbitrary information to the loader. class ProviderDelegateMock : public AsynchronousPolicyProvider::Delegate { public: - ProviderDelegateMock() : AsynchronousPolicyProvider::Delegate() {} - virtual ~ProviderDelegateMock() {} + ProviderDelegateMock(); + virtual ~ProviderDelegateMock(); MOCK_METHOD0(Load, DictionaryValue*()); @@ -29,20 +30,12 @@ class ProviderDelegateMock : public AsynchronousPolicyProvider::Delegate { class AsynchronousPolicyTestBase : public testing::Test { public: - AsynchronousPolicyTestBase() - : ui_thread_(BrowserThread::UI, &loop_), - file_thread_(BrowserThread::FILE, &loop_) {} - - virtual ~AsynchronousPolicyTestBase() {} - - virtual void SetUp() { - delegate_.reset(new ProviderDelegateMock()); - store_.reset(new MockConfigurationPolicyStore); - } + AsynchronousPolicyTestBase(); + virtual ~AsynchronousPolicyTestBase(); - virtual void TearDown() { - loop_.RunAllPending(); - } + // testing::Test: + virtual void SetUp(); + virtual void TearDown(); protected: MessageLoop loop_; diff --git a/chrome/browser/policy/file_based_policy_provider_unittest.cc b/chrome/browser/policy/file_based_policy_provider_unittest.cc index 2948f5f..d5d0811 100644 --- a/chrome/browser/policy/file_based_policy_provider_unittest.cc +++ b/chrome/browser/policy/file_based_policy_provider_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/configuration_policy_store_interface.h" #include "chrome/browser/policy/file_based_policy_provider.h" +#include "chrome/browser/policy/mock_configuration_policy_store.h" #include "policy/policy_constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/mock_device_management_backend.cc b/chrome/browser/policy/mock_device_management_backend.cc new file mode 100644 index 0000000..c817c60 --- /dev/null +++ b/chrome/browser/policy/mock_device_management_backend.cc @@ -0,0 +1,13 @@ +// 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/policy/mock_device_management_backend.h" + +namespace policy { + +MockDeviceManagementBackend::MockDeviceManagementBackend() {} + +MockDeviceManagementBackend::~MockDeviceManagementBackend() {} + +} // namespace policy diff --git a/chrome/browser/policy/mock_device_management_backend.h b/chrome/browser/policy/mock_device_management_backend.h index 83323de..a684e4f 100644 --- a/chrome/browser/policy/mock_device_management_backend.h +++ b/chrome/browser/policy/mock_device_management_backend.h @@ -22,11 +22,10 @@ namespace em = enterprise_management; // Useful for unit testing when a server-based backend isn't // available. Simulates both successful and failed requests to the device // management server. -class MockDeviceManagementBackend - : public DeviceManagementBackend { +class MockDeviceManagementBackend : public DeviceManagementBackend { public: - MockDeviceManagementBackend() {} - virtual ~MockDeviceManagementBackend() {} + MockDeviceManagementBackend(); + virtual ~MockDeviceManagementBackend(); // DeviceManagementBackend method overrides: MOCK_METHOD4(ProcessRegisterRequest, void( diff --git a/chrome/browser/sync/glue/model_associator_mock.cc b/chrome/browser/sync/glue/model_associator_mock.cc new file mode 100644 index 0000000..f05ede4 --- /dev/null +++ b/chrome/browser/sync/glue/model_associator_mock.cc @@ -0,0 +1,13 @@ +// 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/sync/glue/model_associator_mock.h" + +namespace browser_sync { + +ModelAssociatorMock::ModelAssociatorMock() {} + +ModelAssociatorMock::~ModelAssociatorMock() {} + +} // namespace browser_sync diff --git a/chrome/browser/sync/glue/model_associator_mock.h b/chrome/browser/sync/glue/model_associator_mock.h index 219a204..a949932 100644 --- a/chrome/browser/sync/glue/model_associator_mock.h +++ b/chrome/browser/sync/glue/model_associator_mock.h @@ -13,6 +13,9 @@ namespace browser_sync { class ModelAssociatorMock : public AssociatorInterface { public: + ModelAssociatorMock(); + virtual ~ModelAssociatorMock(); + MOCK_METHOD0(AssociateModels, bool()); MOCK_METHOD0(DisassociateModels, bool()); MOCK_METHOD1(SyncModelHasUserCreatedNodes, bool(bool* has_nodes)); diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index ce2134e..4540834 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/net/gaia/token_service.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/abstract_profile_sync_service_test.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/bookmark_change_processor.h" diff --git a/chrome/browser/sync/profile_sync_test_util.cc b/chrome/browser/sync/profile_sync_test_util.cc new file mode 100644 index 0000000..a533fd4 --- /dev/null +++ b/chrome/browser/sync/profile_sync_test_util.cc @@ -0,0 +1,78 @@ +// 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/sync/profile_sync_test_util.h" + +#include "base/task.h" +#include "base/threading/thread.h" + +ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {} + +ProfileSyncServiceObserverMock::~ProfileSyncServiceObserverMock() {} + +ThreadNotificationService::ThreadNotificationService( + base::Thread* notification_thread) + : done_event_(false, false), + notification_thread_(notification_thread) {} + +void ThreadNotificationService::Init() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + notification_thread_->message_loop()->PostTask( + FROM_HERE, + NewRunnableMethod(this, &ThreadNotificationService::InitTask)); + done_event_.Wait(); +} + +void ThreadNotificationService::TearDown() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + notification_thread_->message_loop()->PostTask( + FROM_HERE, + NewRunnableMethod(this, + &ThreadNotificationService::TearDownTask)); + done_event_.Wait(); +} + +ThreadNotificationService::~ThreadNotificationService() {} + +void ThreadNotificationService::InitTask() { + service_.reset(new NotificationService()); + done_event_.Signal(); +} + +void ThreadNotificationService::TearDownTask() { + service_.reset(NULL); + done_event_.Signal(); +} + +ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) + : done_event_(false, false), + notify_thread_(notify_thread) {} + +void ThreadNotifier::Notify(NotificationType type, + const NotificationDetails& details) { + Notify(type, NotificationService::AllSources(), details); +} + +void ThreadNotifier::Notify(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + notify_thread_->message_loop()->PostTask( + FROM_HERE, + NewRunnableMethod(this, + &ThreadNotifier::NotifyTask, + type, + source, + details)); + done_event_.Wait(); +} + +ThreadNotifier::~ThreadNotifier() {} + +void ThreadNotifier::NotifyTask(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + NotificationService::current()->Notify(type, source, details); + done_event_.Signal(); +} diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h index 45f6046..b7d7aa2 100644 --- a/chrome/browser/sync/profile_sync_test_util.h +++ b/chrome/browser/sync/profile_sync_test_util.h @@ -8,34 +8,21 @@ #include <string> -#include "base/logging.h" #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "base/task.h" -#include "base/threading/thread.h" #include "base/synchronization/waitable_event.h" -#include "base/utf_string_conversions.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/webdata/web_database.h" -#include "chrome/browser/sync/abstract_profile_sync_service_test.h" -#include "chrome/browser/sync/glue/bookmark_change_processor.h" -#include "chrome/browser/sync/glue/bookmark_data_type_controller.h" -#include "chrome/browser/sync/glue/bookmark_model_associator.h" -#include "chrome/browser/sync/glue/change_processor.h" -#include "chrome/browser/sync/glue/data_type_manager_impl.h" -#include "chrome/browser/sync/glue/sync_backend_host.h" -#include "chrome/browser/sync/profile_sync_factory.h" -#include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/sync/syncable/model_type.h" -#include "chrome/browser/sync/unrecoverable_error_handler.h" -#include "chrome/common/notification_details.h" +#include "chrome/browser/sync/profile_sync_service_observer.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_source.h" #include "chrome/common/notification_type.h" -#include "chrome/test/sync/test_http_bridge_factory.h" #include "testing/gmock/include/gmock/gmock.h" +namespace base { +class Thread; +} + ACTION_P(Notify, type) { NotificationService::current()->Notify(type, NotificationService::AllSources(), @@ -49,45 +36,26 @@ ACTION(QuitUIMessageLoop) { class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver { public: + ProfileSyncServiceObserverMock(); + virtual ~ProfileSyncServiceObserverMock(); + MOCK_METHOD0(OnStateChanged, void()); }; class ThreadNotificationService : public base::RefCountedThreadSafe<ThreadNotificationService> { public: - explicit ThreadNotificationService(base::Thread* notification_thread) - : done_event_(false, false), - notification_thread_(notification_thread) {} - - void Init() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - notification_thread_->message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &ThreadNotificationService::InitTask)); - done_event_.Wait(); - } - - void TearDown() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - notification_thread_->message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, - &ThreadNotificationService::TearDownTask)); - done_event_.Wait(); - } + explicit ThreadNotificationService(base::Thread* notification_thread); + + void Init(); + void TearDown(); private: friend class base::RefCountedThreadSafe<ThreadNotificationService>; + virtual ~ThreadNotificationService(); - void InitTask() { - service_.reset(new NotificationService()); - done_event_.Signal(); - } - - void TearDownTask() { - service_.reset(NULL); - done_event_.Signal(); - } + void InitTask(); + void TearDownTask(); base::WaitableEvent done_event_; base::Thread* notification_thread_; @@ -97,37 +65,21 @@ class ThreadNotificationService class ThreadNotifier : // NOLINT public base::RefCountedThreadSafe<ThreadNotifier> { public: - explicit ThreadNotifier(base::Thread* notify_thread) - : done_event_(false, false), - notify_thread_(notify_thread) {} + explicit ThreadNotifier(base::Thread* notify_thread); - void Notify(NotificationType type, const NotificationDetails& details) { - Notify(type, NotificationService::AllSources(), details); - } + void Notify(NotificationType type, const NotificationDetails& details); void Notify(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - notify_thread_->message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, - &ThreadNotifier::NotifyTask, - type, - source, - details)); - done_event_.Wait(); - } + const NotificationDetails& details); private: friend class base::RefCountedThreadSafe<ThreadNotifier>; + virtual ~ThreadNotifier(); void NotifyTask(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) { - NotificationService::current()->Notify(type, source, details); - done_event_.Signal(); - } + const NotificationDetails& details); base::WaitableEvent done_event_; base::Thread* notify_thread_; diff --git a/chrome/browser/sync/syncable/syncable_mock.cc b/chrome/browser/sync/syncable/syncable_mock.cc new file mode 100644 index 0000000..83851cf --- /dev/null +++ b/chrome/browser/sync/syncable/syncable_mock.cc @@ -0,0 +1,16 @@ +// 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/sync/syncable/syncable_mock.h" + +MockDirectory::MockDirectory() { + init_kernel("myk"); +} + +MockDirectory::~MockDirectory() {} + +MockSyncableWriteTransaction::MockSyncableWriteTransaction( + Directory *directory) + : WriteTransaction(directory, syncable::UNITTEST, "dontcare.cpp", 25) { +} diff --git a/chrome/browser/sync/syncable/syncable_mock.h b/chrome/browser/sync/syncable/syncable_mock.h index 9412fe0..e6e0912 100644 --- a/chrome/browser/sync/syncable/syncable_mock.h +++ b/chrome/browser/sync/syncable/syncable_mock.h @@ -17,9 +17,9 @@ using syncable::EntryKernel; class MockDirectory : public Directory { public: - MockDirectory() { - init_kernel("myk"); - } + MockDirectory(); + virtual ~MockDirectory(); + MOCK_METHOD1(GetEntryByHandle, syncable::EntryKernel*(int64)); MOCK_METHOD2(set_last_downloadstamp, void(syncable::ModelType, int64)); @@ -30,9 +30,7 @@ class MockDirectory : public Directory { class MockSyncableWriteTransaction : public syncable::WriteTransaction { public: - explicit MockSyncableWriteTransaction(Directory *directory) : - WriteTransaction(directory, syncable::UNITTEST, "dontcare.cpp", 25) { - } + explicit MockSyncableWriteTransaction(Directory *directory); }; diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc index e536282..ed4668e 100644 --- a/chrome/browser/sync/test_profile_sync_service.cc +++ b/chrome/browser/sync/test_profile_sync_service.cc @@ -61,6 +61,8 @@ SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( RequestNudge()).Times(set_initial_sync_ended_on_init ? 0 : 1); } +SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} + void SyncBackendHostForProfileSyncTest::ConfigureDataTypes( const DataTypeController::TypeMap& data_type_controllers, const syncable::ModelTypeSet& types, diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h index 377b05c..c027725 100644 --- a/chrome/browser/sync/test_profile_sync_service.h +++ b/chrome/browser/sync/test_profile_sync_service.h @@ -40,6 +40,7 @@ class SyncBackendHostForProfileSyncTest int num_expected_pauses, bool set_initial_sync_ended_on_init, bool synchronous_init); + virtual ~SyncBackendHostForProfileSyncTest(); MOCK_METHOD0(RequestPause, bool()); MOCK_METHOD0(RequestResume, bool()); diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 7aa7bb9..5a7529f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -35,6 +35,7 @@ 'theme_resources', '../base/base.gyp:test_support_base', '../ipc/ipc.gyp:test_support_ipc', + '../media/media.gyp:media_test_support', # 'test/test_url_request_context_getter.h' brings in this requirement. '../net/net.gyp:net_test_support', '../skia/skia.gyp:skia', @@ -85,6 +86,8 @@ 'browser/tab_contents/test_tab_contents.h', 'browser/sync/profile_sync_service_mock.cc', 'browser/sync/profile_sync_service_mock.h', + 'browser/sync/syncable/syncable_mock.cc', + 'browser/sync/syncable/syncable_mock.h', 'browser/ui/browser.h', 'browser/ui/cocoa/browser_test_helper.h', 'browser/ui/tab_contents/test_tab_contents_wrapper.cc', @@ -105,6 +108,8 @@ 'renderer/mock_render_process.h', 'renderer/mock_render_thread.cc', 'renderer/mock_render_thread.h', + 'renderer/safe_browsing/mock_feature_extractor_clock.cc', + 'renderer/safe_browsing/mock_feature_extractor_clock.h', 'test/automation/autocomplete_edit_proxy.cc', 'test/automation/autocomplete_edit_proxy.h', 'test/automation/automation_handle_tracker.cc', @@ -1319,6 +1324,7 @@ 'browser/plugin_service_unittest.cc', 'browser/policy/asynchronous_policy_loader_unittest.cc', 'browser/policy/asynchronous_policy_provider_unittest.cc', + 'browser/policy/asynchronous_policy_test_base.cc', 'browser/policy/asynchronous_policy_test_base.h', 'browser/policy/config_dir_policy_provider_unittest.cc', 'browser/policy/configuration_policy_pref_store_unittest.cc', @@ -1336,6 +1342,7 @@ 'browser/policy/mock_configuration_policy_provider.h', 'browser/policy/mock_configuration_policy_store.cc', 'browser/policy/mock_configuration_policy_store.h', + 'browser/policy/mock_device_management_backend.cc', 'browser/policy/mock_device_management_backend.h', 'browser/preferences_mock_mac.cc', 'browser/preferences_mock_mac.h', @@ -1427,6 +1434,8 @@ 'browser/sync/glue/extension_data_type_controller_unittest.cc', 'browser/sync/glue/extension_util_unittest.cc', 'browser/sync/glue/http_bridge_unittest.cc', + 'browser/sync/glue/model_associator_mock.cc', + 'browser/sync/glue/model_associator_mock.h', 'browser/sync/glue/preference_data_type_controller_unittest.cc', 'browser/sync/glue/preference_model_associator_unittest.cc', 'browser/sync/glue/session_model_associator_unittest.cc', @@ -1446,6 +1455,7 @@ 'browser/sync/profile_sync_service_startup_unittest.cc', 'browser/sync/profile_sync_service_typed_url_unittest.cc', 'browser/sync/profile_sync_service_unittest.cc', + 'browser/sync/profile_sync_test_util.cc', 'browser/sync/profile_sync_test_util.h', 'browser/sync/signin_manager_unittest.cc', 'browser/sync/sync_setup_wizard_unittest.cc', @@ -1708,6 +1718,7 @@ 'common/web_apps_unittest.cc', 'common/worker_thread_ticker_unittest.cc', 'common/zip_unittest.cc', + 'gpu/gpu_idirect3d9_mock_win.cc', 'gpu/gpu_idirect3d9_mock_win.h', 'gpu/gpu_info_collector_unittest.cc', 'gpu/gpu_info_unittest_win.cc', @@ -1726,7 +1737,6 @@ 'renderer/renderer_about_handler_unittest.cc', 'renderer/renderer_main_unittest.cc', 'renderer/safe_browsing/features_unittest.cc', - 'renderer/safe_browsing/mock_feature_extractor_clock.h', 'renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc', 'renderer/safe_browsing/phishing_url_feature_extractor_unittest.cc', 'renderer/safe_browsing/scorer_unittest.cc', @@ -2199,7 +2209,6 @@ 'renderer/render_view_browsertest_mac.mm', 'renderer/render_widget_browsertest.cc', 'renderer/render_widget_browsertest.h', - 'renderer/safe_browsing/mock_feature_extractor_clock.h', 'renderer/safe_browsing/phishing_classifier_browsertest.cc', 'renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc', 'renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc', @@ -2757,7 +2766,6 @@ 'browser/sync/sessions/test_util.h', 'browser/sync/syncable/directory_backing_store_unittest.cc', 'browser/sync/syncable/syncable_id_unittest.cc', - 'browser/sync/syncable/syncable_mock.h', 'browser/sync/syncable/syncable_unittest.cc', 'browser/sync/util/channel_unittest.cc', 'browser/sync/util/crypto_helpers_unittest.cc', diff --git a/chrome/gpu/gpu_idirect3d9_mock_win.cc b/chrome/gpu/gpu_idirect3d9_mock_win.cc new file mode 100644 index 0000000..aef4482 --- /dev/null +++ b/chrome/gpu/gpu_idirect3d9_mock_win.cc @@ -0,0 +1,9 @@ +// 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. + +#include "chrome/gpu/gpu_idirect3d9_mock_win.h" + +IDirect3D9Mock::IDirect3D9Mock() {} + +IDirect3D9Mock::~IDirect3D9Mock() {} diff --git a/chrome/gpu/gpu_idirect3d9_mock_win.h b/chrome/gpu/gpu_idirect3d9_mock_win.h index b2867d2..30568c3 100644 --- a/chrome/gpu/gpu_idirect3d9_mock_win.h +++ b/chrome/gpu/gpu_idirect3d9_mock_win.h @@ -13,7 +13,8 @@ class IDirect3D9Mock : public IDirect3D9 { public: - IDirect3D9Mock() {} + IDirect3D9Mock(); + virtual ~IDirect3D9Mock(); MOCK_METHOD5_WITH_CALLTYPE( STDMETHODCALLTYPE, CheckDepthStencilMatch, diff --git a/chrome/gpu/gpu_video_decoder_unittest.cc b/chrome/gpu/gpu_video_decoder_unittest.cc index 41e88d3..7767dcd 100644 --- a/chrome/gpu/gpu_video_decoder_unittest.cc +++ b/chrome/gpu/gpu_video_decoder_unittest.cc @@ -8,7 +8,7 @@ #include "chrome/gpu/gpu_video_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" #include "ipc/ipc_message_utils.h" -#include "media/video/mock_objects.h" +#include "media/video/video_mock_objects.h" #include "testing/gtest/include/gtest/gtest.h" using testing::_; diff --git a/chrome/renderer/gpu_video_decoder_host_unittest.cc b/chrome/renderer/gpu_video_decoder_host_unittest.cc index 52337e5..e1956b5 100644 --- a/chrome/renderer/gpu_video_decoder_host_unittest.cc +++ b/chrome/renderer/gpu_video_decoder_host_unittest.cc @@ -6,7 +6,7 @@ #include "chrome/common/gpu_messages.h" #include "chrome/common/message_router.h" #include "chrome/renderer/gpu_video_decoder_host.h" -#include "media/video/mock_objects.h" +#include "media/video/video_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/safe_browsing/mock_feature_extractor_clock.cc b/chrome/renderer/safe_browsing/mock_feature_extractor_clock.cc new file mode 100644 index 0000000..665baf0 --- /dev/null +++ b/chrome/renderer/safe_browsing/mock_feature_extractor_clock.cc @@ -0,0 +1,14 @@ +// 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/renderer/safe_browsing/mock_feature_extractor_clock.h" + +namespace safe_browsing { + +MockFeatureExtractorClock::MockFeatureExtractorClock() + : FeatureExtractorClock() {} + +MockFeatureExtractorClock::~MockFeatureExtractorClock() {} + +} // namespace safe_browsing diff --git a/chrome/renderer/safe_browsing/mock_feature_extractor_clock.h b/chrome/renderer/safe_browsing/mock_feature_extractor_clock.h index a783732..05f3bef 100644 --- a/chrome/renderer/safe_browsing/mock_feature_extractor_clock.h +++ b/chrome/renderer/safe_browsing/mock_feature_extractor_clock.h @@ -14,8 +14,8 @@ namespace safe_browsing { class MockFeatureExtractorClock : public FeatureExtractorClock { public: - MockFeatureExtractorClock() : FeatureExtractorClock() {} - virtual ~MockFeatureExtractorClock() {} + MockFeatureExtractorClock(); + virtual ~MockFeatureExtractorClock(); MOCK_METHOD0(Now, base::TimeTicks()); diff --git a/chrome/test/live_sync/live_autofill_sync_test.h b/chrome/test/live_sync/live_autofill_sync_test.h index ae19d57..f00be3a 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.h +++ b/chrome/test/live_sync/live_autofill_sync_test.h @@ -19,6 +19,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/webdata/autofill_entry.h" +#include "chrome/browser/webdata/web_database.h" #include "chrome/test/live_sync/live_sync_test.h" #include "chrome/test/thread_observer_helper.h" diff --git a/chrome/test/sync/engine/test_directory_setter_upper.cc b/chrome/test/sync/engine/test_directory_setter_upper.cc index 4818280..9777b32 100644 --- a/chrome/test/sync/engine/test_directory_setter_upper.cc +++ b/chrome/test/sync/engine/test_directory_setter_upper.cc @@ -113,6 +113,8 @@ MockDirectorySetterUpper::MockDirectory::MockDirectory( init_kernel(name); } +MockDirectorySetterUpper::MockDirectory::~MockDirectory() {} + MockDirectorySetterUpper::Manager::Manager( const FilePath& root_path, syncable::Directory* dir) : syncable::DirectoryManager(root_path) { diff --git a/chrome/test/sync/engine/test_directory_setter_upper.h b/chrome/test/sync/engine/test_directory_setter_upper.h index c924532..fc5eb6f 100644 --- a/chrome/test/sync/engine/test_directory_setter_upper.h +++ b/chrome/test/sync/engine/test_directory_setter_upper.h @@ -116,7 +116,7 @@ class MockDirectorySetterUpper : public TestDirectorySetterUpper { class MockDirectory : public syncable::Directory { public: explicit MockDirectory(const std::string& name); - virtual ~MockDirectory() {} + virtual ~MockDirectory(); MOCK_METHOD1(PurgeEntriesWithTypeIn, void(const syncable::ModelTypeSet&)); }; diff --git a/media/media.gyp b/media/media.gyp index b2d8990..2e6e613 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -419,6 +419,8 @@ 'base/mock_filter_host.h', 'base/mock_filters.cc', 'base/mock_filters.h', + 'video/video_mock_objects.cc', + 'video/video_mock_objects.h', ], }, { diff --git a/media/video/video_mock_objects.cc b/media/video/video_mock_objects.cc new file mode 100644 index 0000000..5873b59 --- /dev/null +++ b/media/video/video_mock_objects.cc @@ -0,0 +1,18 @@ +// 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. + +#include "media/video/video_mock_objects.h" + +namespace media { + +MockVideoDecodeEngine::MockVideoDecodeEngine() {} + +MockVideoDecodeEngine::~MockVideoDecodeEngine() {} + +MockVideoDecodeContext::MockVideoDecodeContext() {} + +MockVideoDecodeContext::~MockVideoDecodeContext() {} + + +} // namespace media diff --git a/media/video/mock_objects.h b/media/video/video_mock_objects.h index c0f3dd9..1a9592c 100644 --- a/media/video/mock_objects.h +++ b/media/video/video_mock_objects.h @@ -13,8 +13,8 @@ namespace media { class MockVideoDecodeEngine : public VideoDecodeEngine { public: - MockVideoDecodeEngine() {} - virtual ~MockVideoDecodeEngine() {} + MockVideoDecodeEngine(); + virtual ~MockVideoDecodeEngine(); MOCK_METHOD4(Initialize, void(MessageLoop* message_loop, EventHandler* event_handler, @@ -32,8 +32,8 @@ class MockVideoDecodeEngine : public VideoDecodeEngine { class MockVideoDecodeContext : public VideoDecodeContext { public: - MockVideoDecodeContext() {} - virtual ~MockVideoDecodeContext() {} + MockVideoDecodeContext(); + virtual ~MockVideoDecodeContext(); MOCK_METHOD0(GetDevice, void*()); MOCK_METHOD6(AllocateVideoFrames, void( diff --git a/remoting/base/base_mock_objects.cc b/remoting/base/base_mock_objects.cc new file mode 100644 index 0000000..d76a965 --- /dev/null +++ b/remoting/base/base_mock_objects.cc @@ -0,0 +1,13 @@ +// 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 "remoting/base/base_mock_objects.h" + +namespace remoting { + +MockEncoder::MockEncoder() {} + +MockEncoder::~MockEncoder() {} + +} // namespace remoting diff --git a/remoting/base/mock_objects.h b/remoting/base/base_mock_objects.h index 12143ad..92f17bf 100644 --- a/remoting/base/mock_objects.h +++ b/remoting/base/base_mock_objects.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef REMOTING_BASE_MOCK_OBJECTS_H_ -#define REMOTING_BASE_MOCK_OBJECTS_H_ +#ifndef REMOTING_BASE_BASE_MOCK_OBJECTS_H_ +#define REMOTING_BASE_BASE_MOCK_OBJECTS_H_ #include "remoting/base/capture_data.h" #include "remoting/base/decoder.h" @@ -14,7 +14,8 @@ namespace remoting { class MockEncoder : public Encoder { public: - MockEncoder() {} + MockEncoder(); + virtual ~MockEncoder(); MOCK_METHOD3(Encode, void( scoped_refptr<CaptureData> capture_data, @@ -27,4 +28,4 @@ class MockEncoder : public Encoder { } // namespace remoting -#endif // REMOTING_BASE_MOCK_OBJECTS_H_ +#endif // REMOTING_BASE_BASE_MOCK_OBJECTS_H_ diff --git a/remoting/base/codec_test.cc b/remoting/base/codec_test.cc index 093eea0..bfa2d64 100644 --- a/remoting/base/codec_test.cc +++ b/remoting/base/codec_test.cc @@ -6,10 +6,10 @@ #include <stdlib.h> #include "media/base/video_frame.h" +#include "remoting/base/base_mock_objects.h" #include "remoting/base/codec_test.h" #include "remoting/base/decoder.h" #include "remoting/base/encoder.h" -#include "remoting/base/mock_objects.h" #include "remoting/base/util.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/rect.h" diff --git a/remoting/client/mock_objects.h b/remoting/client/mock_objects.h deleted file mode 100644 index bee3581..0000000 --- a/remoting/client/mock_objects.h +++ /dev/null @@ -1,27 +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 REMOTING_CLIENT_MOCK_OBJECTS_H_ -#define REMOTING_CLIENT_MOCK_OBJECTS_H_ - -#include "base/ref_counted.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace remoting { - -class MockDecodeDoneHandler : - public base::RefCountedThreadSafe<MockDecodeDoneHandler> { - public: - MockDecodeDoneHandler() {} - - MOCK_METHOD0(PartialDecodeDone, void()); - MOCK_METHOD0(DecodeDone, void()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockDecodeDoneHandler); -}; - -} // namespace remoting - -#endif // REMOTING_CLIENT_MOCK_OBJECTS_H_ diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index ebf484b..cbe3d87 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -4,7 +4,7 @@ #include "base/message_loop.h" #include "base/task.h" -#include "remoting/base/mock_objects.h" +#include "remoting/base/base_mock_objects.h" #include "remoting/host/host_mock_objects.h" #include "remoting/host/screen_recorder.h" #include "remoting/proto/video.pb.h" diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc index 42ac018..fcc732c1 100644 --- a/remoting/protocol/connection_to_client_unittest.cc +++ b/remoting/protocol/connection_to_client_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/message_loop.h" -#include "remoting/base/mock_objects.h" +#include "remoting/base/base_mock_objects.h" #include "remoting/protocol/fake_session.h" #include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/protocol_mock_objects.h" diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 0ee8142..f39ef6b 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -462,9 +462,9 @@ 'base/encode_decode_unittest.cc', 'base/encoder_vp8_unittest.cc', 'base/encoder_row_based_unittest.cc', - 'base/mock_objects.h', + 'base/base_mock_objects.cc', + 'base/base_mock_objects.h', # BUG57351 'client/chromoting_view_unittest.cc', - 'client/mock_objects.h', 'host/access_verifier_unittest.cc', 'host/chromoting_host_context_unittest.cc', 'host/chromoting_host_unittest.cc', |