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

Unified Diff: google_apis/gaia/gaia_auth_fetcher_unittest.cc

Issue 11829038: Fix a couple of GaiaAuthFetcherTest tests to work when non-official keys are used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/gaia_auth_fetcher_unittest.cc
diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
index cfa617d743d8cbab32bb599a580b0e5fbaa8a6ff..226ee1a55957df753e85ab55fc22d7a3c0e7175e 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());
blundell 2013/01/10 09:12:22 Is this generic enough to handle all of the differ
Jói 2013/01/10 18:46:25 Yes, the interfaces in src/google_api/google_api_k
+ 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()));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698