Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.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" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "base/time/clock.h" | 12 #include "base/time/clock.h" |
| 13 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory .h" | 13 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory .h" |
| 14 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 14 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
| 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/test/base/testing_browser_process.h" | 18 #include "chrome/test/base/testing_browser_process.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
| 20 #include "components/pref_registry/pref_registry_syncable.h" | 20 #include "components/pref_registry/pref_registry_syncable.h" |
| 21 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
| 22 #include "components/prefs/testing_pref_service.h" | 22 #include "components/prefs/testing_pref_service.h" |
| 23 #include "extensions/browser/quota_service.h" | |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 26 |
| 26 using testing::Mock; | 27 using testing::Mock; |
| 27 using testing::Return; | 28 using testing::Return; |
| 28 using testing::Sequence; | 29 using testing::Sequence; |
| 29 using testing::_; | 30 using testing::_; |
| 30 | 31 |
| 31 namespace chromeos { | 32 namespace chromeos { |
| 32 | 33 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 45 | 46 |
| 46 void DestroyLimiter(); | 47 void DestroyLimiter(); |
| 47 void CreateLimiter(); | 48 void CreateLimiter(); |
| 48 | 49 |
| 49 void SetUpUserManager(); | 50 void SetUpUserManager(); |
| 50 | 51 |
| 51 const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUser); | 52 const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUser); |
| 52 | 53 |
| 53 TestingPrefServiceSimple* GetTestingLocalState(); | 54 TestingPrefServiceSimple* GetTestingLocalState(); |
| 54 | 55 |
| 56 extensions::QuotaService::ScopedDisablePurgeForTesting | |
|
achuithb
2016/06/30 10:06:29
comment would be nice
| |
| 57 disable_purge_for_testing_; | |
| 58 | |
| 55 scoped_refptr<base::TestSimpleTaskRunner> runner_; | 59 scoped_refptr<base::TestSimpleTaskRunner> runner_; |
| 56 base::ThreadTaskRunnerHandle runner_handle_; | 60 base::ThreadTaskRunnerHandle runner_handle_; |
| 57 | 61 |
| 58 MockUserManager* user_manager_; // Not owned. | 62 MockUserManager* user_manager_; // Not owned. |
| 59 ScopedUserManagerEnabler user_manager_enabler_; | 63 ScopedUserManagerEnabler user_manager_enabler_; |
| 60 | 64 |
| 61 std::unique_ptr<TestingProfile> profile_; | 65 std::unique_ptr<TestingProfile> profile_; |
| 62 base::SimpleTestClock clock_; | 66 base::SimpleTestClock clock_; |
| 63 | 67 |
| 64 SAMLOfflineSigninLimiter* limiter_; // Owned. | 68 SAMLOfflineSigninLimiter* limiter_; // Owned. |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 EXPECT_CALL(*user_manager_, SaveForceOnlineSignin(test_account_id_, true)) | 652 EXPECT_CALL(*user_manager_, SaveForceOnlineSignin(test_account_id_, true)) |
| 649 .Times(1); | 653 .Times(1); |
| 650 limiter_->SignedIn(UserContext::AUTH_FLOW_OFFLINE); | 654 limiter_->SignedIn(UserContext::AUTH_FLOW_OFFLINE); |
| 651 | 655 |
| 652 const base::Time last_gaia_signin_time = base::Time::FromInternalValue( | 656 const base::Time last_gaia_signin_time = base::Time::FromInternalValue( |
| 653 prefs->GetInt64(prefs::kSAMLLastGAIASignInTime)); | 657 prefs->GetInt64(prefs::kSAMLLastGAIASignInTime)); |
| 654 EXPECT_EQ(gaia_signin_time, last_gaia_signin_time); | 658 EXPECT_EQ(gaia_signin_time, last_gaia_signin_time); |
| 655 } | 659 } |
| 656 | 660 |
| 657 } // namespace chromeos | 661 } // namespace chromeos |
| OLD | NEW |