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