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

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

Issue 146193005: Reland 251352 "cros: Enable multiprofile for everyone." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests compile and remove unneeded header Created 6 years, 10 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 "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" 5 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/test/simple_test_clock.h" 9 #include "base/test/simple_test_clock.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 limiter_ = NULL; 77 limiter_ = NULL;
78 } 78 }
79 } 79 }
80 80
81 void SAMLOfflineSigninLimiterTest::CreateLimiter() { 81 void SAMLOfflineSigninLimiterTest::CreateLimiter() {
82 DestroyLimiter(); 82 DestroyLimiter();
83 limiter_ = new SAMLOfflineSigninLimiter(profile_.get(), &clock_); 83 limiter_ = new SAMLOfflineSigninLimiter(profile_.get(), &clock_);
84 } 84 }
85 85
86 void SAMLOfflineSigninLimiterTest::SetUp() { 86 void SAMLOfflineSigninLimiterTest::SetUp() {
87 const UserList user_list;
88 EXPECT_CALL(*user_manager_, GetLoggedInUsers())
89 .Times(1)
90 .WillOnce(ReturnRef(user_list));
91 profile_.reset(new TestingProfile); 87 profile_.reset(new TestingProfile);
92 Mock::VerifyAndClearExpectations(user_manager_);
93 88
94 SAMLOfflineSigninLimiterFactory::SetClockForTesting(&clock_); 89 SAMLOfflineSigninLimiterFactory::SetClockForTesting(&clock_);
95 user_manager_->AddUser(kTestUser); 90 user_manager_->AddUser(kTestUser);
96 profile_->set_profile_name(kTestUser); 91 profile_->set_profile_name(kTestUser);
97 clock_.Advance(base::TimeDelta::FromHours(1)); 92 clock_.Advance(base::TimeDelta::FromHours(1));
98 } 93 }
99 94
100 void SAMLOfflineSigninLimiterTest::TearDown() { 95 void SAMLOfflineSigninLimiterTest::TearDown() {
101 SAMLOfflineSigninLimiterFactory::SetClockForTesting(NULL); 96 SAMLOfflineSigninLimiterFactory::SetClockForTesting(NULL);
102 } 97 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 EXPECT_CALL(*user_manager_, SaveForceOnlineSignin(kTestUser, false)).Times(0); 568 EXPECT_CALL(*user_manager_, SaveForceOnlineSignin(kTestUser, false)).Times(0);
574 EXPECT_CALL(*user_manager_, SaveForceOnlineSignin(kTestUser, true)).Times(1); 569 EXPECT_CALL(*user_manager_, SaveForceOnlineSignin(kTestUser, true)).Times(1);
575 limiter_->SignedIn(UserContext::AUTH_FLOW_OFFLINE); 570 limiter_->SignedIn(UserContext::AUTH_FLOW_OFFLINE);
576 571
577 const base::Time last_gaia_signin_time = base::Time::FromInternalValue( 572 const base::Time last_gaia_signin_time = base::Time::FromInternalValue(
578 prefs->GetInt64(prefs::kSAMLLastGAIASignInTime)); 573 prefs->GetInt64(prefs::kSAMLLastGAIASignInTime));
579 EXPECT_EQ(gaia_signin_time, last_gaia_signin_time); 574 EXPECT_EQ(gaia_signin_time, last_gaia_signin_time);
580 } 575 }
581 576
582 } // namespace chromeos 577 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698