OLD | NEW |
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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 26 matching lines...) Expand all Loading... |
37 const std::string& device_id, | 37 const std::string& device_id, |
38 const em::DeviceRegisterRequest& request, | 38 const em::DeviceRegisterRequest& request, |
39 DeviceRegisterResponseDelegate* delegate)); | 39 DeviceRegisterResponseDelegate* delegate)); |
40 | 40 |
41 MOCK_METHOD4(ProcessUnregisterRequest, void( | 41 MOCK_METHOD4(ProcessUnregisterRequest, void( |
42 const std::string& device_management_token, | 42 const std::string& device_management_token, |
43 const std::string& device_id, | 43 const std::string& device_id, |
44 const em::DeviceUnregisterRequest& request, | 44 const em::DeviceUnregisterRequest& request, |
45 DeviceUnregisterResponseDelegate* delegate)); | 45 DeviceUnregisterResponseDelegate* delegate)); |
46 | 46 |
47 MOCK_METHOD5(ProcessPolicyRequest, void( | 47 MOCK_METHOD4(ProcessPolicyRequest, void( |
48 const std::string& device_management_token, | 48 const std::string& device_management_token, |
49 const std::string& device_id, | 49 const std::string& device_id, |
50 CloudPolicyDataStore::UserAffiliation affiliation, | |
51 const em::DevicePolicyRequest& request, | 50 const em::DevicePolicyRequest& request, |
52 DevicePolicyResponseDelegate* delegate)); | 51 DevicePolicyResponseDelegate* delegate)); |
53 | 52 |
54 private: | 53 private: |
55 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementBackend); | 54 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementBackend); |
56 }; | 55 }; |
57 | 56 |
58 ACTION(MockDeviceManagementBackendSucceedRegister) { | 57 ACTION(MockDeviceManagementBackendSucceedRegister) { |
59 em::DeviceRegisterResponse response; | 58 em::DeviceRegisterResponse response; |
60 std::string token("FAKE_DEVICE_TOKEN_"); | 59 std::string token("FAKE_DEVICE_TOKEN_"); |
(...skipping 16 matching lines...) Expand all Loading... |
77 signed_response.set_timestamp(timestamp.InMilliseconds()); | 76 signed_response.set_timestamp(timestamp.InMilliseconds()); |
78 std::string serialized_signed_response; | 77 std::string serialized_signed_response; |
79 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); | 78 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); |
80 em::DevicePolicyResponse response; | 79 em::DevicePolicyResponse response; |
81 em::PolicyFetchResponse* fetch_response = response.add_response(); | 80 em::PolicyFetchResponse* fetch_response = response.add_response(); |
82 fetch_response->set_policy_data(serialized_signed_response); | 81 fetch_response->set_policy_data(serialized_signed_response); |
83 // TODO(jkummerow): Set proper new_public_key and signature (when | 82 // TODO(jkummerow): Set proper new_public_key and signature (when |
84 // implementing support for signature verification). | 83 // implementing support for signature verification). |
85 fetch_response->set_policy_data_signature("TODO"); | 84 fetch_response->set_policy_data_signature("TODO"); |
86 fetch_response->set_new_public_key("TODO"); | 85 fetch_response->set_new_public_key("TODO"); |
87 arg4->HandlePolicyResponse(response); | 86 arg3->HandlePolicyResponse(response); |
88 } | 87 } |
89 | 88 |
90 ACTION_P(MockDeviceManagementBackendFailRegister, error) { | 89 ACTION_P(MockDeviceManagementBackendFailRegister, error) { |
91 arg4->OnError(error); | 90 arg4->OnError(error); |
92 } | 91 } |
93 | 92 |
94 ACTION_P(MockDeviceManagementBackendFailPolicy, error) { | 93 ACTION_P(MockDeviceManagementBackendFailPolicy, error) { |
95 arg4->OnError(error); | 94 arg3->OnError(error); |
96 } | 95 } |
97 | 96 |
98 } // namespace policy | 97 } // namespace policy |
99 | 98 |
100 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ | 99 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ |
OLD | NEW |