OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/signin/ios/browser/account_consistency_service.h" | 5 #include "components/signin/ios/browser/account_consistency_service.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
12 #include "components/pref_registry/testing_pref_service_syncable.h" | |
13 #include "components/signin/core/browser/account_reconcilor.h" | 12 #include "components/signin/core/browser/account_reconcilor.h" |
14 #include "components/signin/core/browser/account_tracker_service.h" | 13 #include "components/signin/core/browser/account_tracker_service.h" |
15 #include "components/signin/core/browser/fake_signin_manager.h" | 14 #include "components/signin/core/browser/fake_signin_manager.h" |
16 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 15 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
17 #include "components/signin/core/browser/test_signin_client.h" | 16 #include "components/signin/core/browser/test_signin_client.h" |
18 #include "components/signin/core/common/signin_pref_names.h" | 17 #include "components/signin/core/common/signin_pref_names.h" |
| 18 #include "components/sync_preferences/testing_pref_service_syncable.h" |
19 #include "google_apis/gaia/gaia_constants.h" | 19 #include "google_apis/gaia/gaia_constants.h" |
20 #include "ios/web/public/test/test_browser_state.h" | 20 #include "ios/web/public/test/test_browser_state.h" |
21 #include "ios/web/public/test/test_web_state.h" | 21 #include "ios/web/public/test/test_web_state.h" |
22 #include "ios/web/public/test/test_web_thread_bundle.h" | 22 #include "ios/web/public/test/test_web_thread_bundle.h" |
23 #include "ios/web/public/web_state/web_state_policy_decider.h" | 23 #include "ios/web/public/web_state/web_state_policy_decider.h" |
24 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 #include "testing/platform_test.h" | 26 #include "testing/platform_test.h" |
27 #include "third_party/ocmock/OCMock/OCMock.h" | 27 #include "third_party/ocmock/OCMock/OCMock.h" |
28 #include "third_party/ocmock/gtest_support.h" | 28 #include "third_party/ocmock/gtest_support.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 account_consistency_service_->last_cookie_update_map_.count(domain), | 195 account_consistency_service_->last_cookie_update_map_.count(domain), |
196 1u); | 196 1u); |
197 } | 197 } |
198 | 198 |
199 // Creates test threads, necessary for ActiveStateManager that needs a UI | 199 // Creates test threads, necessary for ActiveStateManager that needs a UI |
200 // thread. | 200 // thread. |
201 web::TestWebThreadBundle thread_bundle_; | 201 web::TestWebThreadBundle thread_bundle_; |
202 MockAccountReconcilor account_reconcilor_; | 202 MockAccountReconcilor account_reconcilor_; |
203 AccountTrackerService account_tracker_service_; | 203 AccountTrackerService account_tracker_service_; |
204 web::TestBrowserState browser_state_; | 204 web::TestBrowserState browser_state_; |
205 user_prefs::TestingPrefServiceSyncable prefs_; | 205 sync_preferences::TestingPrefServiceSyncable prefs_; |
206 TestWebState web_state_; | 206 TestWebState web_state_; |
207 // AccountConsistencyService being tested. Actually a | 207 // AccountConsistencyService being tested. Actually a |
208 // FakeAccountConsistencyService to be able to use a mock web view. | 208 // FakeAccountConsistencyService to be able to use a mock web view. |
209 std::unique_ptr<AccountConsistencyService> account_consistency_service_; | 209 std::unique_ptr<AccountConsistencyService> account_consistency_service_; |
210 std::unique_ptr<TestSigninClient> signin_client_; | 210 std::unique_ptr<TestSigninClient> signin_client_; |
211 std::unique_ptr<FakeSigninManager> signin_manager_; | 211 std::unique_ptr<FakeSigninManager> signin_manager_; |
212 std::unique_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_; | 212 std::unique_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_; |
213 scoped_refptr<HostContentSettingsMap> settings_map_; | 213 scoped_refptr<HostContentSettingsMap> settings_map_; |
214 scoped_refptr<content_settings::CookieSettings> cookie_settings_; | 214 scoped_refptr<content_settings::CookieSettings> cookie_settings_; |
215 }; | 215 }; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // Tests that main domains are added to the internal map when cookies are set in | 439 // Tests that main domains are added to the internal map when cookies are set in |
440 // reaction to signin. | 440 // reaction to signin. |
441 TEST_F(AccountConsistencyServiceTest, SigninAddCookieOnMainDomains) { | 441 TEST_F(AccountConsistencyServiceTest, SigninAddCookieOnMainDomains) { |
442 AddPageLoadedExpectation(kGoogleUrl, true /* continue_navigation */); | 442 AddPageLoadedExpectation(kGoogleUrl, true /* continue_navigation */); |
443 AddPageLoadedExpectation(kYoutubeUrl, true /* continue_navigation */); | 443 AddPageLoadedExpectation(kYoutubeUrl, true /* continue_navigation */); |
444 SignIn(); | 444 SignIn(); |
445 | 445 |
446 CheckDomainHasCookie(kGoogleDomain); | 446 CheckDomainHasCookie(kGoogleDomain); |
447 CheckDomainHasCookie(kYoutubeDomain); | 447 CheckDomainHasCookie(kYoutubeDomain); |
448 } | 448 } |
OLD | NEW |