diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 17:56:39 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 17:56:39 +0000 |
commit | 3339229822e7af543067d5267d3b9795bd6e4485 (patch) | |
tree | 76d893bdea7b1895303aad3c265cbb0946c5154f /chrome/browser/prefs | |
parent | 8cb02edc531a8334b2bd48087a91b4cbdf40c2d7 (diff) | |
download | chromium_src-3339229822e7af543067d5267d3b9795bd6e4485.zip chromium_src-3339229822e7af543067d5267d3b9795bd6e4485.tar.gz chromium_src-3339229822e7af543067d5267d3b9795bd6e4485.tar.bz2 |
Move lots of GMock stuff out of line.
Nico did some treemapping of our build time on Mac, and (surprise!) gmock
unittests dominated. Gmock works with several large, heavy templates, and previous patches that out of line the ctors/dtors have significantly sped up compilation (e.g.GLMock) and have reduced thrashing.
Nico says I should plug this again: http://www.chromium.org/developers/coding-style/cpp-dos-and-donts
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6056008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs')
-rw-r--r-- | chrome/browser/prefs/pref_observer_mock.cc | 19 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_observer_mock.h | 14 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service_mock_builder.cc | 4 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service_mock_builder.h | 3 |
4 files changed, 28 insertions, 12 deletions
diff --git a/chrome/browser/prefs/pref_observer_mock.cc b/chrome/browser/prefs/pref_observer_mock.cc new file mode 100644 index 0000000..a41ed5c --- /dev/null +++ b/chrome/browser/prefs/pref_observer_mock.cc @@ -0,0 +1,19 @@ +// 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/prefs/pref_observer_mock.h" + +PrefObserverMock::PrefObserverMock() {} + +PrefObserverMock::~PrefObserverMock() {} + +void PrefObserverMock::Expect(const PrefService* prefs, + const std::string& pref_name, + const Value* value) { + EXPECT_CALL(*this, Observe(NotificationType(NotificationType::PREF_CHANGED), + Source<PrefService>(prefs), + Property(&Details<std::string>::ptr, + Pointee(pref_name)))) + .With(PrefValueMatches(prefs, pref_name, value)); +} diff --git a/chrome/browser/prefs/pref_observer_mock.h b/chrome/browser/prefs/pref_observer_mock.h index f339841..0c651ca 100644 --- a/chrome/browser/prefs/pref_observer_mock.h +++ b/chrome/browser/prefs/pref_observer_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. @@ -39,8 +39,8 @@ MATCHER_P3(PrefValueMatches, prefs, pref_name, value, "") { // A mock for testing preference notifications and easy setup of expectations. class PrefObserverMock : public NotificationObserver { public: - PrefObserverMock() {} - virtual ~PrefObserverMock() {} + PrefObserverMock(); + virtual ~PrefObserverMock(); MOCK_METHOD3(Observe, void(NotificationType type, const NotificationSource& source, @@ -48,13 +48,7 @@ class PrefObserverMock : public NotificationObserver { void Expect(const PrefService* prefs, const std::string& pref_name, - const Value* value) { - EXPECT_CALL(*this, Observe(NotificationType(NotificationType::PREF_CHANGED), - Source<PrefService>(prefs), - Property(&Details<std::string>::ptr, - Pointee(pref_name)))) - .With(PrefValueMatches(prefs, pref_name, value)); - } + const Value* value); }; #endif // CHROME_BROWSER_PREFS_PREF_OBSERVER_MOCK_H_ diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc index 005b700..b02a334 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.cc +++ b/chrome/browser/prefs/pref_service_mock_builder.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,8 @@ PrefServiceMockBuilder::PrefServiceMockBuilder() : user_prefs_(new TestingPrefStore) { } +PrefServiceMockBuilder::~PrefServiceMockBuilder() {} + PrefServiceMockBuilder& PrefServiceMockBuilder::WithManagedPlatformPrefs(PrefStore* store) { managed_platform_prefs_.reset(store); diff --git a/chrome/browser/prefs/pref_service_mock_builder.h b/chrome/browser/prefs/pref_service_mock_builder.h index b8e32755..9cc4fcc 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.h +++ b/chrome/browser/prefs/pref_service_mock_builder.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. @@ -24,6 +24,7 @@ class ConfigurationPolicyProvider; class PrefServiceMockBuilder { public: PrefServiceMockBuilder(); + ~PrefServiceMockBuilder(); // Functions for setting the various parameters of the PrefService to build. // These take ownership of the |store| parameter. |