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

Side by Side Diff: chrome/browser/policy/mock_device_management_service_old.h

Issue 9066005: Remove all old-style DeviceManagementService legacy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 11 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
(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_MOCK_DEVICE_MANAGEMENT_SERVICE_OLD_H_
6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_SERVICE_OLD_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "chrome/browser/policy/device_management_backend.h"
13 #include "chrome/browser/policy/device_management_service.h"
14 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
15 #include "testing/gmock/include/gmock/gmock.h"
16
17 namespace policy {
18
19 // This proxy class is used so that expectations can be defined for a single
20 // persistent instance of DMBackend while the DeviceTokenFetcher under test
21 // merrily creates and destroys proxies.
22 class ProxyDeviceManagementBackend : public DeviceManagementBackend {
23 public:
24 explicit ProxyDeviceManagementBackend(DeviceManagementBackend* backend);
25 virtual ~ProxyDeviceManagementBackend();
26
27 // DeviceRegisterRequest implementation:
28 virtual void ProcessRegisterRequest(
29 const std::string& gaia_auth_token,
30 const std::string& oauth_token,
31 const std::string& device_id,
32 const enterprise_management::DeviceRegisterRequest& request,
33 DeviceRegisterResponseDelegate* delegate) OVERRIDE;
34 virtual void ProcessUnregisterRequest(
35 const std::string& device_management_token,
36 const std::string& device_id,
37 const enterprise_management::DeviceUnregisterRequest& request,
38 DeviceUnregisterResponseDelegate* delegate) OVERRIDE;
39 virtual void ProcessPolicyRequest(
40 const std::string& device_management_token,
41 const std::string& device_id,
42 CloudPolicyDataStore::UserAffiliation affiliation,
43 const enterprise_management::DevicePolicyRequest& request,
44 const enterprise_management::DeviceStatusReportRequest* device_status,
45 DevicePolicyResponseDelegate* delegate) OVERRIDE;
46 virtual void ProcessAutoEnrollmentRequest(
47 const std::string& device_id,
48 const enterprise_management::DeviceAutoEnrollmentRequest& request,
49 DeviceAutoEnrollmentResponseDelegate* delegate) OVERRIDE;
50
51 private:
52 DeviceManagementBackend* backend_; // weak
53 DISALLOW_COPY_AND_ASSIGN(ProxyDeviceManagementBackend);
54 };
55
56 // TODO(mnissler): Deprecated, remove (http://crbug.com/108928).
57 // Use the new callback-style MockDeviceManagementService in
58 // mock_device_management_service.h instead.
59 class MockDeviceManagementServiceOld : public DeviceManagementService {
60 public:
61 MockDeviceManagementServiceOld();
62 virtual ~MockDeviceManagementServiceOld();
63
64 MOCK_METHOD0(CreateBackend, DeviceManagementBackend*());
65
66 // This method bypasses the mocked version and calls the superclass'
67 // CreateBackend(), returning a "real" backend.
68 DeviceManagementBackend* CreateBackendNotMocked() {
69 return DeviceManagementService::CreateBackend();
70 }
71
72 private:
73 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementServiceOld);
74 };
75
76 // Use this to make CreateBackend return a ProxyDeviceManagementBackend for
77 // the given |backend|.
78 ACTION_P(MockDeviceManagementServiceProxyBackend, backend) {
79 return new ProxyDeviceManagementBackend(backend);
80 }
81
82 // Use this to make StartJob send a faked response to the job immediately.
83 ACTION_P4(MockDeviceManagementServiceRespondToJob, status, response_code,
84 cookies, data) {
85 arg0->HandleResponse(status, response_code, cookies, data);
86 }
87
88 } // namespace policy
89
90 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_SERVICE_OLD_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/mock_device_management_backend.cc ('k') | chrome/browser/policy/mock_device_management_service_old.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698