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