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

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

Issue 12209070: Fix cloud policy duplicate registrations issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « no previous file | chrome/browser/policy/cloud_policy_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/cloud_policy_browsertest.cc
diff --git a/chrome/browser/policy/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud_policy_browsertest.cc
index 7f60752daca242a902cfd54e64df459a5fff6f21..cf2d63f71f27e529a75d643d1efe5af8b0692865 100644
--- a/chrome/browser/policy/cloud_policy_browsertest.cc
+++ b/chrome/browser/policy/cloud_policy_browsertest.cc
@@ -15,10 +15,12 @@
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/policy/cloud_policy_client.h"
#include "chrome/browser/policy/cloud_policy_constants.h"
+#include "chrome/browser/policy/mock_cloud_policy_client.h"
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/policy/proto/chrome_settings.pb.h"
#include "chrome/browser/policy/proto/cloud_policy.pb.h"
+#include "chrome/browser/policy/test_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_notification_types.h"
@@ -54,16 +56,6 @@ namespace policy {
namespace {
-class MockCloudPolicyClientObserver : public CloudPolicyClient::Observer {
- public:
- MockCloudPolicyClientObserver() {}
- virtual ~MockCloudPolicyClientObserver() {}
-
- MOCK_METHOD1(OnPolicyFetched, void(CloudPolicyClient*));
- MOCK_METHOD1(OnRegistrationStateChanged, void(CloudPolicyClient*));
- MOCK_METHOD1(OnClientError, void(CloudPolicyClient*));
-};
-
const char* GetTestUser() {
#if defined(OS_CHROMEOS)
return chromeos::UserManager::kStubUser;
@@ -137,19 +129,8 @@ class CloudPolicyTest : public InProcessBrowserTest {
}
virtual void SetUpOnMainThread() OVERRIDE {
- // Checks that no policies have been loaded by the other providers before
- // setting up the cloud connection. Other policies configured in the test
- // machine will interfere with these tests.
- const PolicyMap& map = g_browser_process->policy_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());
- ADD_FAILURE()
- << "There are pre-existing policies in this machine that will "
- << "interfere with these tests. Policies found: " << dict;
- }
+ ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service()))
+ << "Pre-existing policies in this machine will make this test fail.";
BrowserPolicyConnector* connector =
g_browser_process->browser_policy_connector();
« no previous file with comments | « no previous file | chrome/browser/policy/cloud_policy_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698