Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1272)

Side by Side Diff: chrome/browser/policy/cloud/mock_device_management_service.h

Issue 25690003: Refactored the DeviceManagementService to get its parameters from a delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/policy/cloud/device_management_service.h" 11 #include "chrome/browser/policy/cloud/device_management_service.h"
12 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" 12 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 14
15 namespace policy { 15 namespace policy {
16 16
17 class MockDeviceManagementJob { 17 class MockDeviceManagementJob {
18 public: 18 public:
19 virtual ~MockDeviceManagementJob(); 19 virtual ~MockDeviceManagementJob();
20 virtual void RetryJob() = 0; 20 virtual void RetryJob() = 0;
21 virtual void SendResponse( 21 virtual void SendResponse(
22 DeviceManagementStatus status, 22 DeviceManagementStatus status,
23 const enterprise_management::DeviceManagementResponse& response) = 0; 23 const enterprise_management::DeviceManagementResponse& response) = 0;
24 }; 24 };
25 25
26 class MockDeviceManagementServiceConfiguration
27 : public DeviceManagementService::Configuration {
28 public:
29 MockDeviceManagementServiceConfiguration();
30 explicit MockDeviceManagementServiceConfiguration(
31 const std::string& server_url);
32 virtual ~MockDeviceManagementServiceConfiguration();
33
34 virtual std::string GetServerUrl() OVERRIDE;
35 virtual std::string GetUserAgent() OVERRIDE;
36 virtual std::string GetAgentParameter() OVERRIDE;
37 virtual std::string GetPlatformParameter() OVERRIDE;
38
39 private:
40 const std::string server_url_;
41
42 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementServiceConfiguration);
43 };
44
26 class MockDeviceManagementService : public DeviceManagementService { 45 class MockDeviceManagementService : public DeviceManagementService {
27 public: 46 public:
28 MockDeviceManagementService(); 47 MockDeviceManagementService();
29 virtual ~MockDeviceManagementService(); 48 virtual ~MockDeviceManagementService();
30 49
31 typedef DeviceManagementRequestJob* CreateJobFunction( 50 typedef DeviceManagementRequestJob* CreateJobFunction(
32 DeviceManagementRequestJob::JobType); 51 DeviceManagementRequestJob::JobType);
33 52
34 MOCK_METHOD1(CreateJob, CreateJobFunction); 53 MOCK_METHOD1(CreateJob, CreateJobFunction);
35 MOCK_METHOD7( 54 MOCK_METHOD7(
(...skipping 18 matching lines...) Expand all
54 testing::Action<CreateJobFunction> CreateAsyncJob( 73 testing::Action<CreateJobFunction> CreateAsyncJob(
55 MockDeviceManagementJob** job); 74 MockDeviceManagementJob** job);
56 75
57 private: 76 private:
58 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementService); 77 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementService);
59 }; 78 };
60 79
61 } // namespace policy 80 } // namespace policy
62 81
63 #endif // CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_ 82 #endif // CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698