OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
14 #include "chrome/browser/chromeos/cros/cros_library.h" | 14 #include "chrome/browser/chromeos/cros/cros_library.h" |
15 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | 15 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" |
16 #include "chrome/browser/chromeos/cros/mock_library_loader.h" | |
17 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h" | 16 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h" |
18 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 17 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
19 #include "chrome/browser/chromeos/login/authenticator.h" | 18 #include "chrome/browser/chromeos/login/authenticator.h" |
20 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 19 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 20 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
23 #include "chrome/browser/net/predictor.h" | 22 #include "chrome/browser/net/predictor.h" |
24 #include "chrome/browser/policy/browser_policy_connector.h" | 23 #include "chrome/browser/policy/browser_policy_connector.h" |
25 #include "chrome/browser/policy/cloud_policy_data_store.h" | 24 #include "chrome/browser/policy/cloud_policy_data_store.h" |
26 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 25 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; | 151 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; |
153 cryptohome::AsyncMethodCaller::InitializeForTesting( | 152 cryptohome::AsyncMethodCaller::InitializeForTesting( |
154 mock_async_method_caller_); | 153 mock_async_method_caller_); |
155 | 154 |
156 io_thread_state_.reset(new IOThread(local_state_.Get(), NULL, NULL)); | 155 io_thread_state_.reset(new IOThread(local_state_.Get(), NULL, NULL)); |
157 browser_process_->SetIOThread(io_thread_state_.get()); | 156 browser_process_->SetIOThread(io_thread_state_.get()); |
158 | 157 |
159 CrosLibrary::TestApi* test_api = CrosLibrary::Get()->GetTestApi(); | 158 CrosLibrary::TestApi* test_api = CrosLibrary::Get()->GetTestApi(); |
160 ASSERT_TRUE(test_api); | 159 ASSERT_TRUE(test_api); |
161 | 160 |
162 MockLibraryLoader* loader = new MockLibraryLoader(); | |
163 ON_CALL(*loader, Load(_)).WillByDefault(Return(true)); | |
164 test_api->SetLibraryLoader(loader, true); | |
165 | |
166 cryptohome_ = new MockCryptohomeLibrary(); | 161 cryptohome_ = new MockCryptohomeLibrary(); |
167 EXPECT_CALL(*cryptohome_, InstallAttributesIsReady()) | 162 EXPECT_CALL(*cryptohome_, InstallAttributesIsReady()) |
168 .WillRepeatedly(Return(true)); | 163 .WillRepeatedly(Return(true)); |
169 EXPECT_CALL(*cryptohome_, InstallAttributesIsInvalid()) | 164 EXPECT_CALL(*cryptohome_, InstallAttributesIsInvalid()) |
170 .WillRepeatedly(Return(false)); | 165 .WillRepeatedly(Return(false)); |
171 EXPECT_CALL(*cryptohome_, InstallAttributesIsFirstInstall()) | 166 EXPECT_CALL(*cryptohome_, InstallAttributesIsFirstInstall()) |
172 .WillRepeatedly(Return(true)); | 167 .WillRepeatedly(Return(true)); |
173 EXPECT_CALL(*cryptohome_, TpmIsEnabled()) | 168 EXPECT_CALL(*cryptohome_, TpmIsEnabled()) |
174 .WillRepeatedly(Return(false)); | 169 .WillRepeatedly(Return(false)); |
175 EXPECT_CALL(*cryptohome_, IsMounted()) | 170 EXPECT_CALL(*cryptohome_, IsMounted()) |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 522 } |
528 | 523 |
529 INSTANTIATE_TEST_CASE_P( | 524 INSTANTIATE_TEST_CASE_P( |
530 LoginUtilsBlockingLoginTestInstance, | 525 LoginUtilsBlockingLoginTestInstance, |
531 LoginUtilsBlockingLoginTest, | 526 LoginUtilsBlockingLoginTest, |
532 testing::Values(0, 1, 2, 3, 4, 5)); | 527 testing::Values(0, 1, 2, 3, 4, 5)); |
533 | 528 |
534 } // namespace | 529 } // namespace |
535 | 530 |
536 } | 531 } |
OLD | NEW |