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

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

Issue 14200028: Make CrosSettings and DeviceSettingsService non Lazy instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix LoginUtilsTest Created 7 years, 8 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.h" 11 #include "base/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/string_util.h" 15 #include "base/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/chromeos/cros/cros_library.h" 19 #include "chrome/browser/chromeos/cros/cros_library.h"
20 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 20 #include "chrome/browser/chromeos/cros/mock_cryptohome_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" 26 #include "chrome/browser/chromeos/net/connectivity_state_helper.h"
27 #include "chrome/browser/chromeos/net/mock_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" 28 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
29 #include "chrome/browser/chromeos/settings/cros_settings.h"
29 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 30 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
30 #include "chrome/browser/io_thread.h" 31 #include "chrome/browser/io_thread.h"
31 #include "chrome/browser/net/predictor.h" 32 #include "chrome/browser/net/predictor.h"
32 #include "chrome/browser/policy/browser_policy_connector.h" 33 #include "chrome/browser/policy/browser_policy_connector.h"
33 #include "chrome/browser/policy/cloud/device_management_service.h" 34 #include "chrome/browser/policy/cloud/device_management_service.h"
34 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h" 35 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h"
35 #include "chrome/browser/policy/policy_service.h" 36 #include "chrome/browser/policy/policy_service.h"
36 #include "chrome/browser/profiles/profile_manager.h" 37 #include "chrome/browser/profiles/profile_manager.h"
37 #include "chrome/browser/rlz/rlz.h" 38 #include "chrome/browser/rlz/rlz.h"
38 #include "chrome/common/chrome_notification_types.h" 39 #include "chrome/common/chrome_notification_types.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 .WillRepeatedly(DoAll(SetArgPointee<1>(kMode), 284 .WillRepeatedly(DoAll(SetArgPointee<1>(kMode),
284 Return(true))); 285 Return(true)));
285 EXPECT_CALL(*cryptohome_, InstallAttributesGet(kAttrEnterpriseDeviceId, _)) 286 EXPECT_CALL(*cryptohome_, InstallAttributesGet(kAttrEnterpriseDeviceId, _))
286 .WillRepeatedly(DoAll(SetArgPointee<1>(kDeviceId), 287 .WillRepeatedly(DoAll(SetArgPointee<1>(kDeviceId),
287 Return(true))); 288 Return(true)));
288 test_api->SetCryptohomeLibrary(cryptohome_, true); 289 test_api->SetCryptohomeLibrary(cryptohome_, true);
289 290
290 cryptohome_client_ = mock_dbus_thread_manager_.mock_cryptohome_client(); 291 cryptohome_client_ = mock_dbus_thread_manager_.mock_cryptohome_client();
291 EXPECT_CALL(*cryptohome_client_, IsMounted(_)); 292 EXPECT_CALL(*cryptohome_client_, IsMounted(_));
292 293
294 test_cros_settings_.reset(new ScopedTestCrosSettings);
295
293 browser_process_->SetProfileManager( 296 browser_process_->SetProfileManager(
294 new ProfileManagerWithoutInit(scoped_temp_dir_.path())); 297 new ProfileManagerWithoutInit(scoped_temp_dir_.path()));
295 connector_ = browser_process_->browser_policy_connector(); 298 connector_ = browser_process_->browser_policy_connector();
296 connector_->Init(local_state_.Get(), 299 connector_->Init(local_state_.Get(),
297 browser_process_->system_request_context()); 300 browser_process_->system_request_context());
298 301
299 io_thread_state_.reset(new IOThread(local_state_.Get(), 302 io_thread_state_.reset(new IOThread(local_state_.Get(),
300 browser_process_->policy_service(), 303 browser_process_->policy_service(),
301 NULL, NULL)); 304 NULL, NULL));
302 browser_process_->SetIOThread(io_thread_state_.get()); 305 browser_process_->SetIOThread(io_thread_state_.get());
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 input_method::MockInputMethodManager mock_input_method_manager_; 525 input_method::MockInputMethodManager mock_input_method_manager_;
523 disks::MockDiskMountManager mock_disk_mount_manager_; 526 disks::MockDiskMountManager mock_disk_mount_manager_;
524 net::TestURLFetcherFactory test_url_fetcher_factory_; 527 net::TestURLFetcherFactory test_url_fetcher_factory_;
525 MockConnectivityStateHelper mock_connectivity_state_helper_; 528 MockConnectivityStateHelper mock_connectivity_state_helper_;
526 529
527 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; 530 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_;
528 531
529 policy::BrowserPolicyConnector* connector_; 532 policy::BrowserPolicyConnector* connector_;
530 MockCryptohomeLibrary* cryptohome_; 533 MockCryptohomeLibrary* cryptohome_;
531 MockCryptohomeClient* cryptohome_client_; 534 MockCryptohomeClient* cryptohome_client_;
535
536 // Initialized after |mock_dbus_thread_manager_| and |croptohome_| are set up.
Mattias Nissler (ping if slow) 2013/04/16 16:09:51 fix typo
stevenjb 2013/04/16 16:49:43 Done.
537 scoped_ptr<ScopedTestCrosSettings> test_cros_settings_;
538
532 Profile* prepared_profile_; 539 Profile* prepared_profile_;
533 540
534 base::Closure rlz_initialized_cb_; 541 base::Closure rlz_initialized_cb_;
535 542
536 private: 543 private:
537 base::ScopedTempDir scoped_temp_dir_; 544 base::ScopedTempDir scoped_temp_dir_;
538 545
539 std::string device_policy_; 546 std::string device_policy_;
540 std::string user_policy_; 547 std::string user_policy_;
541 548
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 728 }
722 729
723 INSTANTIATE_TEST_CASE_P( 730 INSTANTIATE_TEST_CASE_P(
724 LoginUtilsBlockingLoginTestInstance, 731 LoginUtilsBlockingLoginTestInstance,
725 LoginUtilsBlockingLoginTest, 732 LoginUtilsBlockingLoginTest,
726 testing::Values(0, 1, 2, 3, 4, 5)); 733 testing::Values(0, 1, 2, 3, 4, 5));
727 734
728 } // namespace 735 } // namespace
729 736
730 } 737 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698