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 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | 5 #include "chrome/browser/chromeos/login/signed_settings_helper.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/cros_library.h" | 7 #include "chrome/browser/chromeos/cros/cros_library.h" |
8 #include "chrome/browser/chromeos/cros_settings_names.h" | 8 #include "chrome/browser/chromeos/cros_settings_names.h" |
9 #include "chrome/browser/chromeos/login/mock_ownership_service.h" | 9 #include "chrome/browser/chromeos/login/mock_ownership_service.h" |
10 #include "chrome/browser/chromeos/login/owner_manager.h" | 10 #include "chrome/browser/chromeos/login/owner_manager.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 MOCK_METHOD2(OnCheckWhitelistCompleted, void( | 33 MOCK_METHOD2(OnCheckWhitelistCompleted, void( |
34 SignedSettings::ReturnCode code, const std::string& email)); | 34 SignedSettings::ReturnCode code, const std::string& email)); |
35 MOCK_METHOD2(OnWhitelistCompleted, void( | 35 MOCK_METHOD2(OnWhitelistCompleted, void( |
36 SignedSettings::ReturnCode code, const std::string& email)); | 36 SignedSettings::ReturnCode code, const std::string& email)); |
37 MOCK_METHOD2(OnUnwhitelistCompleted, void( | 37 MOCK_METHOD2(OnUnwhitelistCompleted, void( |
38 SignedSettings::ReturnCode code, const std::string& email)); | 38 SignedSettings::ReturnCode code, const std::string& email)); |
39 MOCK_METHOD3(OnStorePropertyCompleted, void( | 39 MOCK_METHOD3(OnStorePropertyCompleted, void( |
40 SignedSettings::ReturnCode code, | 40 SignedSettings::ReturnCode code, |
41 const std::string& name, | 41 const std::string& name, |
42 const std::string& value)); | 42 const base::Value& value)); |
43 MOCK_METHOD3(OnRetrievePropertyCompleted, void( | 43 MOCK_METHOD3(OnRetrievePropertyCompleted, void( |
44 SignedSettings::ReturnCode code, | 44 SignedSettings::ReturnCode code, |
45 const std::string& name, | 45 const std::string& name, |
46 const std::string& value)); | 46 const base::Value& value)); |
47 }; | 47 }; |
48 | 48 |
49 class SignedSettingsHelperTest : public testing::Test, | 49 class SignedSettingsHelperTest : public testing::Test, |
50 public SignedSettingsHelper::TestDelegate { | 50 public SignedSettingsHelper::TestDelegate { |
51 public: | 51 public: |
52 SignedSettingsHelperTest() | 52 SignedSettingsHelperTest() |
53 : fake_email_("fakey@example.com"), | 53 : fake_email_("fakey@example.com"), |
54 fake_prop_(kAccountsPrefAllowGuest), | 54 fake_prop_(kReleaseChannel), |
55 fake_value_("false"), | 55 fake_value_("false"), |
56 message_loop_(MessageLoop::TYPE_UI), | 56 message_loop_(MessageLoop::TYPE_UI), |
57 ui_thread_(BrowserThread::UI, &message_loop_), | 57 ui_thread_(BrowserThread::UI, &message_loop_), |
58 file_thread_(BrowserThread::FILE), | 58 file_thread_(BrowserThread::FILE), |
59 pending_ops_(0) { | 59 pending_ops_(0) { |
60 } | 60 } |
61 | 61 |
62 virtual void SetUp() { | 62 virtual void SetUp() { |
63 file_thread_.Start(); | 63 file_thread_.Start(); |
64 SignedSettingsHelper::Get()->set_test_delegate(this); | 64 SignedSettingsHelper::Get()->set_test_delegate(this); |
(...skipping 24 matching lines...) Expand all Loading... |
89 em::PolicyData BuildPolicyData() { | 89 em::PolicyData BuildPolicyData() { |
90 em::PolicyData to_return; | 90 em::PolicyData to_return; |
91 em::ChromeDeviceSettingsProto pol; | 91 em::ChromeDeviceSettingsProto pol; |
92 to_return.set_policy_type(SignedSettings::kDevicePolicyType); | 92 to_return.set_policy_type(SignedSettings::kDevicePolicyType); |
93 to_return.set_policy_value(pol.SerializeAsString()); | 93 to_return.set_policy_value(pol.SerializeAsString()); |
94 return to_return; | 94 return to_return; |
95 } | 95 } |
96 | 96 |
97 const std::string fake_email_; | 97 const std::string fake_email_; |
98 const std::string fake_prop_; | 98 const std::string fake_prop_; |
99 const std::string fake_value_; | 99 const base::StringValue fake_value_; |
100 MockOwnershipService m_; | 100 MockOwnershipService m_; |
101 | 101 |
102 MessageLoop message_loop_; | 102 MessageLoop message_loop_; |
103 BrowserThread ui_thread_; | 103 BrowserThread ui_thread_; |
104 BrowserThread file_thread_; | 104 BrowserThread file_thread_; |
105 | 105 |
106 int pending_ops_; | 106 int pending_ops_; |
107 | 107 |
108 ScopedStubCrosEnabler stub_cros_enabler_; | 108 ScopedStubCrosEnabler stub_cros_enabler_; |
109 }; | 109 }; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled); | 212 SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled); |
213 | 213 |
214 SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_, | 214 SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_, |
215 &cb); | 215 &cb); |
216 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); | 216 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); |
217 | 217 |
218 message_loop_.Run(); | 218 message_loop_.Run(); |
219 } | 219 } |
220 | 220 |
221 } // namespace chromeos | 221 } // namespace chromeos |
OLD | NEW |