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

Side by Side Diff: components/autofill/browser/wallet/wallet_signin_helper_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 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 "components/autofill/browser/wallet/wallet_signin_helper.h" 5 #include "components/autofill/browser/wallet/wallet_signin_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 void MockSuccessfulOAuthLoginResponse() { 114 void MockSuccessfulOAuthLoginResponse() {
115 SetUpFetcherResponseAndCompleteRequest( 115 SetUpFetcherResponseAndCompleteRequest(
116 GaiaUrls::GetInstance()->client_login_url(), 200, 116 GaiaUrls::GetInstance()->client_login_url(), 200,
117 net::ResponseCookies(), 117 net::ResponseCookies(),
118 "SID=sid\nLSID=lsid\nAuth=auth"); 118 "SID=sid\nLSID=lsid\nAuth=auth");
119 } 119 }
120 120
121 void MockFailedOAuthLoginResponse404() { 121 void MockFailedOAuthLoginResponse404() {
122 SetUpFetcherResponseAndCompleteRequest( 122 SetUpFetcherResponseAndCompleteRequest(
123 GaiaUrls::GetInstance()->client_login_url(), 404, 123 GaiaUrls::GetInstance()->client_login_url(),
124 404,
124 net::ResponseCookies(), 125 net::ResponseCookies(),
125 ""); 126 std::string());
126 } 127 }
127 128
128 void MockSuccessfulGaiaUserInfoResponse(const std::string& username) { 129 void MockSuccessfulGaiaUserInfoResponse(const std::string& username) {
129 SetUpFetcherResponseAndCompleteRequest( 130 SetUpFetcherResponseAndCompleteRequest(
130 GaiaUrls::GetInstance()->get_user_info_url(), 200, 131 GaiaUrls::GetInstance()->get_user_info_url(), 200,
131 net::ResponseCookies(), 132 net::ResponseCookies(),
132 "email=" + username); 133 "email=" + username);
133 } 134 }
134 135
135 void MockFailedGaiaUserInfoResponse404() { 136 void MockFailedGaiaUserInfoResponse404() {
136 SetUpFetcherResponseAndCompleteRequest( 137 SetUpFetcherResponseAndCompleteRequest(
137 GaiaUrls::GetInstance()->get_user_info_url(), 404, 138 GaiaUrls::GetInstance()->get_user_info_url(),
139 404,
138 net::ResponseCookies(), 140 net::ResponseCookies(),
139 ""); 141 std::string());
140 } 142 }
141 143
142 void MockSuccessfulGetAccountInfoResponse(const std::string& username) { 144 void MockSuccessfulGetAccountInfoResponse(const std::string& username) {
143 SetUpFetcherResponseAndCompleteRequest( 145 SetUpFetcherResponseAndCompleteRequest(
144 signin_helper_->GetGetAccountInfoUrlForTesting(), 200, 146 signin_helper_->GetGetAccountInfoUrlForTesting(), 200,
145 net::ResponseCookies(), 147 net::ResponseCookies(),
146 base::StringPrintf( 148 base::StringPrintf(
147 kGetAccountInfoValidResponseFormat, 149 kGetAccountInfoValidResponseFormat,
148 username.c_str())); 150 username.c_str()));
149 } 151 }
150 152
151 void MockFailedGetAccountInfoResponse404() { 153 void MockFailedGetAccountInfoResponse404() {
152 SetUpFetcherResponseAndCompleteRequest( 154 SetUpFetcherResponseAndCompleteRequest(
153 signin_helper_->GetGetAccountInfoUrlForTesting(), 404, 155 signin_helper_->GetGetAccountInfoUrlForTesting(),
156 404,
154 net::ResponseCookies(), 157 net::ResponseCookies(),
155 ""); 158 std::string());
156 } 159 }
157 160
158 void MockSuccessfulPassiveAuthUrlMergeAndRedirectResponse() { 161 void MockSuccessfulPassiveAuthUrlMergeAndRedirectResponse() {
159 SetUpFetcherResponseAndCompleteRequest( 162 SetUpFetcherResponseAndCompleteRequest(wallet::GetPassiveAuthUrl().spec(),
160 wallet::GetPassiveAuthUrl().spec(), 200, 163 200,
161 net::ResponseCookies(), 164 net::ResponseCookies(),
162 ""); 165 std::string());
163 } 166 }
164 167
165 void MockFailedPassiveAuthUrlMergeAndRedirectResponse404() { 168 void MockFailedPassiveAuthUrlMergeAndRedirectResponse404() {
166 SetUpFetcherResponseAndCompleteRequest( 169 SetUpFetcherResponseAndCompleteRequest(wallet::GetPassiveAuthUrl().spec(),
167 wallet::GetPassiveAuthUrl().spec(), 404, 170 404,
168 net::ResponseCookies(), 171 net::ResponseCookies(),
169 ""); 172 std::string());
170 } 173 }
171 174
172 WalletSigninHelperForTesting::State state() const { 175 WalletSigninHelperForTesting::State state() const {
173 return signin_helper_->state(); 176 return signin_helper_->state();
174 } 177 }
175 178
176 scoped_ptr<WalletSigninHelperForTesting> signin_helper_; 179 scoped_ptr<WalletSigninHelperForTesting> signin_helper_;
177 MockWalletSigninHelperDelegate mock_delegate_; 180 MockWalletSigninHelperDelegate mock_delegate_;
178 181
179 private: 182 private:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 signin_helper_->StartAutomaticSignin("123SID", "123LSID"); 244 signin_helper_->StartAutomaticSignin("123SID", "123LSID");
242 MockSuccessfulGaiaUserInfoResponse("user@gmail.com"); 245 MockSuccessfulGaiaUserInfoResponse("user@gmail.com");
243 MockSuccessfulOAuthLoginResponse(); 246 MockSuccessfulOAuthLoginResponse();
244 MockFailedPassiveAuthUrlMergeAndRedirectResponse404(); 247 MockFailedPassiveAuthUrlMergeAndRedirectResponse404();
245 } 248 }
246 249
247 // TODO(aruslan): http://crbug.com/188317 Need more tests. 250 // TODO(aruslan): http://crbug.com/188317 Need more tests.
248 251
249 } // namespace wallet 252 } // namespace wallet
250 } // namespace autofill 253 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698