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

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

Issue 109743002: Move policy code into components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar fixes Created 7 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "chrome/browser/policy/cloud/device_management_service.h"
12 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14
15 namespace policy {
16
17 class MockDeviceManagementJob {
18 public:
19 virtual ~MockDeviceManagementJob();
20 virtual void RetryJob() = 0;
21 virtual void SendResponse(
22 DeviceManagementStatus status,
23 const enterprise_management::DeviceManagementResponse& response) = 0;
24 };
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 GetAgentParameter() OVERRIDE;
36 virtual std::string GetPlatformParameter() OVERRIDE;
37
38 private:
39 const std::string server_url_;
40
41 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementServiceConfiguration);
42 };
43
44 class MockDeviceManagementService : public DeviceManagementService {
45 public:
46 MockDeviceManagementService();
47 virtual ~MockDeviceManagementService();
48
49 typedef DeviceManagementRequestJob* CreateJobFunction(
50 DeviceManagementRequestJob::JobType, net::URLRequestContextGetter*);
51
52 MOCK_METHOD2(CreateJob, CreateJobFunction);
53 MOCK_METHOD7(
54 StartJob,
55 void(const std::string& request_type,
56 const std::string& gaia_token,
57 const std::string& oauth_token,
58 const std::string& dm_token,
59 const std::string& user_affiliation,
60 const std::string& client_id,
61 const enterprise_management::DeviceManagementRequest& request));
62
63 // Creates a gmock action that will make the job succeed.
64 testing::Action<CreateJobFunction> SucceedJob(
65 const enterprise_management::DeviceManagementResponse& response);
66
67 // Creates a gmock action which will fail the job with the given error.
68 testing::Action<CreateJobFunction> FailJob(DeviceManagementStatus status);
69
70 // Creates a gmock action which will capture the job so the test code can
71 // delay job completion.
72 testing::Action<CreateJobFunction> CreateAsyncJob(
73 MockDeviceManagementJob** job);
74
75 private:
76 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementService);
77 };
78
79 } // namespace policy
80
81 #endif // CHROME_BROWSER_POLICY_CLOUD_MOCK_DEVICE_MANAGEMENT_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/mock_cloud_policy_store.cc ('k') | chrome/browser/policy/cloud/mock_device_management_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698