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

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

Issue 9355059: Renaming virtual setters/getters in UserManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: year Created 8 years, 9 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"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 class LoginUtilsTest : public LoginUtilsTestBase<testing::Test> { 370 class LoginUtilsTest : public LoginUtilsTestBase<testing::Test> {
371 }; 371 };
372 372
373 class LoginUtilsBlockingLoginTest 373 class LoginUtilsBlockingLoginTest
374 : public LoginUtilsTestBase<testing::TestWithParam<int> > { 374 : public LoginUtilsTestBase<testing::TestWithParam<int> > {
375 }; 375 };
376 376
377 TEST_F(LoginUtilsTest, NormalLoginDoesntBlock) { 377 TEST_F(LoginUtilsTest, NormalLoginDoesntBlock) {
378 UserManager* user_manager = UserManager::Get(); 378 UserManager* user_manager = UserManager::Get();
379 EXPECT_FALSE(user_manager->user_is_logged_in()); 379 EXPECT_FALSE(user_manager->IsUserLoggedIn());
380 EXPECT_FALSE(connector_->IsEnterpriseManaged()); 380 EXPECT_FALSE(connector_->IsEnterpriseManaged());
381 EXPECT_FALSE(prepared_profile_); 381 EXPECT_FALSE(prepared_profile_);
382 382
383 // The profile will be created without waiting for a policy response. 383 // The profile will be created without waiting for a policy response.
384 PrepareProfile(kUsername); 384 PrepareProfile(kUsername);
385 385
386 EXPECT_TRUE(prepared_profile_); 386 EXPECT_TRUE(prepared_profile_);
387 EXPECT_TRUE(user_manager->user_is_logged_in()); 387 EXPECT_TRUE(user_manager->IsUserLoggedIn());
388 EXPECT_EQ(kUsername, user_manager->logged_in_user().email()); 388 EXPECT_EQ(kUsername, user_manager->GetLoggedInUser().email());
389 } 389 }
390 390
391 TEST_F(LoginUtilsTest, EnterpriseLoginDoesntBlockForNormalUser) { 391 TEST_F(LoginUtilsTest, EnterpriseLoginDoesntBlockForNormalUser) {
392 UserManager* user_manager = UserManager::Get(); 392 UserManager* user_manager = UserManager::Get();
393 EXPECT_FALSE(user_manager->user_is_logged_in()); 393 EXPECT_FALSE(user_manager->IsUserLoggedIn());
394 EXPECT_FALSE(connector_->IsEnterpriseManaged()); 394 EXPECT_FALSE(connector_->IsEnterpriseManaged());
395 EXPECT_FALSE(prepared_profile_); 395 EXPECT_FALSE(prepared_profile_);
396 396
397 // Enroll the device. 397 // Enroll the device.
398 LockDevice(kUsername); 398 LockDevice(kUsername);
399 399
400 EXPECT_FALSE(user_manager->user_is_logged_in()); 400 EXPECT_FALSE(user_manager->IsUserLoggedIn());
401 EXPECT_TRUE(connector_->IsEnterpriseManaged()); 401 EXPECT_TRUE(connector_->IsEnterpriseManaged());
402 EXPECT_EQ(kDomain, connector_->GetEnterpriseDomain()); 402 EXPECT_EQ(kDomain, connector_->GetEnterpriseDomain());
403 EXPECT_FALSE(prepared_profile_); 403 EXPECT_FALSE(prepared_profile_);
404 404
405 // Login with a non-enterprise user shouldn't block. 405 // Login with a non-enterprise user shouldn't block.
406 PrepareProfile(kUsernameOtherDomain); 406 PrepareProfile(kUsernameOtherDomain);
407 407
408 EXPECT_TRUE(prepared_profile_); 408 EXPECT_TRUE(prepared_profile_);
409 EXPECT_TRUE(user_manager->user_is_logged_in()); 409 EXPECT_TRUE(user_manager->IsUserLoggedIn());
410 EXPECT_EQ(kUsernameOtherDomain, user_manager->logged_in_user().email()); 410 EXPECT_EQ(kUsernameOtherDomain, user_manager->GetLoggedInUser().email());
411 } 411 }
412 412
413 TEST_P(LoginUtilsBlockingLoginTest, EnterpriseLoginBlocksForEnterpriseUser) { 413 TEST_P(LoginUtilsBlockingLoginTest, EnterpriseLoginBlocksForEnterpriseUser) {
414 UserManager* user_manager = UserManager::Get(); 414 UserManager* user_manager = UserManager::Get();
415 EXPECT_FALSE(user_manager->user_is_logged_in()); 415 EXPECT_FALSE(user_manager->IsUserLoggedIn());
416 EXPECT_FALSE(connector_->IsEnterpriseManaged()); 416 EXPECT_FALSE(connector_->IsEnterpriseManaged());
417 EXPECT_FALSE(prepared_profile_); 417 EXPECT_FALSE(prepared_profile_);
418 418
419 // Enroll the device. 419 // Enroll the device.
420 LockDevice(kUsername); 420 LockDevice(kUsername);
421 421
422 EXPECT_FALSE(user_manager->user_is_logged_in()); 422 EXPECT_FALSE(user_manager->IsUserLoggedIn());
423 EXPECT_TRUE(connector_->IsEnterpriseManaged()); 423 EXPECT_TRUE(connector_->IsEnterpriseManaged());
424 EXPECT_EQ(kDomain, connector_->GetEnterpriseDomain()); 424 EXPECT_EQ(kDomain, connector_->GetEnterpriseDomain());
425 EXPECT_FALSE(prepared_profile_); 425 EXPECT_FALSE(prepared_profile_);
426 426
427 // Login with a user of the enterprise domain waits for policy. 427 // Login with a user of the enterprise domain waits for policy.
428 PrepareProfile(kUsername); 428 PrepareProfile(kUsername);
429 429
430 EXPECT_FALSE(prepared_profile_); 430 EXPECT_FALSE(prepared_profile_);
431 EXPECT_TRUE(user_manager->user_is_logged_in()); 431 EXPECT_TRUE(user_manager->IsUserLoggedIn());
432 432
433 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); 433 GaiaUrls* gaia_urls = GaiaUrls::GetInstance();
434 TestURLFetcher* fetcher; 434 TestURLFetcher* fetcher;
435 435
436 // |steps| is the test parameter, and is the number of successful fetches. 436 // |steps| is the test parameter, and is the number of successful fetches.
437 // The first incomplete fetch will fail. In any case, the profile creation 437 // The first incomplete fetch will fail. In any case, the profile creation
438 // should resume. 438 // should resume.
439 int steps = GetParam(); 439 int steps = GetParam();
440 440
441 do { 441 do {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 496 }
497 497
498 INSTANTIATE_TEST_CASE_P( 498 INSTANTIATE_TEST_CASE_P(
499 LoginUtilsBlockingLoginTestInstance, 499 LoginUtilsBlockingLoginTestInstance,
500 LoginUtilsBlockingLoginTest, 500 LoginUtilsBlockingLoginTest,
501 testing::Values(0, 1, 2, 3, 4, 5)); 501 testing::Values(0, 1, 2, 3, 4, 5));
502 502
503 } // namespace 503 } // namespace
504 504
505 } 505 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/mock_user_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698