Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: chrome/browser/chromeos/login/login_utils_browsertest.cc

Issue 22264004: Remove ConnectivityStateHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove redundant IsConnected() check Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/prefs/pref_registry_simple.h" 13 #include "base/prefs/pref_registry_simple.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/chromeos/cros/network_library.h" 20 #include "chrome/browser/chromeos/cros/network_library.h"
21 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 21 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
22 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 22 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
23 #include "chrome/browser/chromeos/login/authenticator.h" 23 #include "chrome/browser/chromeos/login/authenticator.h"
24 #include "chrome/browser/chromeos/login/login_status_consumer.h" 24 #include "chrome/browser/chromeos/login/login_status_consumer.h"
25 #include "chrome/browser/chromeos/login/user_manager.h" 25 #include "chrome/browser/chromeos/login/user_manager.h"
26 #include "chrome/browser/chromeos/net/connectivity_state_helper.h"
27 #include "chrome/browser/chromeos/net/mock_connectivity_state_helper.h"
28 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 26 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
29 #include "chrome/browser/chromeos/settings/cros_settings.h" 27 #include "chrome/browser/chromeos/settings/cros_settings.h"
30 #include "chrome/browser/chromeos/settings/device_settings_service.h" 28 #include "chrome/browser/chromeos/settings/device_settings_service.h"
31 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 29 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
32 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" 30 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h"
33 #include "chrome/browser/io_thread.h" 31 #include "chrome/browser/io_thread.h"
34 #include "chrome/browser/net/predictor.h" 32 #include "chrome/browser/net/predictor.h"
35 #include "chrome/browser/policy/browser_policy_connector.h" 33 #include "chrome/browser/policy/browser_policy_connector.h"
36 #include "chrome/browser/policy/cloud/device_management_service.h" 34 #include "chrome/browser/policy/cloud/device_management_service.h"
37 #include "chrome/browser/policy/policy_service.h" 35 #include "chrome/browser/policy/policy_service.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ::switches::kDeviceManagementUrl, kDMServer); 208 ::switches::kDeviceManagementUrl, kDMServer);
211 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 209 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
212 210
213 // DBusThreadManager should be initialized before io_thread_state_, as 211 // DBusThreadManager should be initialized before io_thread_state_, as
214 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, 212 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl,
215 // which is part of io_thread_state_. 213 // which is part of io_thread_state_.
216 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); 214 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_);
217 215
218 CryptohomeLibrary::Initialize(); 216 CryptohomeLibrary::Initialize();
219 LoginState::Initialize(); 217 LoginState::Initialize();
220 ConnectivityStateHelper::SetForTest(&mock_connectivity_state_helper_);
221 EXPECT_CALL(mock_connectivity_state_helper_, DefaultNetworkOnline())
222 .WillRepeatedly(Return(false));
223 218
224 mock_input_method_manager_ = new input_method::MockInputMethodManager(); 219 mock_input_method_manager_ = new input_method::MockInputMethodManager();
225 input_method::InitializeForTesting(mock_input_method_manager_); 220 input_method::InitializeForTesting(mock_input_method_manager_);
226 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); 221 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_);
227 mock_disk_mount_manager_.SetupDefaultReplies(); 222 mock_disk_mount_manager_.SetupDefaultReplies();
228 223
229 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; 224 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller;
230 cryptohome::AsyncMethodCaller::InitializeForTesting( 225 cryptohome::AsyncMethodCaller::InitializeForTesting(
231 mock_async_method_caller_); 226 mock_async_method_caller_);
232 227
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 302
308 test_user_manager_.reset(); 303 test_user_manager_.reset();
309 304
310 InvokeOnIO( 305 InvokeOnIO(
311 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); 306 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this)));
312 307
313 // LoginUtils instance must not outlive Profile instances. 308 // LoginUtils instance must not outlive Profile instances.
314 LoginUtils::Set(NULL); 309 LoginUtils::Set(NULL);
315 310
316 input_method::Shutdown(); 311 input_method::Shutdown();
317 ConnectivityStateHelper::SetForTest(NULL);
318 LoginState::Shutdown(); 312 LoginState::Shutdown();
319 CryptohomeLibrary::Shutdown(); 313 CryptohomeLibrary::Shutdown();
320 314
321 // These trigger some tasks that have to run while BrowserThread::UI 315 // These trigger some tasks that have to run while BrowserThread::UI
322 // exists. Delete all the profiles before deleting the connector. 316 // exists. Delete all the profiles before deleting the connector.
323 browser_process_->SetProfileManager(NULL); 317 browser_process_->SetProfileManager(NULL);
324 connector_ = NULL; 318 connector_ = NULL;
325 browser_process_->SetBrowserPolicyConnector(NULL); 319 browser_process_->SetBrowserPolicyConnector(NULL);
326 QuitIOLoop(); 320 QuitIOLoop();
327 RunUntilIdle(); 321 RunUntilIdle();
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 content::TestBrowserThread ui_thread_; 516 content::TestBrowserThread ui_thread_;
523 content::TestBrowserThread db_thread_; 517 content::TestBrowserThread db_thread_;
524 content::TestBrowserThread file_thread_; 518 content::TestBrowserThread file_thread_;
525 scoped_ptr<content::TestBrowserThread> io_thread_; 519 scoped_ptr<content::TestBrowserThread> io_thread_;
526 scoped_ptr<IOThread> io_thread_state_; 520 scoped_ptr<IOThread> io_thread_state_;
527 521
528 MockDBusThreadManagerWithoutGMock mock_dbus_thread_manager_; 522 MockDBusThreadManagerWithoutGMock mock_dbus_thread_manager_;
529 input_method::MockInputMethodManager* mock_input_method_manager_; 523 input_method::MockInputMethodManager* mock_input_method_manager_;
530 disks::MockDiskMountManager mock_disk_mount_manager_; 524 disks::MockDiskMountManager mock_disk_mount_manager_;
531 net::TestURLFetcherFactory test_url_fetcher_factory_; 525 net::TestURLFetcherFactory test_url_fetcher_factory_;
532 MockConnectivityStateHelper mock_connectivity_state_helper_;
533 526
534 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; 527 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_;
535 528
536 policy::BrowserPolicyConnector* connector_; 529 policy::BrowserPolicyConnector* connector_;
537 scoped_ptr<MockCryptohomeLibrary> cryptohome_; 530 scoped_ptr<MockCryptohomeLibrary> cryptohome_;
538 531
539 // Initialized after |mock_dbus_thread_manager_| and |cryptohome_| are set up. 532 // Initialized after |mock_dbus_thread_manager_| and |cryptohome_| are set up.
540 scoped_ptr<ScopedTestDeviceSettingsService> test_device_settings_service_; 533 scoped_ptr<ScopedTestDeviceSettingsService> test_device_settings_service_;
541 scoped_ptr<ScopedTestCrosSettings> test_cros_settings_; 534 scoped_ptr<ScopedTestCrosSettings> test_cros_settings_;
542 scoped_ptr<ScopedTestUserManager> test_user_manager_; 535 scoped_ptr<ScopedTestUserManager> test_user_manager_;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 } 723 }
731 724
732 INSTANTIATE_TEST_CASE_P( 725 INSTANTIATE_TEST_CASE_P(
733 LoginUtilsBlockingLoginTestInstance, 726 LoginUtilsBlockingLoginTestInstance,
734 LoginUtilsBlockingLoginTest, 727 LoginUtilsBlockingLoginTest,
735 testing::Values(0, 1, 2, 3, 4, 5)); 728 testing::Values(0, 1, 2, 3, 4, 5));
736 729
737 } // namespace 730 } // namespace
738 731
739 } // namespace chromeos 732 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | chrome/browser/chromeos/login/oauth2_login_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698