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

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

Issue 10832035: Switch from SignedSettings to DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More test fixing... Created 8 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/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/cryptohome/mock_async_method_caller.h" 16 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h"
17 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 17 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
18 #include "chrome/browser/chromeos/login/authenticator.h" 18 #include "chrome/browser/chromeos/login/authenticator.h"
19 #include "chrome/browser/chromeos/login/device_settings_test_helper.h"
19 #include "chrome/browser/chromeos/login/login_status_consumer.h" 20 #include "chrome/browser/chromeos/login/login_status_consumer.h"
20 #include "chrome/browser/chromeos/login/user_manager.h" 21 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/io_thread.h" 22 #include "chrome/browser/io_thread.h"
22 #include "chrome/browser/net/predictor.h" 23 #include "chrome/browser/net/predictor.h"
23 #include "chrome/browser/policy/browser_policy_connector.h" 24 #include "chrome/browser/policy/browser_policy_connector.h"
24 #include "chrome/browser/policy/cloud_policy_data_store.h" 25 #include "chrome/browser/policy/cloud_policy_data_store.h"
25 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 26 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
26 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
27 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 policy::CloudPolicyDataStore* device_data_store = 284 policy::CloudPolicyDataStore* device_data_store =
284 connector_->GetDeviceCloudPolicyDataStore(); 285 connector_->GetDeviceCloudPolicyDataStore();
285 device_data_store->set_device_mode(policy::DEVICE_MODE_ENTERPRISE); 286 device_data_store->set_device_mode(policy::DEVICE_MODE_ENTERPRISE);
286 device_data_store->set_device_id(kDeviceId); 287 device_data_store->set_device_id(kDeviceId);
287 EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS, 288 EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS,
288 connector_->LockDevice(username)); 289 connector_->LockDevice(username));
289 RunAllPending(); 290 RunAllPending();
290 } 291 }
291 292
292 void PrepareProfile(const std::string& username) { 293 void PrepareProfile(const std::string& username) {
293 MockSessionManagerClient* session_managed_client = 294 ScopedDeviceSettingsTestHelper device_settings_test_helper;
295 MockSessionManagerClient* session_manager_client =
294 mock_dbus_thread_manager_.mock_session_manager_client(); 296 mock_dbus_thread_manager_.mock_session_manager_client();
295 EXPECT_CALL(*session_managed_client, StartSession(_)); 297 EXPECT_CALL(*session_manager_client, StartSession(_));
296 EXPECT_CALL(*cryptohome_, GetSystemSalt()) 298 EXPECT_CALL(*cryptohome_, GetSystemSalt())
297 .WillRepeatedly(Return(std::string("stub_system_salt"))); 299 .WillRepeatedly(Return(std::string("stub_system_salt")));
298 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) 300 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _))
299 .WillRepeatedly(Return()); 301 .WillRepeatedly(Return());
300 302
301 scoped_refptr<Authenticator> authenticator = 303 scoped_refptr<Authenticator> authenticator =
302 LoginUtils::Get()->CreateAuthenticator(this); 304 LoginUtils::Get()->CreateAuthenticator(this);
303 authenticator->CompleteLogin(ProfileManager::GetDefaultProfile(), 305 authenticator->CompleteLogin(ProfileManager::GetDefaultProfile(),
304 username, 306 username,
305 "password"); 307 "password");
306 308
307 LoginUtils::Get()->PrepareProfile(username, std::string(), "password", 309 LoginUtils::Get()->PrepareProfile(username, std::string(), "password",
308 false, true, false, this); 310 false, true, false, this);
311 device_settings_test_helper.Flush();
309 RunAllPending(); 312 RunAllPending();
310 } 313 }
311 314
312 net::TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) { 315 net::TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) {
313 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0); 316 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0);
314 EXPECT_TRUE(fetcher); 317 EXPECT_TRUE(fetcher);
315 EXPECT_TRUE(fetcher->delegate()); 318 EXPECT_TRUE(fetcher->delegate());
316 EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(), 319 EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(),
317 expected_url, 320 expected_url,
318 true)); 321 true));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 517 }
515 518
516 INSTANTIATE_TEST_CASE_P( 519 INSTANTIATE_TEST_CASE_P(
517 LoginUtilsBlockingLoginTestInstance, 520 LoginUtilsBlockingLoginTestInstance,
518 LoginUtilsBlockingLoginTest, 521 LoginUtilsBlockingLoginTest,
519 testing::Values(0, 1, 2, 3, 4, 5)); 522 testing::Values(0, 1, 2, 3, 4, 5));
520 523
521 } // namespace 524 } // namespace
522 525
523 } 526 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698