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

Unified Diff: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc

Issue 9465018: Changes to the GAIA auth fetching to support one-click login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Removed DCHECKS, fixed typo Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
===================================================================
--- chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc (revision 124404)
+++ chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc (working copy)
@@ -130,9 +130,9 @@
std::string out_token;
GaiaAuthFetcher::ParseClientLoginResponse(data,
- &out_sid,
- &out_lsid,
- &out_token);
+ &out_sid,
+ &out_lsid,
+ &out_token);
EXPECT_EQ(lsid, out_lsid);
EXPECT_EQ(sid, out_sid);
EXPECT_EQ(token, out_token);
@@ -149,10 +149,10 @@
std::string out_captcha_token;
GaiaAuthFetcher::ParseClientLoginFailure(data,
- &out_error,
- &out_error_url,
- &out_captcha_url,
- &out_captcha_token);
+ &out_error,
+ &out_error_url,
+ &out_captcha_url,
+ &out_captcha_token);
EXPECT_EQ(error, out_error);
EXPECT_EQ(error_url, out_error_url);
EXPECT_EQ(captcha_url, out_captcha_url);
@@ -184,7 +184,8 @@
void(const std::string& refresh_token,
const std::string& access_token,
int expires_in_secs));
- MOCK_METHOD1(OnTokenAuthSuccess, void(const std::string& data));
+ MOCK_METHOD2(OnTokenAuthSuccess,
+ void(const net::ResponseCookies&, const std::string& data));
MOCK_METHOD1(OnMergeSessionSuccess, void(const std::string& data));
MOCK_METHOD1(OnUberAuthTokenSuccess, void(const std::string& data));
MOCK_METHOD1(OnClientLoginFailure,
@@ -594,6 +595,10 @@
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
auth.StartOAuthLoginTokenFetch("lso_token");
+ TestURLFetcher* fetcher = factory.GetFetcherByID(0);
+ EXPECT_TRUE(NULL != fetcher);
+ EXPECT_EQ(net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES,
+ fetcher->GetLoadFlags());
net::ResponseCookies cookies;
cookies.push_back(kGetAuthCodeValidCookie);
@@ -614,6 +619,18 @@
EXPECT_FALSE(auth.HasPendingFetch());
}
+TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenWithEmptyToken) {
+ MockGaiaConsumer consumer;
+ TestingProfile profile;
+ TestURLFetcherFactory factory;
+ GaiaAuthFetcher auth(&consumer, std::string(),
+ profile_.GetRequestContext());
+ auth.StartOAuthLoginTokenFetch("");
+ TestURLFetcher* fetcher = factory.GetFetcherByID(0);
+ EXPECT_TRUE(NULL != fetcher);
+ EXPECT_EQ(net::LOAD_NORMAL, fetcher->GetLoadFlags());
+}
+
TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenClientLoginToOAuth2Failure) {
MockGaiaConsumer consumer;
EXPECT_CALL(consumer, OnOAuthLoginTokenFailure(_))
@@ -670,7 +687,8 @@
TEST_F(GaiaAuthFetcherTest, TokenAuthSuccess) {
MockGaiaConsumer consumer;
- EXPECT_CALL(consumer, OnTokenAuthSuccess("<html></html>"))
+ net::ResponseCookies cookies;
+ EXPECT_CALL(consumer, OnTokenAuthSuccess(cookies, "<html></html>"))
.Times(1);
TestingProfile profile;
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698