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/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/test/base/scoped_testing_local_state.h" | 42 #include "chrome/test/base/scoped_testing_local_state.h" |
43 #include "chrome/test/base/testing_browser_process.h" | 43 #include "chrome/test/base/testing_browser_process.h" |
44 #include "chromeos/chromeos_switches.h" | 44 #include "chromeos/chromeos_switches.h" |
45 #include "chromeos/cryptohome/cryptohome_library.h" | 45 #include "chromeos/cryptohome/cryptohome_library.h" |
46 #include "chromeos/cryptohome/mock_async_method_caller.h" | 46 #include "chromeos/cryptohome/mock_async_method_caller.h" |
47 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" | 47 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" |
48 #include "chromeos/disks/disk_mount_manager.h" | 48 #include "chromeos/disks/disk_mount_manager.h" |
49 #include "chromeos/disks/mock_disk_mount_manager.h" | 49 #include "chromeos/disks/mock_disk_mount_manager.h" |
50 #include "chromeos/login/login_state.h" | 50 #include "chromeos/login/login_state.h" |
51 #include "chromeos/network/network_handler.h" | 51 #include "chromeos/network/network_handler.h" |
| 52 #include "chromeos/system/mock_statistics_provider.h" |
| 53 #include "chromeos/system/statistics_provider.h" |
52 #include "content/public/browser/browser_thread.h" | 54 #include "content/public/browser/browser_thread.h" |
53 #include "content/public/test/test_browser_thread.h" | 55 #include "content/public/test/test_browser_thread.h" |
54 #include "content/public/test/test_utils.h" | 56 #include "content/public/test/test_utils.h" |
55 #include "google_apis/gaia/gaia_auth_consumer.h" | 57 #include "google_apis/gaia/gaia_auth_consumer.h" |
56 #include "google_apis/gaia/gaia_urls.h" | 58 #include "google_apis/gaia/gaia_urls.h" |
57 #include "net/url_request/test_url_fetcher_factory.h" | 59 #include "net/url_request/test_url_fetcher_factory.h" |
58 #include "net/url_request/url_fetcher_delegate.h" | 60 #include "net/url_request/url_fetcher_delegate.h" |
59 #include "net/url_request/url_request.h" | 61 #include "net/url_request/url_request.h" |
60 #include "net/url_request/url_request_context_getter.h" | 62 #include "net/url_request/url_request_context_getter.h" |
61 #include "net/url_request/url_request_status.h" | 63 #include "net/url_request/url_request_status.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 211 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
210 | 212 |
211 // DBusThreadManager should be initialized before io_thread_state_, as | 213 // DBusThreadManager should be initialized before io_thread_state_, as |
212 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, | 214 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, |
213 // which is part of io_thread_state_. | 215 // which is part of io_thread_state_. |
214 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); | 216 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); |
215 | 217 |
216 CryptohomeLibrary::Initialize(); | 218 CryptohomeLibrary::Initialize(); |
217 LoginState::Initialize(); | 219 LoginState::Initialize(); |
218 | 220 |
| 221 EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, _)) |
| 222 .WillRepeatedly(Return(false)); |
| 223 chromeos::system::StatisticsProvider::SetTestProvider( |
| 224 &mock_statistics_provider_); |
| 225 |
219 mock_input_method_manager_ = new input_method::MockInputMethodManager(); | 226 mock_input_method_manager_ = new input_method::MockInputMethodManager(); |
220 input_method::InitializeForTesting(mock_input_method_manager_); | 227 input_method::InitializeForTesting(mock_input_method_manager_); |
221 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); | 228 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); |
222 mock_disk_mount_manager_.SetupDefaultReplies(); | 229 mock_disk_mount_manager_.SetupDefaultReplies(); |
223 | 230 |
224 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; | 231 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; |
225 cryptohome::AsyncMethodCaller::InitializeForTesting( | 232 cryptohome::AsyncMethodCaller::InitializeForTesting( |
226 mock_async_method_caller_); | 233 mock_async_method_caller_); |
227 | 234 |
228 test_device_settings_service_.reset(new ScopedTestDeviceSettingsService); | 235 test_device_settings_service_.reset(new ScopedTestDeviceSettingsService); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 scoped_ptr<content::TestBrowserThread> io_thread_; | 478 scoped_ptr<content::TestBrowserThread> io_thread_; |
472 scoped_ptr<IOThread> io_thread_state_; | 479 scoped_ptr<IOThread> io_thread_state_; |
473 | 480 |
474 MockDBusThreadManagerWithoutGMock mock_dbus_thread_manager_; | 481 MockDBusThreadManagerWithoutGMock mock_dbus_thread_manager_; |
475 input_method::MockInputMethodManager* mock_input_method_manager_; | 482 input_method::MockInputMethodManager* mock_input_method_manager_; |
476 disks::MockDiskMountManager mock_disk_mount_manager_; | 483 disks::MockDiskMountManager mock_disk_mount_manager_; |
477 net::TestURLFetcherFactory test_url_fetcher_factory_; | 484 net::TestURLFetcherFactory test_url_fetcher_factory_; |
478 | 485 |
479 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; | 486 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; |
480 | 487 |
| 488 chromeos::system::MockStatisticsProvider mock_statistics_provider_; |
| 489 |
481 policy::BrowserPolicyConnector* connector_; | 490 policy::BrowserPolicyConnector* connector_; |
482 | 491 |
483 // Initialized after |mock_dbus_thread_manager_| is set up. | 492 // Initialized after |mock_dbus_thread_manager_| is set up. |
484 scoped_ptr<ScopedTestDeviceSettingsService> test_device_settings_service_; | 493 scoped_ptr<ScopedTestDeviceSettingsService> test_device_settings_service_; |
485 scoped_ptr<ScopedTestCrosSettings> test_cros_settings_; | 494 scoped_ptr<ScopedTestCrosSettings> test_cros_settings_; |
486 scoped_ptr<ScopedTestUserManager> test_user_manager_; | 495 scoped_ptr<ScopedTestUserManager> test_user_manager_; |
487 | 496 |
488 Profile* prepared_profile_; | 497 Profile* prepared_profile_; |
489 | 498 |
490 base::Closure rlz_initialized_cb_; | 499 base::Closure rlz_initialized_cb_; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 683 } |
675 | 684 |
676 INSTANTIATE_TEST_CASE_P( | 685 INSTANTIATE_TEST_CASE_P( |
677 LoginUtilsBlockingLoginTestInstance, | 686 LoginUtilsBlockingLoginTestInstance, |
678 LoginUtilsBlockingLoginTest, | 687 LoginUtilsBlockingLoginTest, |
679 testing::Values(0, 1, 2, 3, 4, 5)); | 688 testing::Values(0, 1, 2, 3, 4, 5)); |
680 | 689 |
681 } // namespace | 690 } // namespace |
682 | 691 |
683 } // namespace chromeos | 692 } // namespace chromeos |
OLD | NEW |