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

Unified Diff: google_apis/gaia/oauth2_mint_token_flow_unittest.cc

Issue 14329014: Identity API: Add token cache and identity.invalidateAuthToken. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rounding third rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gaia/oauth2_mint_token_flow.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/oauth2_mint_token_flow_unittest.cc
diff --git a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc
index 320660145e11469b0fdfba4edd28a334d1db2820..48a9ff164c5f5a030c375a8eb2b7774058c05a8a 100644
--- a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc
+++ b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc
@@ -29,7 +29,8 @@ namespace {
static const char kValidTokenResponse[] =
"{"
" \"token\": \"at1\","
- " \"issueAdvice\": \"Auto\""
+ " \"issueAdvice\": \"Auto\","
+ " \"expiresIn\": \"3600\""
"}";
static const char kTokenResponseNoAccessToken[] =
"{"
@@ -126,7 +127,8 @@ class MockDelegate : public OAuth2MintTokenFlow::Delegate {
MockDelegate() {}
~MockDelegate() {}
- MOCK_METHOD1(OnMintTokenSuccess, void(const std::string& access_token));
+ MOCK_METHOD2(OnMintTokenSuccess, void(const std::string& access_token,
+ int time_to_live));
MOCK_METHOD1(OnIssueAdviceSuccess,
void (const IssueAdviceInfo& issue_advice));
MOCK_METHOD1(OnMintTokenFailure,
@@ -230,14 +232,19 @@ TEST_F(OAuth2MintTokenFlowTest, ParseMintTokenResponse) {
scoped_ptr<base::DictionaryValue> json(
ParseJson(kTokenResponseNoAccessToken));
std::string at;
- EXPECT_FALSE(OAuth2MintTokenFlow::ParseMintTokenResponse(json.get(), &at));
+ int ttl;
+ EXPECT_FALSE(OAuth2MintTokenFlow::ParseMintTokenResponse(json.get(), &at,
+ &ttl));
EXPECT_TRUE(at.empty());
}
{ // All good.
scoped_ptr<base::DictionaryValue> json(ParseJson(kValidTokenResponse));
std::string at;
- EXPECT_TRUE(OAuth2MintTokenFlow::ParseMintTokenResponse(json.get(), &at));
+ int ttl;
+ EXPECT_TRUE(OAuth2MintTokenFlow::ParseMintTokenResponse(json.get(), &at,
+ &ttl));
EXPECT_EQ("at1", at);
+ EXPECT_EQ(3600, ttl);
}
}
@@ -295,7 +302,7 @@ TEST_F(OAuth2MintTokenFlowTest, ProcessApiCallSuccess) {
TestURLFetcher url_fetcher(1, GURL("http://www.google.com"), NULL);
url_fetcher.SetResponseString(kValidTokenResponse);
CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE);
- EXPECT_CALL(delegate_, OnMintTokenSuccess("at1"));
+ EXPECT_CALL(delegate_, OnMintTokenSuccess("at1", 3600));
flow_->ProcessApiCallSuccess(&url_fetcher);
}
{ // Valid json: no description.
« no previous file with comments | « google_apis/gaia/oauth2_mint_token_flow.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698