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