| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // A complete set of unit tests for GaiaOAuthFetcher. | 5 // A complete set of unit tests for GaiaOAuthFetcher. |
| 6 // Originally ported from GaiaAuthFetcher tests. | 6 // Originally ported from GaiaAuthFetcher tests. |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 MOCK_METHOD1(StartUserInfo, void(const std::string& oauth2_access_token)); | 81 MOCK_METHOD1(StartUserInfo, void(const std::string& oauth2_access_token)); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 #if 0 // Suppressing for now | 84 #if 0 // Suppressing for now |
| 85 TEST(GaiaOAuthFetcherTest, GetOAuthToken) { | 85 TEST(GaiaOAuthFetcherTest, GetOAuthToken) { |
| 86 const std::string oauth_token = "4/OAuth1-Request_Token-1234567"; | 86 const std::string oauth_token = "4/OAuth1-Request_Token-1234567"; |
| 87 base::Time creation = base::Time::Now(); | 87 base::Time creation = base::Time::Now(); |
| 88 base::Time expiration = base::Time::Time(); | 88 base::Time expiration = base::Time::Time(); |
| 89 | 89 |
| 90 scoped_ptr<net::CookieMonster::CanonicalCookie> canonical_cookie; | 90 scoped_ptr<net::CanonicalCookie> canonical_cookie; |
| 91 canonical_cookie.reset( | 91 canonical_cookie.reset( |
| 92 new net::CookieMonster::CanonicalCookie( | 92 new net::CanonicalCookie( |
| 93 GURL("http://www.google.com/"), // url | 93 GURL("http://www.google.com/"), // url |
| 94 "oauth_token", // name | 94 "oauth_token", // name |
| 95 oauth_token, // value | 95 oauth_token, // value |
| 96 "www.google.com", // domain | 96 "www.google.com", // domain |
| 97 "/accounts/o8/GetOAuthToken", // path | 97 "/accounts/o8/GetOAuthToken", // path |
| 98 "", // mac_key | 98 "", // mac_key |
| 99 "", // mac_algorithm | 99 "", // mac_algorithm |
| 100 creation, // creation | 100 creation, // creation |
| 101 expiration, // expiration | 101 expiration, // expiration |
| 102 creation, // last_access | 102 creation, // last_access |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); | 243 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); |
| 244 GURL url(GaiaUrls::GetInstance()->oauth_revoke_token_url()); | 244 GURL url(GaiaUrls::GetInstance()->oauth_revoke_token_url()); |
| 245 | 245 |
| 246 net::TestURLFetcher test_fetcher(0, GURL(), &oauth_fetcher); | 246 net::TestURLFetcher test_fetcher(0, GURL(), &oauth_fetcher); |
| 247 test_fetcher.set_url(url); | 247 test_fetcher.set_url(url); |
| 248 test_fetcher.set_status(status); | 248 test_fetcher.set_status(status); |
| 249 test_fetcher.set_response_code(net::HTTP_OK); | 249 test_fetcher.set_response_code(net::HTTP_OK); |
| 250 test_fetcher.set_cookies(cookies); | 250 test_fetcher.set_cookies(cookies); |
| 251 oauth_fetcher.OnURLFetchComplete(&test_fetcher); | 251 oauth_fetcher.OnURLFetchComplete(&test_fetcher); |
| 252 } | 252 } |
| OLD | NEW |