OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 GaiaOAuthClient. | 5 // A complete set of unit tests for GaiaOAuthClient. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 net::URLRequestStatus::Status code = net::URLRequestStatus::SUCCESS; | 50 net::URLRequestStatus::Status code = net::URLRequestStatus::SUCCESS; |
51 if (response_code_ != RC_REQUEST_OK) { | 51 if (response_code_ != RC_REQUEST_OK) { |
52 code = net::URLRequestStatus::FAILED; | 52 code = net::URLRequestStatus::FAILED; |
53 current_failure_count_++; | 53 current_failure_count_++; |
54 } | 54 } |
55 status_ = net::URLRequestStatus(code, 0); | 55 status_ = net::URLRequestStatus(code, 0); |
56 | 56 |
57 delegate()->OnURLFetchComplete(this); | 57 delegate()->OnURLFetchComplete(this); |
58 } | 58 } |
59 | 59 |
60 virtual const GURL& url() const { | 60 virtual const GURL& GetUrl() const OVERRIDE { |
61 return url_; | 61 return url_; |
62 } | 62 } |
63 | 63 |
64 virtual const net::URLRequestStatus& status() const { | 64 virtual const net::URLRequestStatus& GetStatus() const OVERRIDE { |
65 return status_; | 65 return status_; |
66 } | 66 } |
67 | 67 |
68 virtual int response_code() const { | 68 virtual int GetResponseCode() const OVERRIDE { |
69 return response_code_; | 69 return response_code_; |
70 } | 70 } |
71 | 71 |
72 virtual bool GetResponseAsString(std::string* out_response_string) const { | 72 virtual bool GetResponseAsString( |
| 73 std::string* out_response_string) const OVERRIDE { |
73 *out_response_string = results_; | 74 *out_response_string = results_; |
74 return true; | 75 return true; |
75 } | 76 } |
76 | 77 |
77 private: | 78 private: |
78 net::URLRequestStatus status_; | 79 net::URLRequestStatus status_; |
79 int response_code_; | 80 int response_code_; |
80 int max_failure_count_; | 81 int max_failure_count_; |
81 int current_failure_count_; | 82 int current_failure_count_; |
82 GURL url_; | 83 GURL url_; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 factory.set_results(kDummyRefreshTokenResult); | 255 factory.set_results(kDummyRefreshTokenResult); |
255 | 256 |
256 OAuthClientInfo client_info; | 257 OAuthClientInfo client_info; |
257 client_info.client_id = "test_client_id"; | 258 client_info.client_id = "test_client_id"; |
258 client_info.client_secret = "test_client_secret"; | 259 client_info.client_secret = "test_client_secret"; |
259 GaiaOAuthClient auth(kGaiaOAuth2Url, | 260 GaiaOAuthClient auth(kGaiaOAuth2Url, |
260 profile_.GetRequestContext()); | 261 profile_.GetRequestContext()); |
261 auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate); | 262 auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate); |
262 } | 263 } |
263 } // namespace gaia | 264 } // namespace gaia |
OLD | NEW |