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.h" | 5 #include "chrome/browser/chromeos/login/signed_settings.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
12 #include "chrome/browser/chromeos/cros/mock_library_loader.h" | 12 #include "chrome/browser/chromeos/cros/mock_library_loader.h" |
13 #include "chrome/browser/chromeos/cros/mock_login_library.h" | 13 #include "chrome/browser/chromeos/cros/mock_login_library.h" |
14 #include "chrome/browser/chromeos/cros_settings_names.h" | 14 #include "chrome/browser/chromeos/cros_settings_names.h" |
15 #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" | 15 #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" |
16 #include "chrome/browser/chromeos/login/mock_ownership_service.h" | 16 #include "chrome/browser/chromeos/login/mock_ownership_service.h" |
17 #include "chrome/browser/chromeos/login/owner_manager_unittest.h" | 17 #include "chrome/browser/chromeos/login/owner_manager_unittest.h" |
18 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" | 18 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" |
19 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 19 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 20 #include "chrome/test/base/testing_browser_process_test.h" |
20 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
21 #include "crypto/rsa_private_key.h" | 22 #include "crypto/rsa_private_key.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 using ::testing::A; | 26 using ::testing::A; |
26 using ::testing::AnyNumber; | 27 using ::testing::AnyNumber; |
27 using ::testing::InvokeArgument; | 28 using ::testing::InvokeArgument; |
28 using ::testing::Return; | 29 using ::testing::Return; |
29 using ::testing::ReturnRef; | 30 using ::testing::ReturnRef; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual void compare_expected(const em::PolicyFetchResponse& to_compare) { | 92 virtual void compare_expected(const em::PolicyFetchResponse& to_compare) { |
92 std::string ex_string, comp_string; | 93 std::string ex_string, comp_string; |
93 EXPECT_TRUE(expected_.SerializeToString(&ex_string)); | 94 EXPECT_TRUE(expected_.SerializeToString(&ex_string)); |
94 EXPECT_TRUE(to_compare.SerializeToString(&comp_string)); | 95 EXPECT_TRUE(to_compare.SerializeToString(&comp_string)); |
95 EXPECT_EQ(ex_string, comp_string); | 96 EXPECT_EQ(ex_string, comp_string); |
96 } | 97 } |
97 }; | 98 }; |
98 | 99 |
99 } // anonymous namespace | 100 } // anonymous namespace |
100 | 101 |
101 class SignedSettingsTest : public ::testing::Test { | 102 class SignedSettingsTest : public TestingBrowserProcessTest { |
102 public: | 103 public: |
103 SignedSettingsTest() | 104 SignedSettingsTest() |
104 : fake_email_("fakey@example.com"), | 105 : fake_email_("fakey@example.com"), |
105 fake_domain_("*@example.com"), | 106 fake_domain_("*@example.com"), |
106 fake_prop_(kAccountsPrefAllowGuest), | 107 fake_prop_(kAccountsPrefAllowGuest), |
107 fake_value_("false"), | 108 fake_value_("false"), |
108 message_loop_(MessageLoop::TYPE_UI), | 109 message_loop_(MessageLoop::TYPE_UI), |
109 ui_thread_(BrowserThread::UI, &message_loop_), | 110 ui_thread_(BrowserThread::UI, &message_loop_), |
110 file_thread_(BrowserThread::FILE), | 111 file_thread_(BrowserThread::FILE), |
111 mock_(new MockKeyUtils), | 112 mock_(new MockKeyUtils), |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 | 792 |
792 s->Execute(); | 793 s->Execute(); |
793 message_loop_.RunAllPending(); | 794 message_loop_.RunAllPending(); |
794 UnMockLoginLib(); | 795 UnMockLoginLib(); |
795 | 796 |
796 s->OnKeyOpComplete(OwnerManager::OPERATION_FAILED, std::vector<uint8>()); | 797 s->OnKeyOpComplete(OwnerManager::OPERATION_FAILED, std::vector<uint8>()); |
797 message_loop_.RunAllPending(); | 798 message_loop_.RunAllPending(); |
798 } | 799 } |
799 | 800 |
800 } // namespace chromeos | 801 } // namespace chromeos |
OLD | NEW |