summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 08:46:45 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 08:46:45 +0000
commit007b3f812fc9c989fb99d4a668d8bd9c7807ad81 (patch)
tree43e69dd0f4e4dbbe68afb6319fa18cee07a4be64 /google_apis
parent2bde7e94eb8f402839145e48924391a5c645a554 (diff)
downloadchromium_src-007b3f812fc9c989fb99d4a668d8bd9c7807ad81.zip
chromium_src-007b3f812fc9c989fb99d4a668d8bd9c7807ad81.tar.gz
chromium_src-007b3f812fc9c989fb99d4a668d8bd9c7807ad81.tar.bz2
Rewrite std::string("") to std::string(), Linux edition.
This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=193020 Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gaia/gaia_auth_fetcher.cc20
-rw-r--r--google_apis/gaia/gaia_auth_fetcher_unittest.cc53
-rw-r--r--google_apis/gaia/google_service_auth_error.cc2
-rw-r--r--google_apis/gaia/google_service_auth_error_unittest.cc2
-rw-r--r--google_apis/gaia/oauth2_access_token_fetcher_unittest.cc4
-rw-r--r--google_apis/gaia/oauth2_api_call_flow_unittest.cc10
-rw-r--r--google_apis/gaia/oauth2_mint_token_flow.cc17
-rw-r--r--google_apis/gaia/oauth2_mint_token_flow_unittest.cc2
-rw-r--r--google_apis/gaia/oauth_request_signer.cc6
-rw-r--r--google_apis/gaia/oauth_request_signer_unittest.cc84
-rw-r--r--google_apis/google_api_keys.cc29
11 files changed, 124 insertions, 105 deletions
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc
index 9354447..15aa78a 100644
--- a/google_apis/gaia/gaia_auth_fetcher.cc
+++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -617,7 +617,7 @@ void GaiaAuthFetcher::StartClientLogin(
allow_hosted_accounts);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
client_login_gurl_,
kLoadFlagsIgnoreCookies,
this));
@@ -635,7 +635,7 @@ void GaiaAuthFetcher::StartIssueAuthToken(const std::string& sid,
request_body_ = MakeIssueAuthTokenBody(sid, lsid, service);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
issue_auth_token_gurl_,
kLoadFlagsIgnoreCookies,
this));
@@ -669,7 +669,7 @@ void GaiaAuthFetcher::StartRevokeOAuth2Token(const std::string& auth_token) {
request_body_ = MakeRevokeTokenBody(auth_token);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
oauth2_revoke_gurl_,
kLoadFlagsIgnoreCookies,
this));
@@ -692,7 +692,7 @@ void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange(
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
client_login_to_oauth2_gurl_,
net::LOAD_NORMAL,
this));
@@ -708,7 +708,7 @@ void GaiaAuthFetcher::StartAuthCodeForOAuth2TokenExchange(
request_body_ = MakeGetTokenPairBody(auth_code);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
oauth2_token_gurl_,
kLoadFlagsIgnoreCookies,
this));
@@ -723,7 +723,7 @@ void GaiaAuthFetcher::StartGetUserInfo(const std::string& lsid) {
request_body_ = MakeGetUserInfoBody(lsid);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
get_user_info_gurl_,
kLoadFlagsIgnoreCookies,
this));
@@ -748,7 +748,7 @@ void GaiaAuthFetcher::StartMergeSession(const std::string& uber_token) {
request_body_ = MakeMergeSessionBody(uber_token, continue_url, source_);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
merge_session_gurl_,
net::LOAD_NORMAL,
this));
@@ -765,7 +765,7 @@ void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange(
std::string authentication_header =
base::StringPrintf(kOAuthHeaderFormat, access_token.c_str());
fetcher_.reset(CreateGaiaFetcher(getter_,
- "",
+ std::string(),
authentication_header,
uberauth_token_gurl_,
kLoadFlagsIgnoreCookies,
@@ -785,7 +785,7 @@ void GaiaAuthFetcher::StartClientOAuth(const std::string& username,
source_, locale);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
client_oauth_gurl_,
kLoadFlagsIgnoreCookies,
this));
@@ -814,7 +814,7 @@ void GaiaAuthFetcher::StartClientOAuthChallengeResponse(
request_body_ = MakeClientOAuthChallengeResponseBody(name, token, solution);
fetcher_.reset(CreateGaiaFetcher(getter_,
request_body_,
- "",
+ std::string(),
client_oauth_gurl_,
kLoadFlagsIgnoreCookies,
this));
diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
index 226ee1a..47b6d15 100644
--- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc
+++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
@@ -311,10 +311,10 @@ TEST_F(GaiaAuthFetcherTest, ParseRequest) {
RunParsingTest("SID=sid\nLSID=lsid\nAuth=auth\n", "sid", "lsid", "auth");
RunParsingTest("LSID=lsid\nSID=sid\nAuth=auth\n", "sid", "lsid", "auth");
RunParsingTest("SID=sid\nLSID=lsid\nAuth=auth", "sid", "lsid", "auth");
- RunParsingTest("SID=sid\nAuth=auth\n", "sid", "", "auth");
- RunParsingTest("LSID=lsid\nAuth=auth\n", "", "lsid", "auth");
- RunParsingTest("\nAuth=auth\n", "", "", "auth");
- RunParsingTest("SID=sid", "sid", "", "");
+ RunParsingTest("SID=sid\nAuth=auth\n", "sid", std::string(), "auth");
+ RunParsingTest("LSID=lsid\nAuth=auth\n", std::string(), "lsid", "auth");
+ RunParsingTest("\nAuth=auth\n", std::string(), std::string(), "auth");
+ RunParsingTest("SID=sid", "sid", std::string(), std::string());
}
TEST_F(GaiaAuthFetcherTest, ParseErrorRequest) {
@@ -588,7 +588,11 @@ TEST_F(GaiaAuthFetcherTest, FullTokenFailure) {
MockFetcher mock_fetcher(
issue_auth_token_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- net::HTTP_FORBIDDEN, cookies_, "", net::URLFetcher::GET, &auth);
+ net::HTTP_FORBIDDEN,
+ cookies_,
+ std::string(),
+ net::URLFetcher::GET,
+ &auth);
auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -613,8 +617,11 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenSuccess) {
MockFetcher mock_fetcher1(
client_login_to_oauth2_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- net::HTTP_OK, cookies, "",
- net::URLFetcher::POST, &auth);
+ net::HTTP_OK,
+ cookies,
+ std::string(),
+ net::URLFetcher::POST,
+ &auth);
auth.OnURLFetchComplete(&mock_fetcher1);
EXPECT_TRUE(auth.HasPendingFetch());
MockFetcher mock_fetcher2(
@@ -652,8 +659,11 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenClientLoginToOAuth2Failure) {
MockFetcher mock_fetcher(
client_login_to_oauth2_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- net::HTTP_FORBIDDEN, cookies, "",
- net::URLFetcher::POST, &auth);
+ net::HTTP_FORBIDDEN,
+ cookies,
+ std::string(),
+ net::URLFetcher::POST,
+ &auth);
auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -674,15 +684,21 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenOAuth2TokenPairFailure) {
MockFetcher mock_fetcher1(
client_login_to_oauth2_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- net::HTTP_OK, cookies, "",
- net::URLFetcher::POST, &auth);
+ net::HTTP_OK,
+ cookies,
+ std::string(),
+ net::URLFetcher::POST,
+ &auth);
auth.OnURLFetchComplete(&mock_fetcher1);
EXPECT_TRUE(auth.HasPendingFetch());
MockFetcher mock_fetcher2(
oauth2_token_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- net::HTTP_FORBIDDEN, cookies_, "",
- net::URLFetcher::POST, &auth);
+ net::HTTP_FORBIDDEN,
+ cookies_,
+ std::string(),
+ net::URLFetcher::POST,
+ &auth);
auth.OnURLFetchComplete(&mock_fetcher2);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -810,7 +826,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthSuccess) {
std::vector<std::string> scopes;
scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope());
scopes.push_back("https://some.other.scope.com");
- auth.StartClientOAuth("username", "password", scopes, "", "en");
+ auth.StartClientOAuth("username", "password", scopes, std::string(), "en");
std::string expected_text = base::StringPrintf(
"{"
@@ -842,7 +858,8 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthWithQuote) {
GaiaAuthFetcher auth(&consumer, "te\"sts", profile_.GetRequestContext());
std::vector<std::string> scopes;
scopes.push_back("https://some.\"other.scope.com");
- auth.StartClientOAuth("user\"name", "pass\"word", scopes, "", "e\"n");
+ auth.StartClientOAuth(
+ "user\"name", "pass\"word", scopes, std::string(), "e\"n");
std::string expected_text = base::StringPrintf(
"{"
@@ -879,7 +896,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthBadAuth) {
GaiaAuthFetcher auth(&consumer, "tests", profile_.GetRequestContext());
std::vector<std::string> scopes;
scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope());
- auth.StartClientOAuth("username", "password", scopes, "", "en");
+ auth.StartClientOAuth("username", "password", scopes, std::string(), "en");
}
TEST_F(GaiaAuthFetcherTest, ClientOAuthCaptchaChallenge) {
@@ -908,7 +925,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthCaptchaChallenge) {
GaiaAuthFetcher auth(&consumer, "tests", profile_.GetRequestContext());
std::vector<std::string> scopes;
scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope());
- auth.StartClientOAuth("username", "password", scopes, "", "en");
+ auth.StartClientOAuth("username", "password", scopes, std::string(), "en");
}
TEST_F(GaiaAuthFetcherTest, ClientOAuthTwoFactorChallenge) {
@@ -936,7 +953,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthTwoFactorChallenge) {
GaiaAuthFetcher auth(&consumer, "tests", profile_.GetRequestContext());
std::vector<std::string> scopes;
scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope());
- auth.StartClientOAuth("username", "password", scopes, "", "en");
+ auth.StartClientOAuth("username", "password", scopes, std::string(), "en");
}
TEST_F(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess) {
diff --git a/google_apis/gaia/google_service_auth_error.cc b/google_apis/gaia/google_service_auth_error.cc
index 8beeb4d..96fc063 100644
--- a/google_apis/gaia/google_service_auth_error.cc
+++ b/google_apis/gaia/google_service_auth_error.cc
@@ -225,7 +225,7 @@ DictionaryValue* GoogleServiceAuthError::ToValue() const {
std::string GoogleServiceAuthError::ToString() const {
switch (state_) {
case NONE:
- return "";
+ return std::string();
case INVALID_GAIA_CREDENTIALS:
return "Invalid credentials.";
case USER_NOT_SIGNED_UP:
diff --git a/google_apis/gaia/google_service_auth_error_unittest.cc b/google_apis/gaia/google_service_auth_error_unittest.cc
index 59aa510..15155b6 100644
--- a/google_apis/gaia/google_service_auth_error_unittest.cc
+++ b/google_apis/gaia/google_service_auth_error_unittest.cc
@@ -64,7 +64,7 @@ TEST_F(GoogleServiceAuthErrorTest, CaptchaChallenge) {
EXPECT_TRUE(value->GetDictionary("captcha", &captcha_value));
ASSERT_TRUE(captcha_value);
ExpectDictStringValue("captcha_token", *captcha_value, "token");
- ExpectDictStringValue("", *captcha_value, "audioUrl");
+ ExpectDictStringValue(std::string(), *captcha_value, "audioUrl");
ExpectDictStringValue("http://www.google.com/", *captcha_value, "imageUrl");
ExpectDictStringValue("http://www.bing.com/", *captcha_value, "unlockUrl");
ExpectDictIntegerValue(0, *captcha_value, "imageWidth");
diff --git a/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc b/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc
index feb8020..7c761c7 100644
--- a/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc
+++ b/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc
@@ -120,7 +120,7 @@ class OAuth2AccessTokenFetcherTest : public testing::Test {
// These four tests time out, see http://crbug.com/113446.
TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenRequestFailure) {
- TestURLFetcher* url_fetcher = SetupGetAccessToken(false, 0, "");
+ TestURLFetcher* url_fetcher = SetupGetAccessToken(false, 0, std::string());
EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1);
fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList());
fetcher_.OnURLFetchComplete(url_fetcher);
@@ -129,7 +129,7 @@ TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenRequestFailure) {
TEST_F(OAuth2AccessTokenFetcherTest,
DISABLED_GetAccessTokenResponseCodeFailure) {
TestURLFetcher* url_fetcher =
- SetupGetAccessToken(true, net::HTTP_FORBIDDEN, "");
+ SetupGetAccessToken(true, net::HTTP_FORBIDDEN, std::string());
EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1);
fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList());
fetcher_.OnURLFetchComplete(url_fetcher);
diff --git a/google_apis/gaia/oauth2_api_call_flow_unittest.cc b/google_apis/gaia/oauth2_api_call_flow_unittest.cc
index 137eaeb..4e8692e 100644
--- a/google_apis/gaia/oauth2_api_call_flow_unittest.cc
+++ b/google_apis/gaia/oauth2_api_call_flow_unittest.cc
@@ -158,8 +158,8 @@ class OAuth2ApiCallFlowTest : public testing::Test {
GURL url(CreateApiUrl());
EXPECT_CALL(*flow_, CreateApiCallBody()).WillOnce(Return(body));
EXPECT_CALL(*flow_, CreateApiCallUrl()).WillOnce(Return(url));
- TestURLFetcher* url_fetcher = CreateURLFetcher(
- url, succeeds, status, "");
+ TestURLFetcher* url_fetcher =
+ CreateURLFetcher(url, succeeds, status, std::string());
EXPECT_CALL(factory_, CreateURLFetcher(_, url, _, _))
.WillOnce(Return(url_fetcher));
return url_fetcher;
@@ -240,7 +240,7 @@ TEST_F(OAuth2ApiCallFlowTest, EmptyAccessTokenFirstApiCallSucceeds) {
std::string at = "access_token";
std::vector<std::string> scopes(CreateTestScopes());
- CreateFlow(rt, "", scopes);
+ CreateFlow(rt, std::string(), scopes);
SetupAccessTokenFetcher(rt, scopes);
TestURLFetcher* url_fetcher = SetupApiCall(true, net::HTTP_OK);
EXPECT_CALL(*flow_, ProcessApiCallSuccess(url_fetcher));
@@ -256,7 +256,7 @@ TEST_F(OAuth2ApiCallFlowTest, EmptyAccessTokenApiCallFails) {
std::string at = "access_token";
std::vector<std::string> scopes(CreateTestScopes());
- CreateFlow(rt, "", scopes);
+ CreateFlow(rt, std::string(), scopes);
SetupAccessTokenFetcher(rt, scopes);
TestURLFetcher* url_fetcher = SetupApiCall(false, net::HTTP_BAD_GATEWAY);
EXPECT_CALL(*flow_, ProcessApiCallFailure(url_fetcher));
@@ -272,7 +272,7 @@ TEST_F(OAuth2ApiCallFlowTest, EmptyAccessTokenNewTokenGenerationFails) {
std::string at = "access_token";
std::vector<std::string> scopes(CreateTestScopes());
- CreateFlow(rt, "", scopes);
+ CreateFlow(rt, std::string(), scopes);
SetupAccessTokenFetcher(rt, scopes);
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
diff --git a/google_apis/gaia/oauth2_mint_token_flow.cc b/google_apis/gaia/oauth2_mint_token_flow.cc
index 42fc4ef..169d187 100644
--- a/google_apis/gaia/oauth2_mint_token_flow.cc
+++ b/google_apis/gaia/oauth2_mint_token_flow.cc
@@ -89,17 +89,16 @@ OAuth2MintTokenFlow::Parameters::Parameters(
OAuth2MintTokenFlow::Parameters::~Parameters() {}
-OAuth2MintTokenFlow::OAuth2MintTokenFlow(
- URLRequestContextGetter* context,
- Delegate* delegate,
- const Parameters& parameters)
- : OAuth2ApiCallFlow(
- context, parameters.login_refresh_token,
- "", std::vector<std::string>()),
+OAuth2MintTokenFlow::OAuth2MintTokenFlow(URLRequestContextGetter* context,
+ Delegate* delegate,
+ const Parameters& parameters)
+ : OAuth2ApiCallFlow(context,
+ parameters.login_refresh_token,
+ std::string(),
+ std::vector<std::string>()),
delegate_(delegate),
parameters_(parameters),
- ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
-}
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {}
OAuth2MintTokenFlow::~OAuth2MintTokenFlow() { }
diff --git a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc
index e213984..3206601 100644
--- a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc
+++ b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc
@@ -272,7 +272,7 @@ TEST_F(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse) {
TEST_F(OAuth2MintTokenFlowTest, ProcessApiCallSuccess) {
{ // No body.
TestURLFetcher url_fetcher(1, GURL("http://www.google.com"), NULL);
- url_fetcher.SetResponseString("");
+ url_fetcher.SetResponseString(std::string());
CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE);
EXPECT_CALL(delegate_, OnMintTokenFailure(_));
flow_->ProcessApiCallSuccess(&url_fetcher);
diff --git a/google_apis/gaia/oauth_request_signer.cc b/google_apis/gaia/oauth_request_signer.cc
index b5d138f..9952a6f 100644
--- a/google_apis/gaia/oauth_request_signer.cc
+++ b/google_apis/gaia/oauth_request_signer.cc
@@ -89,7 +89,7 @@ std::string BuildBaseString(const GURL& request_base_url,
std::string BuildBaseStringParameters(
const OAuthRequestSigner::Parameters& parameters) {
- std::string result = "";
+ std::string result;
OAuthRequestSigner::Parameters::const_iterator cursor;
OAuthRequestSigner::Parameters::const_iterator limit;
bool first = true;
@@ -297,7 +297,7 @@ bool SignParameters(const GURL& request_base_url,
// static
bool OAuthRequestSigner::Decode(const std::string& text,
std::string* decoded_text) {
- std::string accumulator = "";
+ std::string accumulator;
std::string::const_iterator cursor;
std::string::const_iterator limit;
for (limit = text.end(), cursor = text.begin(); cursor != limit; ++cursor) {
@@ -335,7 +335,7 @@ bool OAuthRequestSigner::Decode(const std::string& text,
// static
std::string OAuthRequestSigner::Encode(const std::string& text) {
- std::string result = "";
+ std::string result;
std::string::const_iterator cursor;
std::string::const_iterator limit;
for (limit = text.end(), cursor = text.begin(); cursor != limit; ++cursor) {
diff --git a/google_apis/gaia/oauth_request_signer_unittest.cc b/google_apis/gaia/oauth_request_signer_unittest.cc
index 5cf2dc2..40206f6 100644
--- a/google_apis/gaia/oauth_request_signer_unittest.cc
+++ b/google_apis/gaia/oauth_request_signer_unittest.cc
@@ -109,15 +109,15 @@ TEST(OAuthRequestSignerTest, SignGet2) {
parameters["oauth_nonce"] = "4d4hZW9DygWQujP2tz06UN";
std::string signed_text;
ASSERT_TRUE(OAuthRequestSigner::SignURL(
- request_url,
- parameters,
- OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
- OAuthRequestSigner::GET_METHOD,
- "anonymous", // oauth_consumer_key
- "anonymous", // consumer secret
- "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
- "", // token secret
- &signed_text));
+ request_url,
+ parameters,
+ OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
+ OAuthRequestSigner::GET_METHOD,
+ "anonymous", // oauth_consumer_key
+ "anonymous", // consumer secret
+ "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
+ std::string(), // token secret
+ &signed_text));
ASSERT_EQ(signed_text,
"https://accounts.google.com/OAuthGetAccessToken"
"?oauth_consumer_key=anonymous"
@@ -137,14 +137,14 @@ TEST(OAuthRequestSignerTest, ParseAndSignGet1) {
"&oauth_timestamp=1308152953");
std::string signed_text;
ASSERT_TRUE(OAuthRequestSigner::ParseAndSign(
- request_url,
- OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
- OAuthRequestSigner::GET_METHOD,
- "anonymous", // oauth_consumer_key
- "anonymous", // consumer secret
- "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
- "", // token secret
- &signed_text));
+ request_url,
+ OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
+ OAuthRequestSigner::GET_METHOD,
+ "anonymous", // oauth_consumer_key
+ "anonymous", // consumer secret
+ "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
+ std::string(), // token secret
+ &signed_text));
ASSERT_EQ("https://www.google.com/accounts/o8/GetOAuthToken"
"?oauth_consumer_key=anonymous"
"&oauth_nonce=2oiE_aHdk5qRTz0L9C8Lq0g"
@@ -164,14 +164,14 @@ TEST(OAuthRequestSignerTest, ParseAndSignGet2) {
"&oauth_nonce=4d4hZW9DygWQujP2tz06UN");
std::string signed_text;
ASSERT_TRUE(OAuthRequestSigner::ParseAndSign(
- request_url,
- OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
- OAuthRequestSigner::GET_METHOD,
- "anonymous", // oauth_consumer_key
- "anonymous", // consumer secret
- "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
- "", // token secret
- &signed_text));
+ request_url,
+ OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
+ OAuthRequestSigner::GET_METHOD,
+ "anonymous", // oauth_consumer_key
+ "anonymous", // consumer secret
+ "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
+ std::string(), // token secret
+ &signed_text));
ASSERT_EQ(signed_text,
"https://accounts.google.com/OAuthGetAccessToken"
"?oauth_consumer_key=anonymous"
@@ -220,15 +220,15 @@ TEST(OAuthRequestSignerTest, SignPost2) {
parameters["oauth_nonce"] = "17171717171717171";
std::string signed_text;
ASSERT_TRUE(OAuthRequestSigner::SignURL(
- request_url,
- parameters,
- OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
- OAuthRequestSigner::POST_METHOD,
- "anonymous", // oauth_consumer_key
- "anonymous", // consumer secret
- "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
- "", // token secret
- &signed_text));
+ request_url,
+ parameters,
+ OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
+ OAuthRequestSigner::POST_METHOD,
+ "anonymous", // oauth_consumer_key
+ "anonymous", // consumer secret
+ "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
+ std::string(), // token secret
+ &signed_text));
ASSERT_EQ(signed_text,
"oauth_consumer_key=anonymous"
"&oauth_nonce=17171717171717171"
@@ -273,14 +273,14 @@ TEST(OAuthRequestSignerTest, ParseAndSignPost2) {
"&oauth_nonce=17171717171717171");
std::string signed_text;
ASSERT_TRUE(OAuthRequestSigner::ParseAndSign(
- request_url,
- OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
- OAuthRequestSigner::POST_METHOD,
- "anonymous", // oauth_consumer_key
- "anonymous", // consumer secret
- "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
- "", // token secret
- &signed_text));
+ request_url,
+ OAuthRequestSigner::HMAC_SHA1_SIGNATURE,
+ OAuthRequestSigner::POST_METHOD,
+ "anonymous", // oauth_consumer_key
+ "anonymous", // consumer secret
+ "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token
+ std::string(), // token secret
+ &signed_text));
ASSERT_EQ(signed_text,
"oauth_consumer_key=anonymous"
"&oauth_nonce=17171717171717171"
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc
index cd13b9e..c05435e 100644
--- a/google_apis/google_api_keys.cc
+++ b/google_apis/google_api_keys.cc
@@ -98,22 +98,25 @@ class APIKeyCache {
api_key_ = CalculateKeyValue(GOOGLE_API_KEY,
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY),
- NULL, "",
+ NULL,
+ std::string(),
environment.get(),
command_line);
- std::string default_client_id = CalculateKeyValue(
- GOOGLE_DEFAULT_CLIENT_ID,
- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID),
- NULL, "",
- environment.get(),
- command_line);
- std::string default_client_secret = CalculateKeyValue(
- GOOGLE_DEFAULT_CLIENT_SECRET,
- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET),
- NULL, "",
- environment.get(),
- command_line);
+ std::string default_client_id =
+ CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_ID,
+ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID),
+ NULL,
+ std::string(),
+ environment.get(),
+ command_line);
+ std::string default_client_secret =
+ CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_SECRET,
+ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET),
+ NULL,
+ std::string(),
+ environment.get(),
+ command_line);
// We currently only allow overriding the baked-in values for the
// default OAuth2 client ID and secret using a command-line