| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/policy/mock_device_management_backend.h" | 5 #include "chrome/browser/policy/mock_device_management_backend.h" |
| 6 #include "chrome/browser/policy/proto/device_management_constants.h" |
| 6 | 7 |
| 7 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 static const char kFakeDeviceManagementToken[] = "FAKE_DEVICE_TOKEN_"; | 14 static const char kFakeDeviceManagementToken[] = "FAKE_DEVICE_TOKEN_"; |
| 14 static char next_token_suffix_ = '0'; | 15 static char next_token_suffix_ = '0'; |
| 15 | 16 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 26 using em::DeviceRegisterResponse; | 27 using em::DeviceRegisterResponse; |
| 27 using em::DeviceUnregisterResponse; | 28 using em::DeviceUnregisterResponse; |
| 28 using em::DevicePolicyResponse; | 29 using em::DevicePolicyResponse; |
| 29 | 30 |
| 30 MockDeviceManagementBackend::MockDeviceManagementBackend() | 31 MockDeviceManagementBackend::MockDeviceManagementBackend() |
| 31 : DeviceManagementBackend(), | 32 : DeviceManagementBackend(), |
| 32 policy_remaining_fail_count_(0), | 33 policy_remaining_fail_count_(0), |
| 33 register_remaining_fail_count_(0), | 34 register_remaining_fail_count_(0), |
| 34 policy_remaining_success_count_(0) { | 35 policy_remaining_success_count_(0) { |
| 35 policy_setting_ = policy_response_.add_setting(); | 36 policy_setting_ = policy_response_.add_setting(); |
| 36 policy_setting_->set_policy_key("chrome-policy"); | 37 policy_setting_->set_policy_key(kChromeDevicePolicySettingKey); |
| 37 policy_setting_->set_watermark("fresh"); | 38 policy_setting_->set_watermark("fresh"); |
| 38 } | 39 } |
| 39 | 40 |
| 40 MockDeviceManagementBackend::~MockDeviceManagementBackend() { | 41 MockDeviceManagementBackend::~MockDeviceManagementBackend() { |
| 41 } | 42 } |
| 42 | 43 |
| 43 void MockDeviceManagementBackend::AllShouldSucceed() { | 44 void MockDeviceManagementBackend::AllShouldSucceed() { |
| 44 ON_CALL(*this, ProcessRegisterRequest(_, _, _, _)). | 45 ON_CALL(*this, ProcessRegisterRequest(_, _, _, _)). |
| 45 WillByDefault(Invoke( | 46 WillByDefault(Invoke( |
| 46 this, | 47 this, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 155 |
| 155 void MockDeviceManagementBackend::SimulateUnmanagedRegisterRequest( | 156 void MockDeviceManagementBackend::SimulateUnmanagedRegisterRequest( |
| 156 const std::string& auth_token, | 157 const std::string& auth_token, |
| 157 const std::string& device_id, | 158 const std::string& device_id, |
| 158 const em::DeviceRegisterRequest& request, | 159 const em::DeviceRegisterRequest& request, |
| 159 DeviceRegisterResponseDelegate* delegate) { | 160 DeviceRegisterResponseDelegate* delegate) { |
| 160 delegate->OnError(kErrorServiceManagementNotSupported); | 161 delegate->OnError(kErrorServiceManagementNotSupported); |
| 161 } | 162 } |
| 162 | 163 |
| 163 } // namespace | 164 } // namespace |
| OLD | NEW |