OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/core/browser/signin_manager.h" | 5 #include "components/signin/core/browser/signin_manager.h" |
6 | 6 |
| 7 #include <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
15 #include "base/prefs/scoped_user_pref_update.h" | 16 #include "base/prefs/scoped_user_pref_update.h" |
16 #include "base/prefs/testing_pref_service.h" | 17 #include "base/prefs/testing_pref_service.h" |
(...skipping 24 matching lines...) Expand all Loading... |
41 #include "content/public/browser/child_process_security_policy.h" | 42 #include "content/public/browser/child_process_security_policy.h" |
42 #include "content/public/browser/notification_source.h" | 43 #include "content/public/browser/notification_source.h" |
43 #include "content/public/test/test_browser_thread_bundle.h" | 44 #include "content/public/test/test_browser_thread_bundle.h" |
44 #include "google_apis/gaia/gaia_constants.h" | 45 #include "google_apis/gaia/gaia_constants.h" |
45 #include "google_apis/gaia/gaia_urls.h" | 46 #include "google_apis/gaia/gaia_urls.h" |
46 #include "net/cookies/cookie_monster.h" | 47 #include "net/cookies/cookie_monster.h" |
47 #include "net/url_request/test_url_fetcher_factory.h" | 48 #include "net/url_request/test_url_fetcher_factory.h" |
48 #include "net/url_request/url_request.h" | 49 #include "net/url_request/url_request.h" |
49 #include "net/url_request/url_request_context_getter.h" | 50 #include "net/url_request/url_request_context_getter.h" |
50 #include "net/url_request/url_request_status.h" | 51 #include "net/url_request/url_request_status.h" |
51 | |
52 #include "testing/gmock/include/gmock/gmock.h" | 52 #include "testing/gmock/include/gmock/gmock.h" |
53 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
54 | 54 |
55 namespace { | 55 namespace { |
56 | 56 |
57 scoped_ptr<KeyedService> SigninManagerBuild(content::BrowserContext* context) { | 57 scoped_ptr<KeyedService> SigninManagerBuild(content::BrowserContext* context) { |
58 Profile* profile = static_cast<Profile*>(context); | 58 Profile* profile = static_cast<Profile*>(context); |
59 scoped_ptr<SigninManager> service(new SigninManager( | 59 scoped_ptr<SigninManager> service(new SigninManager( |
60 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), | 60 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), |
61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
62 AccountTrackerServiceFactory::GetForProfile(profile), | 62 AccountTrackerServiceFactory::GetForProfile(profile), |
63 GaiaCookieManagerServiceFactory::GetForProfile(profile))); | 63 GaiaCookieManagerServiceFactory::GetForProfile(profile))); |
64 service->Initialize(NULL); | 64 service->Initialize(NULL); |
65 return service.Pass(); | 65 return std::move(service); |
66 } | 66 } |
67 | 67 |
68 class TestSigninManagerObserver : public SigninManagerBase::Observer { | 68 class TestSigninManagerObserver : public SigninManagerBase::Observer { |
69 public: | 69 public: |
70 TestSigninManagerObserver() : num_failed_signins_(0), | 70 TestSigninManagerObserver() : num_failed_signins_(0), |
71 num_successful_signins_(0), | 71 num_successful_signins_(0), |
72 num_signouts_(0) { | 72 num_signouts_(0) { |
73 } | 73 } |
74 | 74 |
75 ~TestSigninManagerObserver() override {} | 75 ~TestSigninManagerObserver() override {} |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 EXPECT_EQ(gaia_id, manager_->GetAuthenticatedAccountId()); | 585 EXPECT_EQ(gaia_id, manager_->GetAuthenticatedAccountId()); |
586 EXPECT_EQ(gaia_id, profile()->GetPrefs()->GetString( | 586 EXPECT_EQ(gaia_id, profile()->GetPrefs()->GetString( |
587 prefs::kGoogleServicesAccountId)); | 587 prefs::kGoogleServicesAccountId)); |
588 | 588 |
589 base::RunLoop().RunUntilIdle(); | 589 base::RunLoop().RunUntilIdle(); |
590 EXPECT_EQ(AccountTrackerService::MIGRATION_DONE, | 590 EXPECT_EQ(AccountTrackerService::MIGRATION_DONE, |
591 tracker->GetMigrationState()); | 591 tracker->GetMigrationState()); |
592 } | 592 } |
593 } | 593 } |
OLD | NEW |