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

Side by Side Diff: google_apis/gaia/oauth2_api_call_flow_unittest.cc

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix InstantNTP test. Created 7 years, 5 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 // A complete set of unit tests for OAuth2MintTokenFlow. 5 // A complete set of unit tests for OAuth2MintTokenFlow.
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 MOCK_METHOD1(ProcessNewAccessToken, 102 MOCK_METHOD1(ProcessNewAccessToken,
103 void (const std::string& access_token)); 103 void (const std::string& access_token));
104 MOCK_METHOD1(ProcessMintAccessTokenFailure, 104 MOCK_METHOD1(ProcessMintAccessTokenFailure,
105 void (const GoogleServiceAuthError& error)); 105 void (const GoogleServiceAuthError& error));
106 MOCK_METHOD0(CreateAccessTokenFetcher, OAuth2AccessTokenFetcher* ()); 106 MOCK_METHOD0(CreateAccessTokenFetcher, OAuth2AccessTokenFetcher* ());
107 }; 107 };
108 108
109 } // namespace 109 } // namespace
110 110
111 class OAuth2ApiCallFlowTest : public testing::Test { 111 class OAuth2ApiCallFlowTest : public testing::Test {
112 public:
113 OAuth2ApiCallFlowTest() {}
114 virtual ~OAuth2ApiCallFlowTest() {}
115
116 protected: 112 protected:
117 void SetupAccessTokenFetcher( 113 void SetupAccessTokenFetcher(
118 const std::string& rt, const std::vector<std::string>& scopes) { 114 const std::string& rt, const std::vector<std::string>& scopes) {
119 EXPECT_CALL(*access_token_fetcher_, 115 EXPECT_CALL(*access_token_fetcher_,
120 Start(GaiaUrls::GetInstance()->oauth2_chrome_client_id(), 116 Start(GaiaUrls::GetInstance()->oauth2_chrome_client_id(),
121 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), 117 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(),
122 rt, scopes)) 118 rt, scopes))
123 .Times(1); 119 .Times(1);
124 EXPECT_CALL(*flow_, CreateAccessTokenFetcher()) 120 EXPECT_CALL(*flow_, CreateAccessTokenFetcher())
125 .WillOnce(Return(access_token_fetcher_.release())); 121 .WillOnce(Return(access_token_fetcher_.release()));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 scoped_ptr<TestURLFetcher> url_fetcher(SetupApiCall(true, net::HTTP_OK)); 289 scoped_ptr<TestURLFetcher> url_fetcher(SetupApiCall(true, net::HTTP_OK));
294 flow_->CreateURLFetcher(); 290 flow_->CreateURLFetcher();
295 HttpRequestHeaders headers; 291 HttpRequestHeaders headers;
296 url_fetcher->GetExtraRequestHeaders(&headers); 292 url_fetcher->GetExtraRequestHeaders(&headers);
297 std::string auth_header; 293 std::string auth_header;
298 EXPECT_TRUE(headers.GetHeader("Authorization", &auth_header)); 294 EXPECT_TRUE(headers.GetHeader("Authorization", &auth_header));
299 EXPECT_EQ("Bearer access_token", auth_header); 295 EXPECT_EQ("Bearer access_token", auth_header);
300 EXPECT_EQ(url, url_fetcher->GetOriginalURL()); 296 EXPECT_EQ(url, url_fetcher->GetOriginalURL());
301 EXPECT_EQ(body, url_fetcher->upload_data()); 297 EXPECT_EQ(body, url_fetcher->upload_data());
302 } 298 }
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_access_token_fetcher_unittest.cc ('k') | ui/views/test/webview_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698