| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // Give a bogus OAuth token to the |policy_manager|. This should make its | 127 // Give a bogus OAuth token to the |policy_manager|. This should make its |
| 128 // CloudPolicyClient fetch the DMToken. | 128 // CloudPolicyClient fetch the DMToken. |
| 129 em::DeviceRegisterRequest::Type registration_type = | 129 em::DeviceRegisterRequest::Type registration_type = |
| 130 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
| 131 em::DeviceRegisterRequest::USER; | 131 em::DeviceRegisterRequest::USER; |
| 132 #else | 132 #else |
| 133 em::DeviceRegisterRequest::BROWSER; | 133 em::DeviceRegisterRequest::BROWSER; |
| 134 #endif | 134 #endif |
| 135 policy_manager()->core()->client()->Register( | 135 policy_manager()->core()->client()->Register( |
| 136 registration_type, em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, | 136 registration_type, em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, |
| 137 "bogus", std::string(), std::string(), std::string()); | 137 em::LicenseType::UNDEFINED, "bogus", std::string(), std::string(), |
| 138 std::string()); |
| 138 run_loop.Run(); | 139 run_loop.Run(); |
| 139 Mock::VerifyAndClearExpectations(&observer); | 140 Mock::VerifyAndClearExpectations(&observer); |
| 140 policy_manager()->core()->client()->RemoveObserver(&observer); | 141 policy_manager()->core()->client()->RemoveObserver(&observer); |
| 141 } | 142 } |
| 142 | 143 |
| 143 std::unique_ptr<TestRequestInterceptor> interceptor_; | 144 std::unique_ptr<TestRequestInterceptor> interceptor_; |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 IN_PROC_BROWSER_TEST_F(CloudPolicyManagerTest, Register) { | 147 IN_PROC_BROWSER_TEST_F(CloudPolicyManagerTest, Register) { |
| 147 // Accept one register request. The initial request should not include the | 148 // Accept one register request. The initial request should not include the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const bool expect_reregister = true; | 198 const bool expect_reregister = true; |
| 198 interceptor_->PushJobCallback( | 199 interceptor_->PushJobCallback( |
| 199 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); | 200 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); |
| 200 | 201 |
| 201 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); | 202 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); |
| 202 ASSERT_NO_FATAL_FAILURE(Register()); | 203 ASSERT_NO_FATAL_FAILURE(Register()); |
| 203 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); | 204 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); |
| 204 } | 205 } |
| 205 | 206 |
| 206 } // namespace policy | 207 } // namespace policy |
| OLD | NEW |