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

Side by Side Diff: chrome/browser/chromeos/login/saml/saml_browsertest.cc

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 SetSignFormField("Email", "fake_user"); 521 SetSignFormField("Email", "fake_user");
522 SetSignFormField("Password", "fake_password"); 522 SetSignFormField("Password", "fake_password");
523 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); 523 ExecuteJsInSigninFrame("document.getElementById('Submit').click();");
524 524
525 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); 525 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait();
526 526
527 SendConfirmPassword("fake_password"); 527 SendConfirmPassword("fake_password");
528 content::WindowedNotificationObserver( 528 content::WindowedNotificationObserver(
529 chrome::NOTIFICATION_SESSION_STARTED, 529 chrome::NOTIFICATION_SESSION_STARTED,
530 content::NotificationService::AllSources()).Wait(); 530 content::NotificationService::AllSources()).Wait();
531 const User* user = UserManager::Get()->GetActiveUser(); 531 const User* user = GetUserManager()->GetActiveUser();
532 ASSERT_TRUE(user); 532 ASSERT_TRUE(user);
533 EXPECT_EQ(kFirstSAMLUserEmail, user->email()); 533 EXPECT_EQ(kFirstSAMLUserEmail, user->email());
534 } 534 }
535 535
536 // Verifies that if the authenticated user's e-mail address cannot be retrieved, 536 // Verifies that if the authenticated user's e-mail address cannot be retrieved,
537 // an error message is shown. 537 // an error message is shown.
538 IN_PROC_BROWSER_TEST_F(SamlTest, FailToRetrieveAutenticatedUserEmailAddress) { 538 IN_PROC_BROWSER_TEST_F(SamlTest, FailToRetrieveAutenticatedUserEmailAddress) {
539 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); 539 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html");
540 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); 540 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail);
541 541
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 637
638 EXPECT_CALL(provider_, IsInitializationComplete(_)) 638 EXPECT_CALL(provider_, IsInitializationComplete(_))
639 .WillRepeatedly(Return(true)); 639 .WillRepeatedly(Return(true));
640 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 640 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
641 } 641 }
642 642
643 void SAMLPolicyTest::SetUpOnMainThread() { 643 void SAMLPolicyTest::SetUpOnMainThread() {
644 SamlTest::SetUpOnMainThread(); 644 SamlTest::SetUpOnMainThread();
645 645
646 // Pretend that the test users' OAuth tokens are valid. 646 // Pretend that the test users' OAuth tokens are valid.
647 UserManager::Get()->SaveUserOAuthStatus(kFirstSAMLUserEmail, 647 GetUserManager()->SaveUserOAuthStatus(kFirstSAMLUserEmail,
648 User::OAUTH2_TOKEN_STATUS_VALID); 648 User::OAUTH2_TOKEN_STATUS_VALID);
649 UserManager::Get()->SaveUserOAuthStatus(kNonSAMLUserEmail, 649 GetUserManager()->SaveUserOAuthStatus(kNonSAMLUserEmail,
650 User::OAUTH2_TOKEN_STATUS_VALID); 650 User::OAUTH2_TOKEN_STATUS_VALID);
651 } 651 }
652 652
653 void SAMLPolicyTest::SetSAMLOfflineSigninTimeLimitPolicy(int limit) { 653 void SAMLPolicyTest::SetSAMLOfflineSigninTimeLimitPolicy(int limit) {
654 policy::PolicyMap policy; 654 policy::PolicyMap policy;
655 policy.Set(policy::key::kSAMLOfflineSigninTimeLimit, 655 policy.Set(policy::key::kSAMLOfflineSigninTimeLimit,
656 policy::POLICY_LEVEL_MANDATORY, 656 policy::POLICY_LEVEL_MANDATORY,
657 policy::POLICY_SCOPE_USER, 657 policy::POLICY_SCOPE_USER,
658 new base::FundamentalValue(limit), 658 new base::FundamentalValue(limit),
659 NULL); 659 NULL);
660 provider_.UpdateChromePolicy(policy); 660 provider_.UpdateChromePolicy(policy);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 733
734 // Verifies that when the offline login time limit is exceeded for a user who 734 // Verifies that when the offline login time limit is exceeded for a user who
735 // authenticated via SAML, that user is forced to log in online the next time. 735 // authenticated via SAML, that user is forced to log in online the next time.
736 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) { 736 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) {
737 login_screen_load_observer_->Wait(); 737 login_screen_load_observer_->Wait();
738 // Verify that offline login is not allowed. 738 // Verify that offline login is not allowed.
739 JsExpect("!document.querySelector('#pod-row .signin-button').hidden"); 739 JsExpect("!document.querySelector('#pod-row .signin-button').hidden");
740 } 740 }
741 741
742 } // namespace chromeos 742 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698