| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_service.h" | 5 #include "chrome/browser/policy/mock_device_management_service.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 | 8 |
| 9 using testing::Action; | 9 using testing::Action; |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 // Asynchronous job that allows the test to delay job completion. | 79 // Asynchronous job that allows the test to delay job completion. |
| 80 class AsyncRequestJob : public MockRequestJobBase, | 80 class AsyncRequestJob : public MockRequestJobBase, |
| 81 public MockDeviceManagementJob { | 81 public MockDeviceManagementJob { |
| 82 public: | 82 public: |
| 83 AsyncRequestJob(JobType type, MockDeviceManagementService* service) | 83 AsyncRequestJob(JobType type, MockDeviceManagementService* service) |
| 84 : MockRequestJobBase(type, service) {} | 84 : MockRequestJobBase(type, service) {} |
| 85 virtual ~AsyncRequestJob() {} | 85 virtual ~AsyncRequestJob() {} |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 virtual void RetryJob() OVERRIDE { |
| 89 if (!retry_callback_.is_null()) |
| 90 retry_callback_.Run(this); |
| 91 Run(); |
| 92 } |
| 93 |
| 88 virtual void SendResponse( | 94 virtual void SendResponse( |
| 89 DeviceManagementStatus status, | 95 DeviceManagementStatus status, |
| 90 const em::DeviceManagementResponse& response) OVERRIDE { | 96 const em::DeviceManagementResponse& response) OVERRIDE { |
| 91 callback_.Run(status, response); | 97 callback_.Run(status, response); |
| 92 } | 98 } |
| 93 | 99 |
| 94 private: | 100 private: |
| 95 DISALLOW_COPY_AND_ASSIGN(AsyncRequestJob); | 101 DISALLOW_COPY_AND_ASSIGN(AsyncRequestJob); |
| 96 }; | 102 }; |
| 97 | 103 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 125 const em::DeviceManagementResponse dummy_response; | 131 const em::DeviceManagementResponse dummy_response; |
| 126 return CreateSyncMockDeviceManagementJob(this, status, dummy_response); | 132 return CreateSyncMockDeviceManagementJob(this, status, dummy_response); |
| 127 } | 133 } |
| 128 | 134 |
| 129 Action<MockDeviceManagementService::CreateJobFunction> | 135 Action<MockDeviceManagementService::CreateJobFunction> |
| 130 MockDeviceManagementService::CreateAsyncJob(MockDeviceManagementJob** job) { | 136 MockDeviceManagementService::CreateAsyncJob(MockDeviceManagementJob** job) { |
| 131 return CreateAsyncMockDeviceManagementJob(this, job); | 137 return CreateAsyncMockDeviceManagementJob(this, job); |
| 132 } | 138 } |
| 133 | 139 |
| 134 } // namespace policy | 140 } // namespace policy |
| OLD | NEW |