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