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