OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_policy_test_helper.h" | 5 #include "chrome/browser/chromeos/policy/user_policy_test_helper.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 profile); | 95 profile); |
96 | 96 |
97 // Give a bogus OAuth token to the |policy_manager|. This should make its | 97 // Give a bogus OAuth token to the |policy_manager|. This should make its |
98 // CloudPolicyClient fetch the DMToken. | 98 // CloudPolicyClient fetch the DMToken. |
99 ASSERT_FALSE(policy_manager->core()->client()->is_registered()); | 99 ASSERT_FALSE(policy_manager->core()->client()->is_registered()); |
100 const enterprise_management::DeviceRegisterRequest::Type registration_type = | 100 const enterprise_management::DeviceRegisterRequest::Type registration_type = |
101 enterprise_management::DeviceRegisterRequest::USER; | 101 enterprise_management::DeviceRegisterRequest::USER; |
102 policy_manager->core()->client()->Register( | 102 policy_manager->core()->client()->Register( |
103 registration_type, | 103 registration_type, |
104 enterprise_management::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, | 104 enterprise_management::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, |
105 "bogus", std::string(), std::string(), std::string()); | 105 enterprise_management::LicenseType::UNDEFINED, "bogus", std::string(), |
| 106 std::string(), std::string()); |
106 | 107 |
107 policy::ProfilePolicyConnector* const profile_connector = | 108 policy::ProfilePolicyConnector* const profile_connector = |
108 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile); | 109 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile); |
109 policy::PolicyService* const policy_service = | 110 policy::PolicyService* const policy_service = |
110 profile_connector->policy_service(); | 111 profile_connector->policy_service(); |
111 | 112 |
112 base::RunLoop run_loop; | 113 base::RunLoop run_loop; |
113 policy_service->RefreshPolicies(run_loop.QuitClosure()); | 114 policy_service->RefreshPolicies(run_loop.QuitClosure()); |
114 run_loop.Run(); | 115 run_loop.Run(); |
115 } | 116 } |
(...skipping 26 matching lines...) Expand all Loading... |
142 const int bytes_written = | 143 const int bytes_written = |
143 base::WriteFile(PolicyFilePath(), policy.data(), policy.size()); | 144 base::WriteFile(PolicyFilePath(), policy.data(), policy.size()); |
144 ASSERT_EQ(static_cast<int>(policy.size()), bytes_written); | 145 ASSERT_EQ(static_cast<int>(policy.size()), bytes_written); |
145 } | 146 } |
146 | 147 |
147 base::FilePath UserPolicyTestHelper::PolicyFilePath() const { | 148 base::FilePath UserPolicyTestHelper::PolicyFilePath() const { |
148 return temp_dir_.GetPath().AppendASCII("policy.json"); | 149 return temp_dir_.GetPath().AppendASCII("policy.json"); |
149 } | 150 } |
150 | 151 |
151 } // namespace policy | 152 } // namespace policy |
OLD | NEW |