Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: chrome/browser/policy/asynchronous_policy_test_base.h

Issue 10384145: Removed ConfigurationPolicyProvider::Provide(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/asynchronous_policy_test_base.h
diff --git a/chrome/browser/policy/asynchronous_policy_test_base.h b/chrome/browser/policy/asynchronous_policy_test_base.h
index 887f21da8796541db5a7b3ec8ea43741e45a15b3..d4fad7a6ce7ed266b05dc1a89c3fc663ff51d4cb 100644
--- a/chrome/browser/policy/asynchronous_policy_test_base.h
+++ b/chrome/browser/policy/asynchronous_policy_test_base.h
@@ -16,7 +16,7 @@
namespace policy {
-class PolicyMap;
+class PolicyBundle;
// A delegate for testing that can feed arbitrary information to the loader.
class ProviderDelegateMock : public AsynchronousPolicyProvider::Delegate {
@@ -24,7 +24,19 @@ class ProviderDelegateMock : public AsynchronousPolicyProvider::Delegate {
ProviderDelegateMock();
virtual ~ProviderDelegateMock();
- MOCK_METHOD0(Load, PolicyMap*());
+ // Load() returns a scoped_ptr<PolicyBundle> but it can't be mocked because
+ // scoped_ptr is moveable but not copyable. This override forwards the
+ // call to MockLoad() which returns a PolicyBundle*, and returns a copy
+ // wrapped in a passed scoped_ptr.
+ virtual scoped_ptr<PolicyBundle> Load() OVERRIDE {
+ scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
+ PolicyBundle* loaded = MockLoad();
+ if (loaded)
+ bundle->CopyFrom(*loaded);
Mattias Nissler (ping if slow) 2012/05/15 17:07:24 nit: Can we return NULL if loaded == NULL?
Joao da Silva 2012/05/16 10:25:44 Yes, it will be passed along to ConfigurationPolic
+ return bundle.Pass();
+ }
+
+ MOCK_METHOD0(MockLoad, PolicyBundle*());
private:
DISALLOW_COPY_AND_ASSIGN(ProviderDelegateMock);

Powered by Google App Engine
This is Rietveld 408576698