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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 OAuth2AccessTokenFetcher. 5 // A complete set of unit tests for OAuth2AccessTokenFetcher.
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 MessageLoop message_loop_; 113 MessageLoop message_loop_;
114 content::TestBrowserThread ui_thread_; 114 content::TestBrowserThread ui_thread_;
115 MockUrlFetcherFactory factory_; 115 MockUrlFetcherFactory factory_;
116 MockOAuth2AccessTokenConsumer consumer_; 116 MockOAuth2AccessTokenConsumer consumer_;
117 TestingProfile profile_; 117 TestingProfile profile_;
118 OAuth2AccessTokenFetcher fetcher_; 118 OAuth2AccessTokenFetcher fetcher_;
119 }; 119 };
120 120
121 // These four tests time out, see http://crbug.com/113446. 121 // These four tests time out, see http://crbug.com/113446.
122 TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenRequestFailure) { 122 TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenRequestFailure) {
123 TestURLFetcher* url_fetcher = SetupGetAccessToken(false, 0, ""); 123 TestURLFetcher* url_fetcher = SetupGetAccessToken(false, 0, std::string());
124 EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1); 124 EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1);
125 fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList()); 125 fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList());
126 fetcher_.OnURLFetchComplete(url_fetcher); 126 fetcher_.OnURLFetchComplete(url_fetcher);
127 } 127 }
128 128
129 TEST_F(OAuth2AccessTokenFetcherTest, 129 TEST_F(OAuth2AccessTokenFetcherTest,
130 DISABLED_GetAccessTokenResponseCodeFailure) { 130 DISABLED_GetAccessTokenResponseCodeFailure) {
131 TestURLFetcher* url_fetcher = 131 TestURLFetcher* url_fetcher =
132 SetupGetAccessToken(true, net::HTTP_FORBIDDEN, ""); 132 SetupGetAccessToken(true, net::HTTP_FORBIDDEN, std::string());
133 EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1); 133 EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1);
134 fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList()); 134 fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList());
135 fetcher_.OnURLFetchComplete(url_fetcher); 135 fetcher_.OnURLFetchComplete(url_fetcher);
136 } 136 }
137 137
138 TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_Success) { 138 TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_Success) {
139 TestURLFetcher* url_fetcher = SetupGetAccessToken( 139 TestURLFetcher* url_fetcher = SetupGetAccessToken(
140 true, net::HTTP_OK, kValidTokenResponse); 140 true, net::HTTP_OK, kValidTokenResponse);
141 EXPECT_CALL(consumer_, OnGetTokenSuccess("at1", _)).Times(1); 141 EXPECT_CALL(consumer_, OnGetTokenSuccess("at1", _)).Times(1);
142 fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList()); 142 fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 url_fetcher.SetResponseString(kValidTokenResponse); 226 url_fetcher.SetResponseString(kValidTokenResponse);
227 227
228 std::string at; 228 std::string at;
229 int expires_in; 229 int expires_in;
230 EXPECT_TRUE(OAuth2AccessTokenFetcher::ParseGetAccessTokenResponse( 230 EXPECT_TRUE(OAuth2AccessTokenFetcher::ParseGetAccessTokenResponse(
231 &url_fetcher, &at, &expires_in)); 231 &url_fetcher, &at, &expires_in));
232 EXPECT_EQ("at1", at); 232 EXPECT_EQ("at1", at);
233 EXPECT_EQ(3600, expires_in); 233 EXPECT_EQ(3600, expires_in);
234 } 234 }
235 } 235 }
OLDNEW
« no previous file with comments | « google_apis/gaia/google_service_auth_error_unittest.cc ('k') | google_apis/gaia/oauth2_api_call_flow_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698