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" |
11 #include "chrome/browser/chromeos/login/signed_settings.h" | 11 #include "chrome/browser/chromeos/login/signed_settings.h" |
12 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" | 12 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" |
13 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 13 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 14 #include "chrome/test/base/testing_browser_process_test.h" |
14 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using ::testing::_; | 19 using ::testing::_; |
19 using ::testing::A; | 20 using ::testing::A; |
20 using ::testing::AtLeast; | 21 using ::testing::AtLeast; |
21 using ::testing::InSequence; | 22 using ::testing::InSequence; |
22 using ::testing::Invoke; | 23 using ::testing::Invoke; |
23 using ::testing::Return; | 24 using ::testing::Return; |
(...skipping 15 matching lines...) Expand all Loading... |
39 MOCK_METHOD3(OnStorePropertyCompleted, void( | 40 MOCK_METHOD3(OnStorePropertyCompleted, void( |
40 SignedSettings::ReturnCode code, | 41 SignedSettings::ReturnCode code, |
41 const std::string& name, | 42 const std::string& name, |
42 const std::string& value)); | 43 const std::string& value)); |
43 MOCK_METHOD3(OnRetrievePropertyCompleted, void( | 44 MOCK_METHOD3(OnRetrievePropertyCompleted, void( |
44 SignedSettings::ReturnCode code, | 45 SignedSettings::ReturnCode code, |
45 const std::string& name, | 46 const std::string& name, |
46 const std::string& value)); | 47 const std::string& value)); |
47 }; | 48 }; |
48 | 49 |
49 class SignedSettingsHelperTest : public ::testing::Test, | 50 class SignedSettingsHelperTest : public TestingBrowserProcessTest, |
50 public SignedSettingsHelper::TestDelegate { | 51 public SignedSettingsHelper::TestDelegate { |
51 public: | 52 public: |
52 SignedSettingsHelperTest() | 53 SignedSettingsHelperTest() |
53 : fake_email_("fakey@example.com"), | 54 : fake_email_("fakey@example.com"), |
54 fake_prop_(kAccountsPrefAllowGuest), | 55 fake_prop_(kAccountsPrefAllowGuest), |
55 fake_value_("false"), | 56 fake_value_("false"), |
56 message_loop_(MessageLoop::TYPE_UI), | 57 message_loop_(MessageLoop::TYPE_UI), |
57 ui_thread_(BrowserThread::UI, &message_loop_), | 58 ui_thread_(BrowserThread::UI, &message_loop_), |
58 file_thread_(BrowserThread::FILE), | 59 file_thread_(BrowserThread::FILE), |
59 pending_ops_(0) { | 60 pending_ops_(0) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled); | 213 SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled); |
213 | 214 |
214 SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_, | 215 SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_, |
215 &cb); | 216 &cb); |
216 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); | 217 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); |
217 | 218 |
218 message_loop_.Run(); | 219 message_loop_.Run(); |
219 } | 220 } |
220 | 221 |
221 } // namespace chromeos | 222 } // namespace chromeos |
OLD | NEW |