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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 factories); 105 factories);
106 // Usually the signin Profile and the main Profile are separate, but since 106 // Usually the signin Profile and the main Profile are separate, but since
107 // the signin Profile is an OTR Profile then for this test it suffices to 107 // the signin Profile is an OTR Profile then for this test it suffices to
108 // attach it to the main Profile. 108 // attach it to the main Profile.
109 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); 109 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_);
110 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); 110 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile());
111 111
112 chrome::RegisterLocalState(prefs_.registry()); 112 chrome::RegisterLocalState(prefs_.registry());
113 113
114 // Set up a policy map for testing. 114 // Set up a policy map for testing.
115 policy_map_.Set(key::kHomepageLocation, 115 policy_map_.SetWithSource(key::kHomepageLocation,
116 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 116 POLICY_LEVEL_MANDATORY,
117 new base::StringValue("http://chromium.org"), 117 POLICY_SCOPE_USER,
118 NULL); 118 new base::StringValue("http://chromium.org"),
119 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, 119 NULL,
bartfab (slow) 2015/09/14 14:42:25 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:04 Done.
120 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 120 POLICY_SOURCE_CLOUD);
bartfab (slow) 2015/09/14 14:42:25 Nit: #include "components/policy/core/common/polic
fhorschig 2015/09/16 13:52:04 Done.
121 new base::StringValue("primary-only"), 121 policy_map_.SetWithSource(key::kChromeOsMultiProfileUserBehavior,
122 NULL); 122 POLICY_LEVEL_MANDATORY,
123 policy_map_.Set(key::kEasyUnlockAllowed, 123 POLICY_SCOPE_USER,
124 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 124 new base::StringValue("primary-only"),
125 new base::FundamentalValue(false), 125 NULL,
bartfab (slow) 2015/09/14 14:42:25 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:04 Done.
126 NULL); 126 POLICY_SOURCE_ENTERPRISE_DEFAULT);
127 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, 127 policy_map_.SetWithSource(key::kEasyUnlockAllowed,
128 POLICY_LEVEL_MANDATORY, 128 POLICY_LEVEL_MANDATORY,
129 POLICY_SCOPE_USER, 129 POLICY_SCOPE_USER,
130 new base::FundamentalValue(false), 130 new base::FundamentalValue(false),
131 NULL); 131 NULL,
bartfab (slow) 2015/09/14 14:42:26 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:04 Done.
132 POLICY_SOURCE_CLOUD);
133 policy_map_.SetWithSource(key::kCaptivePortalAuthenticationIgnoresProxy,
134 POLICY_LEVEL_MANDATORY,
135 POLICY_SCOPE_USER,
136 new base::FundamentalValue(false),
137 NULL,
bartfab (slow) 2015/09/14 14:42:25 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:04 Done.
138 POLICY_SOURCE_CLOUD);
132 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 139 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
133 .CopyFrom(policy_map_); 140 .CopyFrom(policy_map_);
134 141
135 // Create fake policy blobs to deliver to the client. 142 // Create fake policy blobs to deliver to the client.
136 em::DeviceRegisterResponse* register_response = 143 em::DeviceRegisterResponse* register_response =
137 register_blob_.mutable_register_response(); 144 register_blob_.mutable_register_response();
138 register_response->set_device_management_token("dmtoken123"); 145 register_response->set_device_management_token("dmtoken123");
139 146
140 em::CloudPolicySettings policy_proto; 147 em::CloudPolicySettings policy_proto;
141 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org"); 148 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org");
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 595 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
589 EXPECT_TRUE(manager_->core()->client()->is_registered()); 596 EXPECT_TRUE(manager_->core()->client()->is_registered());
590 597
591 // The refresh scheduler takes care of the initial fetch for unmanaged users. 598 // The refresh scheduler takes care of the initial fetch for unmanaged users.
592 // Running the task runner issues the initial fetch. 599 // Running the task runner issues the initial fetch.
593 FetchPolicy( 600 FetchPolicy(
594 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); 601 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_));
595 } 602 }
596 603
597 } // namespace policy 604 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698