| 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/signin/mutable_profile_oauth2_token_service_delegate.h" | 5 #include "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/test/scoped_task_environment.h" | |
| 16 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 18 #include "components/os_crypt/os_crypt_mocker.h" | 17 #include "components/os_crypt/os_crypt_mocker.h" |
| 19 #include "components/prefs/pref_registry_simple.h" | 18 #include "components/prefs/pref_registry_simple.h" |
| 20 #include "components/prefs/scoped_user_pref_update.h" | 19 #include "components/prefs/scoped_user_pref_update.h" |
| 21 #include "components/prefs/testing_pref_service.h" | 20 #include "components/prefs/testing_pref_service.h" |
| 22 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 21 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 23 #include "components/signin/core/browser/signin_error_controller.h" | 22 #include "components/signin/core/browser/signin_error_controller.h" |
| 24 #include "components/signin/core/browser/test_signin_client.h" | 23 #include "components/signin/core/browser/test_signin_client.h" |
| 25 #include "components/signin/core/browser/webdata/token_web_data.h" | 24 #include "components/signin/core/browser/webdata/token_web_data.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 144 } |
| 146 | 145 |
| 147 void ExpectOneTokensLoadedNotification() { | 146 void ExpectOneTokensLoadedNotification() { |
| 148 EXPECT_EQ(0, token_available_count_); | 147 EXPECT_EQ(0, token_available_count_); |
| 149 EXPECT_EQ(0, token_revoked_count_); | 148 EXPECT_EQ(0, token_revoked_count_); |
| 150 EXPECT_EQ(1, tokens_loaded_count_); | 149 EXPECT_EQ(1, tokens_loaded_count_); |
| 151 ResetObserverCounts(); | 150 ResetObserverCounts(); |
| 152 } | 151 } |
| 153 | 152 |
| 154 protected: | 153 protected: |
| 155 base::test::ScopedTaskEnvironment scoped_task_environment_; | 154 base::MessageLoop message_loop_; |
| 156 net::FakeURLFetcherFactory factory_; | 155 net::FakeURLFetcherFactory factory_; |
| 157 std::unique_ptr<TestSigninClient> client_; | 156 std::unique_ptr<TestSigninClient> client_; |
| 158 std::unique_ptr<MutableProfileOAuth2TokenServiceDelegate> | 157 std::unique_ptr<MutableProfileOAuth2TokenServiceDelegate> |
| 159 oauth2_service_delegate_; | 158 oauth2_service_delegate_; |
| 160 TestingOAuth2TokenServiceConsumer consumer_; | 159 TestingOAuth2TokenServiceConsumer consumer_; |
| 161 SigninErrorController signin_error_controller_; | 160 SigninErrorController signin_error_controller_; |
| 162 TestingPrefServiceSimple pref_service_; | 161 TestingPrefServiceSimple pref_service_; |
| 163 AccountTrackerService account_tracker_service_; | 162 AccountTrackerService account_tracker_service_; |
| 164 int access_token_success_count_; | 163 int access_token_success_count_; |
| 165 int access_token_failure_count_; | 164 int access_token_failure_count_; |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 EXPECT_EQ(1, tokens_loaded_count_); | 711 EXPECT_EQ(1, tokens_loaded_count_); |
| 713 EXPECT_EQ(2, token_available_count_); | 712 EXPECT_EQ(2, token_available_count_); |
| 714 EXPECT_EQ(0, token_revoked_count_); | 713 EXPECT_EQ(0, token_revoked_count_); |
| 715 EXPECT_EQ(1, start_batch_changes_); | 714 EXPECT_EQ(1, start_batch_changes_); |
| 716 EXPECT_EQ(1, end_batch_changes_); | 715 EXPECT_EQ(1, end_batch_changes_); |
| 717 EXPECT_TRUE( | 716 EXPECT_TRUE( |
| 718 oauth2_service_delegate_->RefreshTokenIsAvailable(primary_account)); | 717 oauth2_service_delegate_->RefreshTokenIsAvailable(primary_account)); |
| 719 EXPECT_TRUE( | 718 EXPECT_TRUE( |
| 720 oauth2_service_delegate_->RefreshTokenIsAvailable(secondary_account)); | 719 oauth2_service_delegate_->RefreshTokenIsAvailable(secondary_account)); |
| 721 } | 720 } |
| OLD | NEW |