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

Unified Diff: chrome/browser/policy/mock_configuration_policy_provider.cc

Issue 99333002: Revert of Move ConfigurationPolicyProvider, etc. to components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/mock_configuration_policy_provider.cc
diff --git a/chrome/browser/policy/mock_configuration_policy_provider.cc b/chrome/browser/policy/mock_configuration_policy_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..960f3e320478b5aeb59f0ebd85d5d9b5e0d8abeb
--- /dev/null
+++ b/chrome/browser/policy/mock_configuration_policy_provider.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 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_configuration_policy_provider.h"
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "components/policy/core/common/policy_bundle.h"
+
+using testing::Invoke;
+
+namespace policy {
+
+MockConfigurationPolicyProvider::MockConfigurationPolicyProvider() {}
+
+MockConfigurationPolicyProvider::~MockConfigurationPolicyProvider() {}
+
+void MockConfigurationPolicyProvider::UpdateChromePolicy(
+ const PolicyMap& policy) {
+ scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
+ bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
+ .CopyFrom(policy);
+ UpdatePolicy(bundle.Pass());
+ if (base::MessageLoop::current())
+ base::RunLoop().RunUntilIdle();
+}
+
+void MockConfigurationPolicyProvider::SetAutoRefresh() {
+ EXPECT_CALL(*this, RefreshPolicies()).WillRepeatedly(
+ Invoke(this, &MockConfigurationPolicyProvider::RefreshWithSamePolicies));
+}
+
+void MockConfigurationPolicyProvider::RefreshWithSamePolicies() {
+ scoped_ptr<PolicyBundle> bundle(new PolicyBundle);
+ bundle->CopyFrom(policies());
+ UpdatePolicy(bundle.Pass());
+}
+
+MockConfigurationPolicyObserver::MockConfigurationPolicyObserver() {}
+
+MockConfigurationPolicyObserver::~MockConfigurationPolicyObserver() {}
+
+} // namespace policy
« no previous file with comments | « chrome/browser/policy/mock_configuration_policy_provider.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698