diff options
32 files changed, 491 insertions, 216 deletions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index bebee43..9d91812 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -1244,6 +1244,10 @@ void ExtensionService::UpdateExtensionBlacklist( } } +Profile* ExtensionService::profile() { + return profile_; +} + void ExtensionService::DestroyingProfile() { if (updater_.get()) { updater_->Stop(); diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 46cae33..3048fe43 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -377,7 +377,7 @@ class ExtensionService return show_extensions_prompts_; } - Profile* profile() { return profile_; } + virtual Profile* profile(); // Profile calls this when it is being destroyed so that we know not to call // it. diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 9e0e96e..a2f6c5f 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -81,6 +81,16 @@ ProfileIOData::Handle::GetExtensionsRequestContextGetter() const { return extensions_request_context_getter_; } + +ProfileIOData::LazyParams::LazyParams() + : cache_max_size(0), + media_cache_max_size(0), + io_thread(NULL), + profile(NULL) { +} + +ProfileIOData::LazyParams::~LazyParams() {} + class ProfileIOData::RequestContext : public ChromeURLRequestContext { public: RequestContext(); diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h index 74c86df..2d7f888 100644 --- a/chrome/browser/profiles/profile_io_data.h +++ b/chrome/browser/profiles/profile_io_data.h @@ -71,6 +71,9 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { // TODO(willchan): Move this to the private section when // ChromeURLRequestContextFactory subclasses don't need it anymore. struct LazyParams { + LazyParams(); + ~LazyParams(); + // All of these parameters are intended to be read on the IO thread. FilePath cookie_path; FilePath cache_path; diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 7a3df6f..2e189bb 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -139,7 +139,10 @@ 'test/test_location_bar.h', 'test/test_switches.cc', 'test/test_switches.h', + 'test/test_url_request_context_getter.cc', 'test/test_url_request_context_getter.h', + 'test/testing_browser_process.cc', + 'test/testing_browser_process.h', 'test/testing_device_token_fetcher.cc', 'test/testing_device_token_fetcher.h', 'test/testing_pref_service.cc', @@ -193,7 +196,6 @@ 'test/automated_ui_tests/automated_ui_test_base.h', 'test/automation/proxy_launcher.cc', 'test/automation/proxy_launcher.h', - 'test/testing_browser_process.h', 'test/ui/javascript_test_util.cc', 'test/ui/npapi_test_helper.cc', 'test/ui/npapi_test_helper.h', @@ -2939,7 +2941,6 @@ 'test/live_sync/two_client_live_themes_sync_test.cc', 'test/test_notification_tracker.cc', 'test/test_notification_tracker.h', - 'test/testing_browser_process.h', 'test/ui_test_utils_linux.cc', 'test/ui_test_utils_mac.mm', 'test/ui_test_utils_win.cc', diff --git a/chrome/common/net/test_url_fetcher_factory.cc b/chrome/common/net/test_url_fetcher_factory.cc index af65eb9..869e9be 100644 --- a/chrome/common/net/test_url_fetcher_factory.cc +++ b/chrome/common/net/test_url_fetcher_factory.cc @@ -19,6 +19,10 @@ TestURLFetcher::TestURLFetcher(int id, original_url_(url) { } +TestURLFetcherFactory::TestURLFetcherFactory() {} + +TestURLFetcherFactory::~TestURLFetcherFactory() {} + URLFetcher* TestURLFetcherFactory::CreateURLFetcher( int id, const GURL& url, @@ -87,6 +91,10 @@ class FakeURLFetcher : public URLFetcher { DISALLOW_COPY_AND_ASSIGN(FakeURLFetcher); }; +FakeURLFetcherFactory::FakeURLFetcherFactory() {} + +FakeURLFetcherFactory::~FakeURLFetcherFactory() {} + URLFetcher* FakeURLFetcherFactory::CreateURLFetcher( int id, const GURL& url, diff --git a/chrome/common/net/test_url_fetcher_factory.h b/chrome/common/net/test_url_fetcher_factory.h index 73f4b46..65625a4 100644 --- a/chrome/common/net/test_url_fetcher_factory.h +++ b/chrome/common/net/test_url_fetcher_factory.h @@ -76,7 +76,8 @@ class TestURLFetcher : public URLFetcher { // are registered in a map by the id passed to the create method. class TestURLFetcherFactory : public URLFetcher::Factory { public: - TestURLFetcherFactory() {} + TestURLFetcherFactory(); + virtual ~TestURLFetcherFactory(); virtual URLFetcher* CreateURLFetcher(int id, const GURL& url, @@ -128,7 +129,8 @@ class TestURLFetcherFactory : public URLFetcher::Factory { class FakeURLFetcherFactory : public URLFetcher::Factory { public: - FakeURLFetcherFactory() {} + FakeURLFetcherFactory(); + virtual ~FakeURLFetcherFactory(); // If no fake response is set for the given URL this method will return NULL. // Otherwise, it will return a URLFetcher object which will respond with the diff --git a/chrome/service/service_process_prefs.cc b/chrome/service/service_process_prefs.cc index d0e4796..9164712 100644 --- a/chrome/service/service_process_prefs.cc +++ b/chrome/service/service_process_prefs.cc @@ -12,6 +12,8 @@ ServiceProcessPrefs::ServiceProcessPrefs( : prefs_(new JsonPrefStore(pref_filename, file_message_loop_proxy)) { } +ServiceProcessPrefs::~ServiceProcessPrefs() {} + void ServiceProcessPrefs::ReadPrefs() { prefs_->ReadPrefs(); } diff --git a/chrome/service/service_process_prefs.h b/chrome/service/service_process_prefs.h index a8cc3ce..e936515 100644 --- a/chrome/service/service_process_prefs.h +++ b/chrome/service/service_process_prefs.h @@ -18,6 +18,7 @@ class ServiceProcessPrefs { // file I/O can be done. ServiceProcessPrefs(const FilePath& pref_filename, base::MessageLoopProxy* file_message_loop_proxy); + ~ServiceProcessPrefs(); // Read preferences from the backing file. void ReadPrefs(); diff --git a/chrome/test/test_url_request_context_getter.cc b/chrome/test/test_url_request_context_getter.cc new file mode 100644 index 0000000..1b6cbc1 --- /dev/null +++ b/chrome/test/test_url_request_context_getter.cc @@ -0,0 +1,23 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/test_url_request_context_getter.h" + +#include "chrome/browser/browser_thread.h" +#include "net/url_request/url_request_test_util.h" + +TestURLRequestContextGetter::TestURLRequestContextGetter() {} + +TestURLRequestContextGetter::~TestURLRequestContextGetter() {} + +net::URLRequestContext* TestURLRequestContextGetter::GetURLRequestContext() { + if (!context_) + context_ = new TestURLRequestContext(); + return context_.get(); +} + +scoped_refptr<base::MessageLoopProxy> +TestURLRequestContextGetter::GetIOMessageLoopProxy() const { + return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); +} diff --git a/chrome/test/test_url_request_context_getter.h b/chrome/test/test_url_request_context_getter.h index 43ff974..ee309e0 100644 --- a/chrome/test/test_url_request_context_getter.h +++ b/chrome/test/test_url_request_context_getter.h @@ -7,9 +7,11 @@ #pragma once #include "base/ref_counted.h" -#include "chrome/browser/browser_thread.h" #include "chrome/common/net/url_request_context_getter.h" -#include "net/url_request/url_request_test_util.h" + +namespace base { +class MessageLoopProxy; +} // Used to return a dummy context (normally the context is on the IO thread). // The one here can be run on the main test thread. Note that this can lead to @@ -18,14 +20,12 @@ // special trait that deletes it on the IO thread. class TestURLRequestContextGetter : public URLRequestContextGetter { public: - virtual net::URLRequestContext* GetURLRequestContext() { - if (!context_) - context_ = new TestURLRequestContext(); - return context_.get(); - } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { - return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); - } + TestURLRequestContextGetter(); + virtual ~TestURLRequestContextGetter(); + + // URLRequestContextGetter: + virtual net::URLRequestContext* GetURLRequestContext(); + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; private: scoped_refptr<net::URLRequestContext> context_; diff --git a/chrome/test/testing_browser_process.cc b/chrome/test/testing_browser_process.cc new file mode 100644 index 0000000..004ac87 --- /dev/null +++ b/chrome/test/testing_browser_process.cc @@ -0,0 +1,194 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/testing_browser_process.h" + +#include "base/string_util.h" +#include "base/synchronization/waitable_event.h" +#include "chrome/browser/google/google_url_tracker.h" +#include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/policy/configuration_policy_pref_store.h" +#include "chrome/browser/policy/configuration_policy_provider.h" +#include "chrome/browser/policy/configuration_policy_provider_keeper.h" +#include "chrome/browser/policy/dummy_configuration_policy_provider.h" +#include "ui/base/clipboard/clipboard.h" + +TestingBrowserProcess::TestingBrowserProcess() + : shutdown_event_(new base::WaitableEvent(true, false)), + module_ref_count_(0), + app_locale_("en"), + pref_service_(NULL), + created_configuration_policy_provider_keeper_(false) { +} + +TestingBrowserProcess::~TestingBrowserProcess() { +} + +void TestingBrowserProcess::EndSession() { +} + +ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() { + return NULL; +} + +MetricsService* TestingBrowserProcess::metrics_service() { + return NULL; +} + +IOThread* TestingBrowserProcess::io_thread() { + return NULL; +} + +#if defined(OS_LINUX) +base::Thread* TestingBrowserProcess::background_x11_thread() { + return NULL; +} +#endif + +base::Thread* TestingBrowserProcess::file_thread() { + return NULL; +} + +base::Thread* TestingBrowserProcess::db_thread() { + return NULL; +} + +base::Thread* TestingBrowserProcess::cache_thread() { + return NULL; +} + +ProfileManager* TestingBrowserProcess::profile_manager() { + return NULL; +} + +PrefService* TestingBrowserProcess::local_state() { + return pref_service_; +} + +policy::ConfigurationPolicyProviderKeeper* +TestingBrowserProcess::configuration_policy_provider_keeper() { + if (!created_configuration_policy_provider_keeper_) { + DCHECK(configuration_policy_provider_keeper_.get() == NULL); + created_configuration_policy_provider_keeper_ = true; + const policy::ConfigurationPolicyProvider::PolicyDefinitionList* + policy_list = policy::ConfigurationPolicyPrefStore:: + GetChromePolicyDefinitionList(); + configuration_policy_provider_keeper_.reset( + new policy::ConfigurationPolicyProviderKeeper( + new policy::DummyConfigurationPolicyProvider(policy_list), + new policy::DummyConfigurationPolicyProvider(policy_list), + new policy::DummyConfigurationPolicyProvider(policy_list))); + } + return configuration_policy_provider_keeper_.get(); +} + +IconManager* TestingBrowserProcess::icon_manager() { + return NULL; +} + +ThumbnailGenerator* TestingBrowserProcess::GetThumbnailGenerator() { + return NULL; +} + +DevToolsManager* TestingBrowserProcess::devtools_manager() { + return NULL; +} + +SidebarManager* TestingBrowserProcess::sidebar_manager() { + return NULL; +} + +TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() { + return NULL; +} + +safe_browsing::ClientSideDetectionService* +TestingBrowserProcess::safe_browsing_detection_service() { + return NULL; +} + +ui::Clipboard* TestingBrowserProcess::clipboard() { + if (!clipboard_.get()) { + // Note that we need a MessageLoop for the next call to work. + clipboard_.reset(new ui::Clipboard); + } + return clipboard_.get(); +} + +NotificationUIManager* TestingBrowserProcess::notification_ui_manager() { + return NULL; +} + +GoogleURLTracker* TestingBrowserProcess::google_url_tracker() { + return google_url_tracker_.get(); +} + +IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() { + return NULL; +} + +AutomationProviderList* TestingBrowserProcess::InitAutomationProviderList() { + return NULL; +} + +void TestingBrowserProcess::InitDevToolsHttpProtocolHandler( + const std::string& ip, + int port, + const std::string& frontend_url) { +} + +void TestingBrowserProcess::InitDevToolsLegacyProtocolHandler(int port) { +} + +unsigned int TestingBrowserProcess::AddRefModule() { + return ++module_ref_count_; +} + +unsigned int TestingBrowserProcess::ReleaseModule() { + DCHECK(module_ref_count_ > 0); + return --module_ref_count_; +} + +bool TestingBrowserProcess::IsShuttingDown() { + return false; +} + +printing::PrintJobManager* TestingBrowserProcess::print_job_manager() { + return NULL; +} + +printing::PrintPreviewTabController* +TestingBrowserProcess::print_preview_tab_controller() { + return NULL; +} + +const std::string& TestingBrowserProcess::GetApplicationLocale() { + return app_locale_; +} + +void TestingBrowserProcess::SetApplicationLocale( + const std::string& app_locale) { + app_locale_ = app_locale; +} + +DownloadStatusUpdater* TestingBrowserProcess::download_status_updater() { + return NULL; +} + +base::WaitableEvent* TestingBrowserProcess::shutdown_event() { + return shutdown_event_.get(); +} + +bool TestingBrowserProcess::have_inspector_files() const { + return true; +} + +void TestingBrowserProcess::SetPrefService(PrefService* pref_service) { + pref_service_ = pref_service; +} + +void TestingBrowserProcess::SetGoogleURLTracker( + GoogleURLTracker* google_url_tracker) { + google_url_tracker_.reset(google_url_tracker); +} diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h index 25fe4cb..6945f31 100644 --- a/chrome/test/testing_browser_process.h +++ b/chrome/test/testing_browser_process.h @@ -15,184 +15,102 @@ #include <string> -#include "base/string_util.h" -#include "base/synchronization/waitable_event.h" +#include "base/scoped_ptr.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/google/google_url_tracker.h" -#include "chrome/browser/policy/configuration_policy_pref_store.h" -#include "chrome/browser/policy/configuration_policy_provider.h" -#include "chrome/browser/policy/configuration_policy_provider_keeper.h" -#include "chrome/browser/policy/dummy_configuration_policy_provider.h" -#include "chrome/browser/prefs/pref_service.h" #include "chrome/common/notification_service.h" -#include "ui/base/clipboard/clipboard.h" class IOThread; +class GoogleURLTracker; +class PrefService; + +namespace base { +class WaitableEvent; +} + +namespace policy { +class ConfigurationPolicyProviderKeeper; +} + +namespace ui { +class Clipboard; +} class TestingBrowserProcess : public BrowserProcess { public: - TestingBrowserProcess() - : shutdown_event_(new base::WaitableEvent(true, false)), - module_ref_count_(0), - app_locale_("en"), - pref_service_(NULL), - created_configuration_policy_provider_keeper_(false) { - } - - virtual ~TestingBrowserProcess() { - } + TestingBrowserProcess(); + virtual ~TestingBrowserProcess(); - virtual void EndSession() { - } + virtual void EndSession(); - virtual ResourceDispatcherHost* resource_dispatcher_host() { - return NULL; - } + virtual ResourceDispatcherHost* resource_dispatcher_host(); - virtual MetricsService* metrics_service() { - return NULL; - } + virtual MetricsService* metrics_service(); - virtual IOThread* io_thread() { - return NULL; - } + virtual IOThread* io_thread(); #if defined(OS_LINUX) - virtual base::Thread* background_x11_thread() { - return NULL; - } + virtual base::Thread* background_x11_thread(); #endif - virtual base::Thread* file_thread() { - return NULL; - } + virtual base::Thread* file_thread(); - virtual base::Thread* db_thread() { - return NULL; - } + virtual base::Thread* db_thread(); - virtual base::Thread* cache_thread() { - return NULL; - } + virtual base::Thread* cache_thread(); - virtual ProfileManager* profile_manager() { - return NULL; - } + virtual ProfileManager* profile_manager(); - virtual PrefService* local_state() { - return pref_service_; - } + virtual PrefService* local_state(); virtual policy::ConfigurationPolicyProviderKeeper* - configuration_policy_provider_keeper() { - if (!created_configuration_policy_provider_keeper_) { - DCHECK(configuration_policy_provider_keeper_.get() == NULL); - created_configuration_policy_provider_keeper_ = true; - const policy::ConfigurationPolicyProvider::PolicyDefinitionList* - policy_list = policy::ConfigurationPolicyPrefStore:: - GetChromePolicyDefinitionList(); - configuration_policy_provider_keeper_.reset( - new policy::ConfigurationPolicyProviderKeeper( - new policy::DummyConfigurationPolicyProvider(policy_list), - new policy::DummyConfigurationPolicyProvider(policy_list), - new policy::DummyConfigurationPolicyProvider(policy_list))); - } - return configuration_policy_provider_keeper_.get(); - } - - virtual IconManager* icon_manager() { - return NULL; - } - - virtual ThumbnailGenerator* GetThumbnailGenerator() { - return NULL; - } - - virtual DevToolsManager* devtools_manager() { - return NULL; - } - - virtual SidebarManager* sidebar_manager() { - return NULL; - } - - virtual TabCloseableStateWatcher* tab_closeable_state_watcher() { - return NULL; - } + configuration_policy_provider_keeper(); + + virtual IconManager* icon_manager(); + + virtual ThumbnailGenerator* GetThumbnailGenerator(); + + virtual DevToolsManager* devtools_manager(); + + virtual SidebarManager* sidebar_manager(); + + virtual TabCloseableStateWatcher* tab_closeable_state_watcher(); virtual safe_browsing::ClientSideDetectionService* - safe_browsing_detection_service() { - return NULL; - } - - virtual ui::Clipboard* clipboard() { - if (!clipboard_.get()) { - // Note that we need a MessageLoop for the next call to work. - clipboard_.reset(new ui::Clipboard); - } - return clipboard_.get(); - } - - virtual NotificationUIManager* notification_ui_manager() { - return NULL; - } - - virtual GoogleURLTracker* google_url_tracker() { - return google_url_tracker_.get(); - } - - virtual IntranetRedirectDetector* intranet_redirect_detector() { - return NULL; - } - - virtual AutomationProviderList* InitAutomationProviderList() { - return NULL; - } + safe_browsing_detection_service(); + + virtual ui::Clipboard* clipboard(); + + virtual NotificationUIManager* notification_ui_manager(); + + virtual GoogleURLTracker* google_url_tracker(); + + virtual IntranetRedirectDetector* intranet_redirect_detector(); + + virtual AutomationProviderList* InitAutomationProviderList(); virtual void InitDevToolsHttpProtocolHandler( const std::string& ip, int port, - const std::string& frontend_url) { - } + const std::string& frontend_url); - virtual void InitDevToolsLegacyProtocolHandler(int port) { - } + virtual void InitDevToolsLegacyProtocolHandler(int port); - virtual unsigned int AddRefModule() { - return ++module_ref_count_; - } - virtual unsigned int ReleaseModule() { - DCHECK(module_ref_count_ > 0); - return --module_ref_count_; - } + virtual unsigned int AddRefModule(); + virtual unsigned int ReleaseModule(); - virtual bool IsShuttingDown() { - return false; - } + virtual bool IsShuttingDown(); - virtual printing::PrintJobManager* print_job_manager() { - return NULL; - } + virtual printing::PrintJobManager* print_job_manager(); - virtual printing::PrintPreviewTabController* print_preview_tab_controller() { - return NULL; - } + virtual printing::PrintPreviewTabController* print_preview_tab_controller(); - virtual const std::string& GetApplicationLocale() { - return app_locale_; - } + virtual const std::string& GetApplicationLocale(); - virtual void SetApplicationLocale(const std::string& app_locale) { - app_locale_ = app_locale; - } + virtual void SetApplicationLocale(const std::string& app_locale); - virtual DownloadStatusUpdater* download_status_updater() { - return NULL; - } + virtual DownloadStatusUpdater* download_status_updater(); - virtual base::WaitableEvent* shutdown_event() { - return shutdown_event_.get(); - } + virtual base::WaitableEvent* shutdown_event(); virtual void CheckForInspectorFiles() {} @@ -200,17 +118,13 @@ class TestingBrowserProcess : public BrowserProcess { virtual void StartAutoupdateTimer() {} #endif - virtual bool have_inspector_files() const { return true; } + virtual bool have_inspector_files() const; #if defined(IPC_MESSAGE_LOG_ENABLED) virtual void SetIPCLoggingEnabled(bool enable) {} #endif - void SetPrefService(PrefService* pref_service) { - pref_service_ = pref_service; - } - void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker) { - google_url_tracker_.reset(google_url_tracker); - } + void SetPrefService(PrefService* pref_service); + void SetGoogleURLTracker(GoogleURLTracker* google_url_tracker); private: NotificationService notification_service_; diff --git a/chrome/test/unit/chrome_test_suite.cc b/chrome/test/unit/chrome_test_suite.cc index 10812d4..ec13209 100644 --- a/chrome/test/unit/chrome_test_suite.cc +++ b/chrome/test/unit/chrome_test_suite.cc @@ -9,6 +9,7 @@ #include "base/mac/scoped_nsautorelease_pool.h" #include "base/metrics/stats_table.h" #include "base/process_util.h" +#include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_constants.h" diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.cc b/gpu/command_buffer/service/gles2_cmd_decoder_mock.cc new file mode 100644 index 0000000..a8e027d --- /dev/null +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.cc @@ -0,0 +1,21 @@ +// 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 "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" + +namespace gpu { +namespace gles2 { + +MockGLES2Decoder::MockGLES2Decoder() + : GLES2Decoder() { + ON_CALL(*this, GetCommandName(testing::_)) + .WillByDefault(testing::Return("")); + ON_CALL(*this, MakeCurrent()) + .WillByDefault(testing::Return(true)); +} + +MockGLES2Decoder::~MockGLES2Decoder() {} + +} // namespace gles2 +} // namespace gpu diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index a0d91c9..0282709 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.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. @@ -22,13 +22,8 @@ namespace gles2 { class ContextGroup; class MockGLES2Decoder : public GLES2Decoder { public: - MockGLES2Decoder() - : GLES2Decoder() { - ON_CALL(*this, GetCommandName(testing::_)) - .WillByDefault(testing::Return("")); - ON_CALL(*this, MakeCurrent()) - .WillByDefault(testing::Return(true)); - } + MockGLES2Decoder(); + virtual ~MockGLES2Decoder(); MOCK_METHOD6(Initialize, bool(gfx::GLContext* context, const gfx::Size& size, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index bf108cc..7125745 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -32,6 +32,19 @@ using ::testing::StrictMock; namespace gpu { namespace gles2 { +GLES2DecoderTestBase::GLES2DecoderTestBase() + : client_buffer_id_(100), + client_framebuffer_id_(101), + client_program_id_(102), + client_renderbuffer_id_(103), + client_shader_id_(104), + client_texture_id_(106), + client_element_buffer_id_(107) { + memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); +} + +GLES2DecoderTestBase::~GLES2DecoderTestBase() {} + void GLES2DecoderTestBase::SetUp() { InitDecoder(""); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h index fb85f6dd..1a1cb51 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h @@ -26,16 +26,8 @@ namespace gles2 { class GLES2DecoderTestBase : public testing::Test { public: - GLES2DecoderTestBase() - : client_buffer_id_(100), - client_framebuffer_id_(101), - client_program_id_(102), - client_renderbuffer_id_(103), - client_shader_id_(104), - client_texture_id_(106), - client_element_buffer_id_(107) { - memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); - } + GLES2DecoderTestBase(); + virtual ~GLES2DecoderTestBase(); protected: static const GLint kMaxTextureSize = 2048; diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index 9dad6cf..87b17a7 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -320,6 +320,8 @@ 'sources': [ 'command_buffer/common/gl_mock.h', 'command_buffer/common/gl_mock.cc', + 'command_buffer/service/gles2_cmd_decoder_mock.cc', + 'command_buffer/service/gles2_cmd_decoder_mock.cc', ], }, { diff --git a/media/tools/omx_test/file_reader_util.cc b/media/tools/omx_test/file_reader_util.cc index 1ba7cea..a599d2f 100644 --- a/media/tools/omx_test/file_reader_util.cc +++ b/media/tools/omx_test/file_reader_util.cc @@ -46,6 +46,8 @@ YuvFileReader::YuvFileReader(const FilePath& path, output_nv21_(enable_csc) { } +YuvFileReader::~YuvFileReader() {} + void YuvFileReader::Read(uint8** output, int* size) { if (!file()) { *size = 0; @@ -230,6 +232,8 @@ H264FileReader::H264FileReader(const FilePath& path) used_(0) { } +H264FileReader::~H264FileReader() {} + void H264FileReader::Read(uint8** output, int *size) { // Fill the buffer when it's less than half full. int read = 0; diff --git a/media/tools/omx_test/file_reader_util.h b/media/tools/omx_test/file_reader_util.h index 4bd028f..01216e8 100644 --- a/media/tools/omx_test/file_reader_util.h +++ b/media/tools/omx_test/file_reader_util.h @@ -61,6 +61,8 @@ class YuvFileReader : public BasicFileReader { int height, int loop_count, bool output_nv21); + virtual ~YuvFileReader(); + virtual void Read(uint8** output, int* size); private: @@ -105,6 +107,7 @@ class FFmpegFileReader : public FileReader { class H264FileReader : public BasicFileReader { public: explicit H264FileReader(const FilePath& path); + virtual ~H264FileReader(); virtual void Read(uint8** output, int* size); private: diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index 2a4be8c..a72b504 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -6,10 +6,10 @@ #include "remoting/host/capturer_fake.h" #include "remoting/host/chromoting_host.h" #include "remoting/host/chromoting_host_context.h" +#include "remoting/host/host_mock_objects.h" #include "remoting/host/in_memory_host_config.h" -#include "remoting/host/mock_objects.h" #include "remoting/proto/video.pb.h" -#include "remoting/protocol/mock_objects.h" +#include "remoting/protocol/protocol_mock_objects.h" #include "remoting/protocol/session_config.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/remoting/host/host_mock_objects.cc b/remoting/host/host_mock_objects.cc new file mode 100644 index 0000000..8cfddec --- /dev/null +++ b/remoting/host/host_mock_objects.cc @@ -0,0 +1,17 @@ +// 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/host/host_mock_objects.h" + +namespace remoting { + +MockCapturer::MockCapturer() : Capturer(NULL) {} + +MockCapturer::~MockCapturer() {} + +MockChromotingHostContext::MockChromotingHostContext() {} + +MockChromotingHostContext::~MockChromotingHostContext() {} + +} // namespace remoting diff --git a/remoting/host/mock_objects.h b/remoting/host/host_mock_objects.h index 1c705d4..de1fe72 100644 --- a/remoting/host/mock_objects.h +++ b/remoting/host/host_mock_objects.h @@ -1,9 +1,9 @@ -// 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. -#ifndef REMOTING_HOST_MOCK_OBJECTS_H_ -#define REMOTING_HOST_MOCK_OBJECTS_H_ +#ifndef REMOTING_HOST_HOST_MOCK_OBJECTS_H_ +#define REMOTING_HOST_HOST_MOCK_OBJECTS_H_ #include "remoting/host/capturer.h" #include "remoting/host/chromoting_host_context.h" @@ -13,7 +13,8 @@ namespace remoting { class MockCapturer : public Capturer { public: - MockCapturer() : Capturer(NULL) {} + MockCapturer(); + virtual ~MockCapturer(); MOCK_METHOD0(ScreenConfigurationChanged, void()); MOCK_METHOD1(InvalidateRects, void(const InvalidRects& inval_rects)); @@ -31,7 +32,8 @@ class MockCapturer : public Capturer { class MockChromotingHostContext : public ChromotingHostContext { public: - MockChromotingHostContext() {} + MockChromotingHostContext(); + virtual ~MockChromotingHostContext(); MOCK_METHOD0(Start, void()); MOCK_METHOD0(Stop, void()); @@ -46,4 +48,4 @@ class MockChromotingHostContext : public ChromotingHostContext { } // namespace remoting -#endif // REMOTING_HOST_MOCK_OBJECTS_H_ +#endif // REMOTING_HOST_HOST_MOCK_OBJECTS_H_ diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index 6f61051..ebf484b 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -5,10 +5,10 @@ #include "base/message_loop.h" #include "base/task.h" #include "remoting/base/mock_objects.h" -#include "remoting/host/mock_objects.h" +#include "remoting/host/host_mock_objects.h" #include "remoting/host/screen_recorder.h" #include "remoting/proto/video.pb.h" -#include "remoting/protocol/mock_objects.h" +#include "remoting/protocol/protocol_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/remoting/jingle_glue/jingle_glue_mock_objects.cc b/remoting/jingle_glue/jingle_glue_mock_objects.cc new file mode 100644 index 0000000..4ec59e7 --- /dev/null +++ b/remoting/jingle_glue/jingle_glue_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/jingle_glue/jingle_glue_mock_objects.h" + +namespace remoting { + +MockStream::MockStream() {} + +MockStream::~MockStream() {} + +} // namespace remoting diff --git a/remoting/jingle_glue/mock_objects.h b/remoting/jingle_glue/jingle_glue_mock_objects.h index 08e3cea..505e563 100644 --- a/remoting/jingle_glue/mock_objects.h +++ b/remoting/jingle_glue/jingle_glue_mock_objects.h @@ -1,9 +1,9 @@ -// 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. -#ifndef REMOTING_JINGLE_GLUE_MOCK_OBJECTS_H_ -#define REMOTING_JINGLE_GLUE_MOCK_OBJECTS_H_ +#ifndef REMOTING_JINGLE_GLUE_JINGLE_GLUE_MOCK_OBJECTS_H_ +#define REMOTING_JINGLE_GLUE_JINGLE_GLUE_MOCK_OBJECTS_H_ #include "testing/gmock/include/gmock/gmock.h" #include "third_party/libjingle/source/talk/base/stream.h" @@ -12,7 +12,8 @@ namespace remoting { class MockStream : public talk_base::StreamInterface { public: - virtual ~MockStream() { } + MockStream(); + virtual ~MockStream(); MOCK_CONST_METHOD0(GetState, talk_base::StreamState()); @@ -28,4 +29,4 @@ class MockStream : public talk_base::StreamInterface { } // namespace remoting -#endif // REMOTING_JINGLE_GLUE_MOCK_OBJECTS_H_ +#endif // REMOTING_JINGLE_GLUE_JINGLE_GLUE_MOCK_OBJECTS_H_ diff --git a/remoting/jingle_glue/stream_socket_adapter_unittest.cc b/remoting/jingle_glue/stream_socket_adapter_unittest.cc index 01997dc..3a7df0f 100644 --- a/remoting/jingle_glue/stream_socket_adapter_unittest.cc +++ b/remoting/jingle_glue/stream_socket_adapter_unittest.cc @@ -9,7 +9,7 @@ #include "net/base/net_errors.h" #include "net/socket/socket.h" #include "remoting/jingle_glue/stream_socket_adapter.h" -#include "remoting/jingle_glue/mock_objects.h" +#include "remoting/jingle_glue/jingle_glue_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libjingle/source/talk/p2p/base/transportchannel.h" diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc index 1420392..42ac018 100644 --- a/remoting/protocol/connection_to_client_unittest.cc +++ b/remoting/protocol/connection_to_client_unittest.cc @@ -6,7 +6,7 @@ #include "remoting/base/mock_objects.h" #include "remoting/protocol/fake_session.h" #include "remoting/protocol/connection_to_client.h" -#include "remoting/protocol/mock_objects.h" +#include "remoting/protocol/protocol_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" using ::testing::_; diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc new file mode 100644 index 0000000..8b38954 --- /dev/null +++ b/remoting/protocol/protocol_mock_objects.cc @@ -0,0 +1,39 @@ +// 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/protocol/protocol_mock_objects.h" + +namespace remoting { +namespace protocol { + +MockConnectionToClient::MockConnectionToClient() {} + +MockConnectionToClient::~MockConnectionToClient() {} + +MockConnectionToClientEventHandler::MockConnectionToClientEventHandler() {} + +MockConnectionToClientEventHandler::~MockConnectionToClientEventHandler() {} + +MockInputStub::MockInputStub() {} + +MockInputStub::~MockInputStub() {} + +MockHostStub::MockHostStub() {} + +MockHostStub::~MockHostStub() {} + +MockClientStub::MockClientStub() {} + +MockClientStub::~MockClientStub() {} + +MockVideoStub::MockVideoStub() {} + +MockVideoStub::~MockVideoStub() {} + +MockSession::MockSession() {} + +MockSession::~MockSession() {} + +} // namespace protocol +} // namespace remoting diff --git a/remoting/protocol/mock_objects.h b/remoting/protocol/protocol_mock_objects.h index c1535d1..e9dd57e 100644 --- a/remoting/protocol/mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h @@ -1,9 +1,9 @@ -// 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. -#ifndef REMOTING_PROTOCOL_MOCK_OBJECTS_H_ -#define REMOTING_PROTOCOL_MOCK_OBJECTS_H_ +#ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ +#define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ #include "remoting/proto/internal.pb.h" #include "remoting/protocol/client_stub.h" @@ -21,7 +21,8 @@ class ChromotocolConnection; class MockConnectionToClient : public ConnectionToClient { public: - MockConnectionToClient() {} + MockConnectionToClient(); + virtual ~MockConnectionToClient(); MOCK_METHOD1(Init, void(Session* session)); MOCK_METHOD0(video_stub, VideoStub*()); @@ -34,9 +35,10 @@ class MockConnectionToClient : public ConnectionToClient { }; class MockConnectionToClientEventHandler : - public ConnectionToClient::EventHandler { + public ConnectionToClient::EventHandler { public: - MockConnectionToClientEventHandler() {} + MockConnectionToClientEventHandler(); + virtual ~MockConnectionToClientEventHandler(); MOCK_METHOD1(OnConnectionOpened, void(ConnectionToClient* connection)); MOCK_METHOD1(OnConnectionClosed, void(ConnectionToClient* connection)); @@ -48,7 +50,8 @@ class MockConnectionToClientEventHandler : class MockInputStub : public InputStub { public: - MockInputStub() {} + MockInputStub(); + virtual ~MockInputStub(); MOCK_METHOD2(InjectKeyEvent, void(const KeyEvent* event, Task* done)); MOCK_METHOD2(InjectMouseEvent, void(const MouseEvent* event, Task* done)); @@ -59,7 +62,8 @@ class MockInputStub : public InputStub { class MockHostStub : public HostStub { public: - MockHostStub() {} + MockHostStub(); + ~MockHostStub(); MOCK_METHOD2(SuggestResolution, void(const SuggestResolutionRequest* msg, Task* done)); @@ -72,7 +76,8 @@ class MockHostStub : public HostStub { class MockClientStub : public ClientStub { public: - MockClientStub() {} + MockClientStub(); + virtual ~MockClientStub(); MOCK_METHOD2(NotifyResolution, void(const NotifyResolutionRequest* msg, Task* done)); @@ -85,7 +90,8 @@ class MockClientStub : public ClientStub { class MockVideoStub : public VideoStub { public: - MockVideoStub() {} + MockVideoStub(); + virtual ~MockVideoStub(); MOCK_METHOD2(ProcessVideoPacket, void(const VideoPacket* video_packet, Task* done)); @@ -97,7 +103,8 @@ class MockVideoStub : public VideoStub { class MockSession : public Session { public: - MockSession() {} + MockSession(); + virtual ~MockSession(); MOCK_METHOD1(SetStateChangeCallback, void(StateChangeCallback* callback)); MOCK_METHOD0(control_channel, net::Socket*()); @@ -123,4 +130,4 @@ class MockSession : public Session { } // namespace protocol } // namespace remoting -#endif // REMOTING_PROTOCOL_MOCK_OBJECTS_H_ +#endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 88b75ce..0ee8142 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -468,19 +468,21 @@ 'host/access_verifier_unittest.cc', 'host/chromoting_host_context_unittest.cc', 'host/chromoting_host_unittest.cc', - 'host/differ_unittest.cc', 'host/differ_block_unittest.cc', + 'host/differ_unittest.cc', 'host/heartbeat_sender_unittest.cc', 'host/host_key_pair_unittest.cc', + 'host/host_mock_objects.cc', + 'host/host_mock_objects.h', 'host/json_host_config_unittest.cc', - 'host/mock_objects.h', 'host/screen_recorder_unittest.cc', 'host/test_key_pair.h', 'jingle_glue/channel_socket_adapter_unittest.cc', + 'jingle_glue/iq_request_unittest.cc', 'jingle_glue/jingle_client_unittest.cc', + 'jingle_glue/jingle_glue_mock_objects.cc', + 'jingle_glue/jingle_glue_mock_objects.h', 'jingle_glue/jingle_thread_unittest.cc', - 'jingle_glue/iq_request_unittest.cc', - 'jingle_glue/mock_objects.h', 'jingle_glue/stream_socket_adapter_unittest.cc', 'protocol/connection_to_client_unittest.cc', 'protocol/fake_session.cc', @@ -488,7 +490,8 @@ 'protocol/jingle_session_unittest.cc', 'protocol/message_decoder_unittest.cc', 'protocol/message_reader_unittest.cc', - 'protocol/mock_objects.h', + 'protocol/protocol_mock_objects.cc', + 'protocol/protocol_mock_objects.h', 'protocol/rtp_video_reader_unittest.cc', 'protocol/rtp_video_writer_unittest.cc', 'protocol/session_manager_pair.cc', |