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

Side by Side Diff: chrome/common/net/gaia/gaia_oauth_client_unittest.cc

Issue 7465041: GTTF: Use a fresh TestingBrowserProcess for each test, part #4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc ('k') | content/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "chrome/test/testing_browser_process_test.h"
15 #include "content/common/url_fetcher.h" 16 #include "content/common/url_fetcher.h"
16 #include "content/test/test_url_fetcher_factory.h" 17 #include "content/test/test_url_fetcher_factory.h"
17 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
18 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
19 #include "net/url_request/url_request_status.h" 20 #include "net/url_request/url_request_status.h"
20 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 23
23 using ::testing::_; 24 using ::testing::_;
24 25
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "," 117 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + ","
117 "\"refresh_token\":\"" + kTestRefreshToken + "\"}"; 118 "\"refresh_token\":\"" + kTestRefreshToken + "\"}";
118 119
119 const std::string kDummyRefreshTokenResult = 120 const std::string kDummyRefreshTokenResult =
120 "{\"access_token\":\"" + kTestAccessToken + "\"," 121 "{\"access_token\":\"" + kTestAccessToken + "\","
121 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; 122 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}";
122 } 123 }
123 124
124 namespace gaia { 125 namespace gaia {
125 126
126 class GaiaOAuthClientTest : public testing::Test { 127 class GaiaOAuthClientTest : public TestingBrowserProcessTest {
127 public: 128 public:
128 GaiaOAuthClientTest() {} 129 GaiaOAuthClientTest() {}
129 130
130 TestingProfile profile_; 131 TestingProfile profile_;
131 protected: 132 protected:
132 MessageLoop message_loop_; 133 MessageLoop message_loop_;
133 }; 134 };
134 135
135 class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate { 136 class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate {
136 public: 137 public:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 factory.set_results(kDummyRefreshTokenResult); 240 factory.set_results(kDummyRefreshTokenResult);
240 241
241 OAuthClientInfo client_info; 242 OAuthClientInfo client_info;
242 client_info.client_id = "test_client_id"; 243 client_info.client_id = "test_client_id";
243 client_info.client_secret = "test_client_secret"; 244 client_info.client_secret = "test_client_secret";
244 GaiaOAuthClient auth(kGaiaOAuth2Url, 245 GaiaOAuthClient auth(kGaiaOAuth2Url,
245 profile_.GetRequestContext()); 246 profile_.GetRequestContext());
246 auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate); 247 auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate);
247 } 248 }
248 } // namespace gaia 249 } // namespace gaia
OLDNEW
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc ('k') | content/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698