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

Side by Side Diff: chrome/browser/signin/account_reconcilor_unittest.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 25 matching lines...) Expand all
36 #include "google_apis/gaia/gaia_constants.h" 36 #include "google_apis/gaia/gaia_constants.h"
37 #include "google_apis/gaia/gaia_urls.h" 37 #include "google_apis/gaia/gaia_urls.h"
38 #include "net/url_request/test_url_fetcher_factory.h" 38 #include "net/url_request/test_url_fetcher_factory.h"
39 #include "testing/gmock/include/gmock/gmock.h" 39 #include "testing/gmock/include/gmock/gmock.h"
40 #include "testing/gtest/include/gtest/gtest.h" 40 #include "testing/gtest/include/gtest/gtest.h"
41 41
42 namespace { 42 namespace {
43 43
44 class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> { 44 class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> {
45 public: 45 public:
46 static KeyedService* Build(content::BrowserContext* context); 46 static scoped_ptr<KeyedService> Build(content::BrowserContext* context);
47 47
48 MockAccountReconcilor(ProfileOAuth2TokenService* token_service, 48 MockAccountReconcilor(ProfileOAuth2TokenService* token_service,
49 SigninManagerBase* signin_manager, 49 SigninManagerBase* signin_manager,
50 SigninClient* client, 50 SigninClient* client,
51 GaiaCookieManagerService* cookie_manager_service); 51 GaiaCookieManagerService* cookie_manager_service);
52 ~MockAccountReconcilor() override {} 52 ~MockAccountReconcilor() override {}
53 53
54 MOCK_METHOD1(PerformMergeAction, void(const std::string& account_id)); 54 MOCK_METHOD1(PerformMergeAction, void(const std::string& account_id));
55 MOCK_METHOD0(PerformLogoutAllAccountsAction, void()); 55 MOCK_METHOD0(PerformLogoutAllAccountsAction, void());
56 }; 56 };
57 57
58 // static 58 // static
59 KeyedService* MockAccountReconcilor::Build(content::BrowserContext* context) { 59 scoped_ptr<KeyedService> MockAccountReconcilor::Build(
60 content::BrowserContext* context) {
60 Profile* profile = Profile::FromBrowserContext(context); 61 Profile* profile = Profile::FromBrowserContext(context);
61 AccountReconcilor* reconcilor = new MockAccountReconcilor( 62 scoped_ptr<AccountReconcilor> reconcilor(new MockAccountReconcilor(
62 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 63 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
63 SigninManagerFactory::GetForProfile(profile), 64 SigninManagerFactory::GetForProfile(profile),
64 ChromeSigninClientFactory::GetForProfile(profile), 65 ChromeSigninClientFactory::GetForProfile(profile),
65 GaiaCookieManagerServiceFactory::GetForProfile(profile)); 66 GaiaCookieManagerServiceFactory::GetForProfile(profile)));
66 reconcilor->Initialize(false /* start_reconcile_if_tokens_available */); 67 reconcilor->Initialize(false /* start_reconcile_if_tokens_available */);
67 return reconcilor; 68 return reconcilor.Pass();
68 } 69 }
69 70
70 MockAccountReconcilor::MockAccountReconcilor( 71 MockAccountReconcilor::MockAccountReconcilor(
71 ProfileOAuth2TokenService* token_service, 72 ProfileOAuth2TokenService* token_service,
72 SigninManagerBase* signin_manager, 73 SigninManagerBase* signin_manager,
73 SigninClient* client, 74 SigninClient* client,
74 GaiaCookieManagerService* cookie_manager_service) 75 GaiaCookieManagerService* cookie_manager_service)
75 : testing::StrictMock<AccountReconcilor>(token_service, 76 : testing::StrictMock<AccountReconcilor>(token_service,
76 signin_manager, 77 signin_manager,
77 client, 78 client,
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 ASSERT_TRUE(reconcilor->is_reconcile_started_); 757 ASSERT_TRUE(reconcilor->is_reconcile_started_);
757 758
758 SimulateAddAccountToCookieCompleted(reconcilor, account_id, 759 SimulateAddAccountToCookieCompleted(reconcilor, account_id,
759 GoogleServiceAuthError::AuthErrorNone()); 760 GoogleServiceAuthError::AuthErrorNone());
760 ASSERT_FALSE(reconcilor->is_reconcile_started_); 761 ASSERT_FALSE(reconcilor->is_reconcile_started_);
761 } 762 }
762 763
763 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, 764 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled,
764 AccountReconcilorTest, 765 AccountReconcilorTest,
765 testing::Bool()); 766 testing::Bool());
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service_factory.h ('k') | chrome/browser/signin/easy_unlock_app_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698