| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "chrome/browser/policy/device_management_backend_mock.h" | 6 #include "chrome/browser/policy/device_management_backend_mock.h" |
| 7 #include "chrome/browser/policy/device_management_service.h" | 7 #include "chrome/browser/policy/device_management_service.h" |
| 8 #include "chrome/browser/policy/proto/device_management_constants.h" | 8 #include "chrome/browser/policy/proto/device_management_constants.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "content/public/common/url_fetcher.h" | 10 #include "content/public/common/url_fetcher.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DevicePolicyResponseDelegateMock delegate; | 116 DevicePolicyResponseDelegateMock delegate; |
| 117 EXPECT_CALL(delegate, HandlePolicyResponse(_)) | 117 EXPECT_CALL(delegate, HandlePolicyResponse(_)) |
| 118 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 118 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 119 em::DevicePolicyRequest request; | 119 em::DevicePolicyRequest request; |
| 120 request.set_policy_scope(kChromePolicyScope); | 120 request.set_policy_scope(kChromePolicyScope); |
| 121 em::DevicePolicySettingRequest* setting_request = | 121 em::DevicePolicySettingRequest* setting_request = |
| 122 request.add_setting_request(); | 122 request.add_setting_request(); |
| 123 setting_request->set_key(kChromeDevicePolicySettingKey); | 123 setting_request->set_key(kChromeDevicePolicySettingKey); |
| 124 backend->ProcessPolicyRequest(token_, "testid", | 124 backend->ProcessPolicyRequest(token_, "testid", |
| 125 CloudPolicyDataStore::USER_AFFILIATION_NONE, | 125 CloudPolicyDataStore::USER_AFFILIATION_NONE, |
| 126 request, &delegate); | 126 request, NULL, &delegate); |
| 127 | 127 |
| 128 MessageLoop::current()->Run(); | 128 MessageLoop::current()->Run(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 { | 131 { |
| 132 CannedResponseInterceptor interceptor( | 132 CannedResponseInterceptor interceptor( |
| 133 GURL(kServiceUrl), PROTO_STRING(kServiceResponseUnregister)); | 133 GURL(kServiceUrl), PROTO_STRING(kServiceResponseUnregister)); |
| 134 DeviceUnregisterResponseDelegateMock delegate; | 134 DeviceUnregisterResponseDelegateMock delegate; |
| 135 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) | 135 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) |
| 136 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 136 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 DevicePolicyResponseDelegateMock delegate; | 184 DevicePolicyResponseDelegateMock delegate; |
| 185 EXPECT_CALL(delegate, HandlePolicyResponse(_)) | 185 EXPECT_CALL(delegate, HandlePolicyResponse(_)) |
| 186 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 186 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 187 em::DevicePolicyRequest request; | 187 em::DevicePolicyRequest request; |
| 188 em::PolicyFetchRequest* fetch_request = request.add_request(); | 188 em::PolicyFetchRequest* fetch_request = request.add_request(); |
| 189 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); | 189 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); |
| 190 fetch_request->set_policy_type(kChromeUserPolicyType); | 190 fetch_request->set_policy_type(kChromeUserPolicyType); |
| 191 backend->ProcessPolicyRequest(token_, "testid", | 191 backend->ProcessPolicyRequest(token_, "testid", |
| 192 CloudPolicyDataStore::USER_AFFILIATION_NONE, | 192 CloudPolicyDataStore::USER_AFFILIATION_NONE, |
| 193 request, &delegate); | 193 request, NULL, &delegate); |
| 194 | 194 |
| 195 MessageLoop::current()->Run(); | 195 MessageLoop::current()->Run(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 { | 198 { |
| 199 DeviceUnregisterResponseDelegateMock delegate; | 199 DeviceUnregisterResponseDelegateMock delegate; |
| 200 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) | 200 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) |
| 201 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 201 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 202 em::DeviceUnregisterRequest request; | 202 em::DeviceUnregisterRequest request; |
| 203 backend->ProcessUnregisterRequest(token_, "testid", request, &delegate); | 203 backend->ProcessUnregisterRequest(token_, "testid", request, &delegate); |
| 204 | 204 |
| 205 MessageLoop::current()->Run(); | 205 MessageLoop::current()->Run(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 { | 208 { |
| 209 DeviceAutoEnrollmentResponseDelegateMock delegate; | 209 DeviceAutoEnrollmentResponseDelegateMock delegate; |
| 210 EXPECT_CALL(delegate, HandleAutoEnrollmentResponse(_)) | 210 EXPECT_CALL(delegate, HandleAutoEnrollmentResponse(_)) |
| 211 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 211 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 212 em::DeviceAutoEnrollmentRequest request; | 212 em::DeviceAutoEnrollmentRequest request; |
| 213 request.set_modulus(1); | 213 request.set_modulus(1); |
| 214 request.set_remainder(0); | 214 request.set_remainder(0); |
| 215 backend->ProcessAutoEnrollmentRequest("testid", request, &delegate); | 215 backend->ProcessAutoEnrollmentRequest("testid", request, &delegate); |
| 216 | 216 |
| 217 MessageLoop::current()->Run(); | 217 MessageLoop::current()->Run(); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace policy | 221 } // namespace policy |
| OLD | NEW |