| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/common/net/gaia/gaia_oauth_client.h" | 12 #include "chrome/common/net/gaia/gaia_oauth_client.h" |
| 13 #include "chrome/common/net/http_return.h" | 13 #include "chrome/common/net/http_return.h" |
| 14 #include "chrome/common/net/test_url_fetcher_factory.h" | |
| 15 #include "chrome/common/net/url_fetcher.h" | |
| 16 #include "chrome/test/testing_profile.h" | 14 #include "chrome/test/testing_profile.h" |
| 15 #include "content/common/test_url_fetcher_factory.h" |
| 16 #include "content/common/url_fetcher.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 using ::testing::_; | 23 using ::testing::_; |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 // Responds as though OAuth returned from the server. | 26 // Responds as though OAuth returned from the server. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 OAuthClientInfo client_info; | 247 OAuthClientInfo client_info; |
| 248 client_info.client_id = "test_client_id"; | 248 client_info.client_id = "test_client_id"; |
| 249 client_info.client_secret = "test_client_secret"; | 249 client_info.client_secret = "test_client_secret"; |
| 250 GaiaOAuthClient auth(kGaiaOAuth2Url, | 250 GaiaOAuthClient auth(kGaiaOAuth2Url, |
| 251 profile_.GetRequestContext()); | 251 profile_.GetRequestContext()); |
| 252 auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate); | 252 auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate); |
| 253 URLFetcher::set_factory(NULL); | 253 URLFetcher::set_factory(NULL); |
| 254 } | 254 } |
| 255 } // namespace gaia | 255 } // namespace gaia |
| OLD | NEW |