| 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 #include <errno.h> | 5 #include <errno.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/login/client_login_response_handler.h" | 9 #include "chrome/browser/chromeos/login/client_login_response_handler.h" |
| 10 #include "chrome/browser/chromeos/login/cookie_fetcher.h" | 10 #include "chrome/browser/chromeos/login/cookie_fetcher.h" |
| 11 #include "chrome/browser/chromeos/login/issue_response_handler.h" | 11 #include "chrome/browser/chromeos/login/issue_response_handler.h" |
| 12 #include "chrome/browser/chromeos/login/mock_auth_response_handler.h" | 12 #include "chrome/browser/chromeos/login/mock_auth_response_handler.h" |
| 13 #include "chrome/common/net/gaia/gaia_urls.h" | 13 #include "chrome/common/net/gaia/gaia_urls.h" |
| 14 #include "chrome/test/base/testing_browser_process_test.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
| 15 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
| 16 #include "content/common/url_fetcher.h" | 17 #include "content/common/url_fetcher.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 using ::testing::Return; | 24 using ::testing::Return; |
| 24 using ::testing::Invoke; | 25 using ::testing::Invoke; |
| 25 using ::testing::Unused; | 26 using ::testing::Unused; |
| 26 using ::testing::_; | 27 using ::testing::_; |
| 27 | 28 |
| 28 class CookieFetcherTest : public ::testing::Test { | 29 class CookieFetcherTest : public TestingBrowserProcessTest { |
| 29 public: | 30 public: |
| 30 CookieFetcherTest() | 31 CookieFetcherTest() |
| 31 : iat_url_(GaiaUrls::GetInstance()->issue_auth_token_url()), | 32 : iat_url_(GaiaUrls::GetInstance()->issue_auth_token_url()), |
| 32 ta_url_(GaiaUrls::GetInstance()->token_auth_url()), | 33 ta_url_(GaiaUrls::GetInstance()->token_auth_url()), |
| 33 client_login_data_("SID n' LSID"), | 34 client_login_data_("SID n' LSID"), |
| 34 token_("auth token"), | 35 token_("auth token"), |
| 35 ui_thread_(BrowserThread::UI, &message_loop_) { | 36 ui_thread_(BrowserThread::UI, &message_loop_) { |
| 36 } | 37 } |
| 37 | 38 |
| 38 const GURL iat_url_; | 39 const GURL iat_url_; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 TEST_F(CookieFetcherTest, IssueResponseHandlerTest) { | 184 TEST_F(CookieFetcherTest, IssueResponseHandlerTest) { |
| 184 IssueResponseHandler handler(NULL); | 185 IssueResponseHandler handler(NULL); |
| 185 std::string expected(IssueResponseHandler::BuildTokenAuthUrlWithToken( | 186 std::string expected(IssueResponseHandler::BuildTokenAuthUrlWithToken( |
| 186 std::string("a\n"))); | 187 std::string("a\n"))); |
| 187 | 188 |
| 188 scoped_ptr<URLFetcher> fetcher(handler.Handle(std::string("a\n"), NULL)); | 189 scoped_ptr<URLFetcher> fetcher(handler.Handle(std::string("a\n"), NULL)); |
| 189 EXPECT_EQ(expected, handler.token_url()); | 190 EXPECT_EQ(expected, handler.token_url()); |
| 190 } | 191 } |
| 191 | 192 |
| 192 } // namespace chromeos | 193 } // namespace chromeos |
| OLD | NEW |