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