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

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

Issue 12209070: Fix cloud policy duplicate registrations issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 10 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/test_utils.cc
diff --git a/chrome/browser/policy/test_utils.cc b/chrome/browser/policy/test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..41662a83d72c4251c1accd377b22f8b5cf2496ea
--- /dev/null
+++ b/chrome/browser/policy/test_utils.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2013 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/test_utils.h"
+
+#include <string>
+
+#include "base/logging.h"
+#include "base/values.h"
+#include "chrome/browser/policy/policy_map.h"
+#include "chrome/browser/policy/policy_service.h"
+
+namespace policy {
+
+bool PolicyServiceIsEmpty(const PolicyService* service) {
+ const PolicyMap& map = service->GetPolicies(
+ PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
+ if (!map.empty()) {
+ base::DictionaryValue dict;
+ for (PolicyMap::const_iterator it = map.begin(); it != map.end(); ++it)
+ dict.SetWithoutPathExpansion(it->first, it->second.value->DeepCopy());
+ LOG(WARNING) << "There are pre-existing policies in this machine: " << dict;
+ }
+ return map.empty();
+}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698