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

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

Issue 8702009: Add device status reports to policy requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Mattias' comments and added unit test. Created 9 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ 5 #ifndef CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_
6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ 6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 const std::string& device_id, 35 const std::string& device_id,
36 const em::DeviceRegisterRequest& request, 36 const em::DeviceRegisterRequest& request,
37 DeviceRegisterResponseDelegate* delegate)); 37 DeviceRegisterResponseDelegate* delegate));
38 38
39 MOCK_METHOD4(ProcessUnregisterRequest, void( 39 MOCK_METHOD4(ProcessUnregisterRequest, void(
40 const std::string& device_management_token, 40 const std::string& device_management_token,
41 const std::string& device_id, 41 const std::string& device_id,
42 const em::DeviceUnregisterRequest& request, 42 const em::DeviceUnregisterRequest& request,
43 DeviceUnregisterResponseDelegate* delegate)); 43 DeviceUnregisterResponseDelegate* delegate));
44 44
45 MOCK_METHOD5(ProcessPolicyRequest, void( 45 MOCK_METHOD6(ProcessPolicyRequest, void(
46 const std::string& device_management_token, 46 const std::string& device_management_token,
47 const std::string& device_id, 47 const std::string& device_id,
48 CloudPolicyDataStore::UserAffiliation affiliation, 48 CloudPolicyDataStore::UserAffiliation affiliation,
49 const em::DevicePolicyRequest& request, 49 const em::DevicePolicyRequest& request,
50 const em::DeviceStatusReportRequest& device_status,
50 DevicePolicyResponseDelegate* delegate)); 51 DevicePolicyResponseDelegate* delegate));
51 52
52 private: 53 private:
53 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementBackend); 54 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementBackend);
54 }; 55 };
55 56
56 ACTION(MockDeviceManagementBackendSucceedRegister) { 57 ACTION(MockDeviceManagementBackendSucceedRegister) {
57 em::DeviceRegisterResponse response; 58 em::DeviceRegisterResponse response;
58 std::string token("FAKE_DEVICE_TOKEN_"); 59 std::string token("FAKE_DEVICE_TOKEN_");
59 static int next_token_suffix; 60 static int next_token_suffix;
(...skipping 15 matching lines...) Expand all
75 signed_response.set_timestamp(timestamp.InMilliseconds()); 76 signed_response.set_timestamp(timestamp.InMilliseconds());
76 std::string serialized_signed_response; 77 std::string serialized_signed_response;
77 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); 78 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response));
78 em::DevicePolicyResponse response; 79 em::DevicePolicyResponse response;
79 em::PolicyFetchResponse* fetch_response = response.add_response(); 80 em::PolicyFetchResponse* fetch_response = response.add_response();
80 fetch_response->set_policy_data(serialized_signed_response); 81 fetch_response->set_policy_data(serialized_signed_response);
81 // TODO(jkummerow): Set proper new_public_key and signature (when 82 // TODO(jkummerow): Set proper new_public_key and signature (when
82 // implementing support for signature verification). 83 // implementing support for signature verification).
83 fetch_response->set_policy_data_signature("TODO"); 84 fetch_response->set_policy_data_signature("TODO");
84 fetch_response->set_new_public_key("TODO"); 85 fetch_response->set_new_public_key("TODO");
85 arg4->HandlePolicyResponse(response); 86 arg5->HandlePolicyResponse(response);
86 } 87 }
87 88
88 ACTION_P(MockDeviceManagementBackendFailRegister, error) { 89 ACTION_P(MockDeviceManagementBackendFailRegister, error) {
89 arg4->OnError(error); 90 arg4->OnError(error);
90 } 91 }
91 92
92 ACTION_P(MockDeviceManagementBackendFailPolicy, error) { 93 ACTION_P(MockDeviceManagementBackendFailPolicy, error) {
93 arg4->OnError(error); 94 arg5->OnError(error);
94 } 95 }
95 96
96 } // namespace policy 97 } // namespace policy
97 98
98 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ 99 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698