summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 23:36:21 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 23:36:21 +0000
commitfaf8a07321eadcaad5615e4c5c2fff0355b6414e (patch)
treef91722f2713df0aeedf3dad386306d42a4724cea /google_apis
parent94542cd16235b34fbe46e5ab35109abefc90642c (diff)
downloadchromium_src-faf8a07321eadcaad5615e4c5c2fff0355b6414e.zip
chromium_src-faf8a07321eadcaad5615e4c5c2fff0355b6414e.tar.gz
chromium_src-faf8a07321eadcaad5615e4c5c2fff0355b6414e.tar.bz2
Fix a couple of GaiaAuthFetcherTest tests to work when non-official keys are used.
BUG=169093 Review URL: https://chromiumcodereview.appspot.com/11829038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gaia/gaia_auth_fetcher_unittest.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
index cfa617d..226ee1a 100644
--- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc
+++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
@@ -17,6 +17,7 @@
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/mock_url_fetcher_factory.h"
+#include "google_apis/google_api_keys.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -811,19 +812,22 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthSuccess) {
scopes.push_back("https://some.other.scope.com");
auth.StartClientOAuth("username", "password", scopes, "", "en");
- scoped_ptr<base::Value> actual(base::JSONReader::Read(auth.request_body_));
- scoped_ptr<base::Value> expected(base::JSONReader::Read(
+ std::string expected_text = base::StringPrintf(
"{"
"\"email\": \"username\","
"\"password\": \"password\","
"\"scopes\": [\"https://www.google.com/accounts/OAuthLogin\","
" \"https://some.other.scope.com\"],"
- "\"oauth2_client_id\": \"77185425430.apps.googleusercontent.com\","
+ "\"oauth2_client_id\": \"%s\","
"\"friendly_device_name\": \"tests\","
"\"accepts_challenges\": [\"Captcha\", \"TwoStep\"],"
"\"locale\": \"en\","
"\"fallback\": { \"name\": \"GetOAuth2Token\" }"
- "}"));
+ "}",
+ google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN).c_str());
+
+ scoped_ptr<base::Value> actual(base::JSONReader::Read(auth.request_body_));
+ scoped_ptr<base::Value> expected(base::JSONReader::Read(expected_text));
EXPECT_TRUE(expected->Equals(actual.get()));
}
@@ -840,18 +844,20 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthWithQuote) {
scopes.push_back("https://some.\"other.scope.com");
auth.StartClientOAuth("user\"name", "pass\"word", scopes, "", "e\"n");
- scoped_ptr<base::Value> actual(base::JSONReader::Read(auth.request_body_));
- scoped_ptr<base::Value> expected(base::JSONReader::Read(
+ std::string expected_text = base::StringPrintf(
"{"
"\"email\": \"user\\\"name\","
"\"password\": \"pass\\\"word\","
"\"scopes\": [\"https://some.\\\"other.scope.com\"],"
- "\"oauth2_client_id\": \"77185425430.apps.googleusercontent.com\","
+ "\"oauth2_client_id\": \"%s\","
"\"friendly_device_name\": \"te\\\"sts\","
"\"accepts_challenges\": [\"Captcha\", \"TwoStep\"],"
"\"locale\": \"e\\\"n\","
"\"fallback\": { \"name\": \"GetOAuth2Token\" }"
- "}"));
+ "}",
+ google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN).c_str());
+ scoped_ptr<base::Value> actual(base::JSONReader::Read(auth.request_body_));
+ scoped_ptr<base::Value> expected(base::JSONReader::Read(expected_text));
EXPECT_TRUE(expected->Equals(actual.get()));
}