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

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

Issue 23068005: Convert UserPolicySigninService to use OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/signin/ubertoken_fetcher.h" 5 #include "chrome/browser/signin/ubertoken_fetcher.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/signin/profile_oauth2_token_service.h" 8 #include "chrome/browser/signin/profile_oauth2_token_service.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/signin/token_service_unittest.h" 10 #include "chrome/browser/signin/token_service_unittest.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 token_service->Initialize(static_cast<Profile*>(profile)); 57 token_service->Initialize(static_cast<Profile*>(profile));
58 return token_service; 58 return token_service;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 class UbertokenFetcherTest : public TokenServiceTestHarness { 63 class UbertokenFetcherTest : public TokenServiceTestHarness {
64 public: 64 public:
65 virtual void SetUp() OVERRIDE { 65 virtual void SetUp() OVERRIDE {
66 TokenServiceTestHarness::SetUp(); 66 TokenServiceTestHarness::SetUp();
67
68 ProfileOAuth2TokenServiceFactory::GetInstance()->
69 SetTestingFactoryAndUse(profile(), Build);
70 UpdateCredentialsOnService(); 67 UpdateCredentialsOnService();
71 fetcher_.reset(new UbertokenFetcher(profile(), &consumer_)); 68 fetcher_.reset(new UbertokenFetcher(profile(), &consumer_));
72 } 69 }
73 70
71 virtual scoped_ptr<TestingProfile> CreateProfile() OVERRIDE {
72 TestingProfile::Builder builder;
73 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
74 Build);
75 return builder.Build().Pass();
76 }
77
74 virtual void TearDown() OVERRIDE { 78 virtual void TearDown() OVERRIDE {
75 fetcher_.reset(); 79 fetcher_.reset();
76 TokenServiceTestHarness::TearDown(); 80 TokenServiceTestHarness::TearDown();
77 } 81 }
78 82
79 protected: 83 protected:
80 net::TestURLFetcherFactory factory_; 84 net::TestURLFetcherFactory factory_;
81 MockUbertokenConsumer consumer_; 85 MockUbertokenConsumer consumer_;
82 scoped_ptr<UbertokenFetcher> fetcher_; 86 scoped_ptr<UbertokenFetcher> fetcher_;
83 }; 87 };
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 service()->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, 127 service()->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken,
124 "refreshToken"); 128 "refreshToken");
125 fetcher_->StartFetchingToken(); 129 fetcher_->StartFetchingToken();
126 fetcher_->OnGetTokenSuccess(NULL, "accessToken", base::Time()); 130 fetcher_->OnGetTokenSuccess(NULL, "accessToken", base::Time());
127 fetcher_->OnUberAuthTokenFailure(error); 131 fetcher_->OnUberAuthTokenFailure(error);
128 132
129 EXPECT_EQ(1, consumer_.nb_error_); 133 EXPECT_EQ(1, consumer_.nb_error_);
130 EXPECT_EQ(0, consumer_.nb_correct_token_); 134 EXPECT_EQ(0, consumer_.nb_correct_token_);
131 EXPECT_EQ("", consumer_.last_token_); 135 EXPECT_EQ("", consumer_.last_token_);
132 } 136 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/token_service_unittest.cc ('k') | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698