| 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/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DevicePolicyResponseDelegateMock delegate; | 115 DevicePolicyResponseDelegateMock delegate; |
| 116 EXPECT_CALL(delegate, HandlePolicyResponse(_)) | 116 EXPECT_CALL(delegate, HandlePolicyResponse(_)) |
| 117 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 117 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 118 em::DevicePolicyRequest request; | 118 em::DevicePolicyRequest request; |
| 119 request.set_policy_scope(kChromePolicyScope); | 119 request.set_policy_scope(kChromePolicyScope); |
| 120 em::DevicePolicySettingRequest* setting_request = | 120 em::DevicePolicySettingRequest* setting_request = |
| 121 request.add_setting_request(); | 121 request.add_setting_request(); |
| 122 setting_request->set_key(kChromeDevicePolicySettingKey); | 122 setting_request->set_key(kChromeDevicePolicySettingKey); |
| 123 backend->ProcessPolicyRequest(token_, "testid", | 123 backend->ProcessPolicyRequest(token_, "testid", |
| 124 CloudPolicyDataStore::USER_AFFILIATION_NONE, | 124 CloudPolicyDataStore::USER_AFFILIATION_NONE, |
| 125 request, &delegate); | 125 request, NULL, &delegate); |
| 126 | 126 |
| 127 MessageLoop::current()->Run(); | 127 MessageLoop::current()->Run(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 { | 130 { |
| 131 CannedResponseInterceptor interceptor( | 131 CannedResponseInterceptor interceptor( |
| 132 GURL(kServiceUrl), PROTO_STRING(kServiceResponseUnregister)); | 132 GURL(kServiceUrl), PROTO_STRING(kServiceResponseUnregister)); |
| 133 DeviceUnregisterResponseDelegateMock delegate; | 133 DeviceUnregisterResponseDelegateMock delegate; |
| 134 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) | 134 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) |
| 135 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 135 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 DevicePolicyResponseDelegateMock delegate; | 169 DevicePolicyResponseDelegateMock delegate; |
| 170 EXPECT_CALL(delegate, HandlePolicyResponse(_)) | 170 EXPECT_CALL(delegate, HandlePolicyResponse(_)) |
| 171 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 171 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 172 em::DevicePolicyRequest request; | 172 em::DevicePolicyRequest request; |
| 173 em::PolicyFetchRequest* fetch_request = request.add_request(); | 173 em::PolicyFetchRequest* fetch_request = request.add_request(); |
| 174 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); | 174 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); |
| 175 fetch_request->set_policy_type(kChromeUserPolicyType); | 175 fetch_request->set_policy_type(kChromeUserPolicyType); |
| 176 backend->ProcessPolicyRequest(token_, "testid", | 176 backend->ProcessPolicyRequest(token_, "testid", |
| 177 CloudPolicyDataStore::USER_AFFILIATION_NONE, | 177 CloudPolicyDataStore::USER_AFFILIATION_NONE, |
| 178 request, &delegate); | 178 request, NULL, &delegate); |
| 179 | 179 |
| 180 MessageLoop::current()->Run(); | 180 MessageLoop::current()->Run(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 { | 183 { |
| 184 DeviceUnregisterResponseDelegateMock delegate; | 184 DeviceUnregisterResponseDelegateMock delegate; |
| 185 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) | 185 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) |
| 186 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 186 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 187 em::DeviceUnregisterRequest request; | 187 em::DeviceUnregisterRequest request; |
| 188 backend->ProcessUnregisterRequest(token_, "testid", request, &delegate); | 188 backend->ProcessUnregisterRequest(token_, "testid", request, &delegate); |
| 189 | 189 |
| 190 MessageLoop::current()->Run(); | 190 MessageLoop::current()->Run(); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace policy | 194 } // namespace policy |
| OLD | NEW |