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

Side by Side Diff: chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc

Issue 7744039: Switch ChromeTestSuite to the same convention as ContentTestSuite: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixing 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
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 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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/browser/net/chrome_cookie_notification_details.h" 12 #include "chrome/browser/net/chrome_cookie_notification_details.h"
13 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" 13 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
14 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" 14 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/net/gaia/gaia_constants.h" 16 #include "chrome/common/net/gaia/gaia_constants.h"
17 #include "chrome/common/net/gaia/google_service_auth_error.h" 17 #include "chrome/common/net/gaia/google_service_auth_error.h"
18 #include "chrome/common/net/http_return.h" 18 #include "chrome/common/net/http_return.h"
19 #include "chrome/test/base/testing_browser_process_test.h"
20 #include "chrome/test/base/testing_profile.h" 19 #include "chrome/test/base/testing_profile.h"
21 #include "content/common/notification_service.h" 20 #include "content/common/notification_service.h"
22 #include "content/common/url_fetcher.h" 21 #include "content/common/url_fetcher.h"
23 #include "content/test/test_url_fetcher_factory.h" 22 #include "content/test/test_url_fetcher_factory.h"
24 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
25 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
26 #include "net/url_request/url_request_status.h" 25 #include "net/url_request/url_request_status.h"
27 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
29 28
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 std::string()); 140 std::string());
142 EXPECT_CALL(oauth_fetcher, StartOAuthGetAccessToken(oauth_token)).Times(1); 141 EXPECT_CALL(oauth_fetcher, StartOAuthGetAccessToken(oauth_token)).Times(1);
143 142
144 oauth_fetcher.Observe( 143 oauth_fetcher.Observe(
145 chrome::NOTIFICATION_COOKIE_CHANGED, 144 chrome::NOTIFICATION_COOKIE_CHANGED,
146 Source<Profile>(&profile), 145 Source<Profile>(&profile),
147 Details<ChromeCookieDetails>(cookie_details.get())); 146 Details<ChromeCookieDetails>(cookie_details.get()));
148 } 147 }
149 #endif // 0 // Suppressing for now 148 #endif // 0 // Suppressing for now
150 149
151 typedef TestingBrowserProcessTest GaiaOAuthFetcherTest; 150 typedef testing::Test GaiaOAuthFetcherTest;
152 151
153 TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) { 152 TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) {
154 const std::string oauth_token = 153 const std::string oauth_token =
155 "1/OAuth1-Access_Token-1234567890abcdefghijklm"; 154 "1/OAuth1-Access_Token-1234567890abcdefghijklm";
156 const std::string oauth_token_secret = "Dont_tell_the_secret-123"; 155 const std::string oauth_token_secret = "Dont_tell_the_secret-123";
157 const std::string data("oauth_token=" 156 const std::string data("oauth_token="
158 "1%2FOAuth1-Access_Token-1234567890abcdefghijklm" 157 "1%2FOAuth1-Access_Token-1234567890abcdefghijklm"
159 "&oauth_token_secret=Dont_tell_the_secret-123"); 158 "&oauth_token_secret=Dont_tell_the_secret-123");
160 159
161 MockGaiaOAuthConsumer consumer; 160 MockGaiaOAuthConsumer consumer;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 234
236 net::ResponseCookies cookies; 235 net::ResponseCookies cookies;
237 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); 236 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
238 oauth_fetcher.OnURLFetchComplete(NULL, 237 oauth_fetcher.OnURLFetchComplete(NULL,
239 GURL(kUserInfoUrl), 238 GURL(kUserInfoUrl),
240 status, 239 status,
241 RC_REQUEST_OK, 240 RC_REQUEST_OK,
242 cookies, 241 cookies,
243 data); 242 data);
244 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698