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

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: rebase, remove blocking GetOwnershipStatus() 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/login_status_consumer.h" 19 #include "chrome/browser/chromeos/login/login_status_consumer.h"
20 #include "chrome/browser/chromeos/login/user_manager.h" 20 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/chromeos/settings/device_settings_test_helper.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"
29 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 30 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
30 #include "chrome/common/net/gaia/gaia_urls.h" 31 #include "chrome/common/net/gaia/gaia_urls.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 policy::CloudPolicyDataStore* device_data_store = 282 policy::CloudPolicyDataStore* device_data_store =
282 connector_->GetDeviceCloudPolicyDataStore(); 283 connector_->GetDeviceCloudPolicyDataStore();
283 device_data_store->set_device_mode(policy::DEVICE_MODE_ENTERPRISE); 284 device_data_store->set_device_mode(policy::DEVICE_MODE_ENTERPRISE);
284 device_data_store->set_device_id(kDeviceId); 285 device_data_store->set_device_id(kDeviceId);
285 EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS, 286 EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS,
286 connector_->LockDevice(username)); 287 connector_->LockDevice(username));
287 RunAllPending(); 288 RunAllPending();
288 } 289 }
289 290
290 void PrepareProfile(const std::string& username) { 291 void PrepareProfile(const std::string& username) {
291 MockSessionManagerClient* session_managed_client = 292 ScopedDeviceSettingsTestHelper device_settings_test_helper;
293 MockSessionManagerClient* session_manager_client =
292 mock_dbus_thread_manager_.mock_session_manager_client(); 294 mock_dbus_thread_manager_.mock_session_manager_client();
293 EXPECT_CALL(*session_managed_client, StartSession(_)); 295 EXPECT_CALL(*session_manager_client, StartSession(_));
294 EXPECT_CALL(*cryptohome_, GetSystemSalt()) 296 EXPECT_CALL(*cryptohome_, GetSystemSalt())
295 .WillRepeatedly(Return(std::string("stub_system_salt"))); 297 .WillRepeatedly(Return(std::string("stub_system_salt")));
296 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) 298 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _))
297 .WillRepeatedly(Return()); 299 .WillRepeatedly(Return());
298 300
299 scoped_refptr<Authenticator> authenticator = 301 scoped_refptr<Authenticator> authenticator =
300 LoginUtils::Get()->CreateAuthenticator(this); 302 LoginUtils::Get()->CreateAuthenticator(this);
301 authenticator->CompleteLogin(ProfileManager::GetDefaultProfile(), 303 authenticator->CompleteLogin(ProfileManager::GetDefaultProfile(),
302 username, 304 username,
303 "password"); 305 "password");
304 306
305 LoginUtils::Get()->PrepareProfile(username, std::string(), "password", 307 LoginUtils::Get()->PrepareProfile(username, std::string(), "password",
306 false, true, false, this); 308 false, true, false, this);
309 device_settings_test_helper.Flush();
307 RunAllPending(); 310 RunAllPending();
308 } 311 }
309 312
310 net::TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) { 313 net::TestURLFetcher* PrepareOAuthFetcher(const std::string& expected_url) {
311 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0); 314 net::TestURLFetcher* fetcher = test_url_fetcher_factory_.GetFetcherByID(0);
312 EXPECT_TRUE(fetcher); 315 EXPECT_TRUE(fetcher);
313 EXPECT_TRUE(fetcher->delegate()); 316 EXPECT_TRUE(fetcher->delegate());
314 EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(), 317 EXPECT_TRUE(StartsWithASCII(fetcher->GetOriginalURL().spec(),
315 expected_url, 318 expected_url,
316 true)); 319 true));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 515 }
513 516
514 INSTANTIATE_TEST_CASE_P( 517 INSTANTIATE_TEST_CASE_P(
515 LoginUtilsBlockingLoginTestInstance, 518 LoginUtilsBlockingLoginTestInstance,
516 LoginUtilsBlockingLoginTest, 519 LoginUtilsBlockingLoginTest,
517 testing::Values(0, 1, 2, 3, 4, 5)); 520 testing::Values(0, 1, 2, 3, 4, 5));
518 521
519 } // namespace 522 } // namespace
520 523
521 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698