| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/content/browser/wallet/wallet_signin_helper.h" | 5 #include "components/autofill/content/browser/wallet/wallet_signin_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void(const std::string& cookie_value)); | 45 void(const std::string& cookie_value)); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 class WalletSigninHelperTest : public testing::Test { | 50 class WalletSigninHelperTest : public testing::Test { |
| 51 protected: | 51 protected: |
| 52 WalletSigninHelperTest() | 52 WalletSigninHelperTest() |
| 53 : request_context_(new net::TestURLRequestContextGetter( | 53 : request_context_(new net::TestURLRequestContextGetter( |
| 54 base::MessageLoopProxy::current())) {} | 54 base::MessageLoopProxy::current())) {} |
| 55 virtual ~WalletSigninHelperTest() {} | 55 ~WalletSigninHelperTest() override {} |
| 56 | 56 |
| 57 virtual void SetUp() override { | 57 void SetUp() override { |
| 58 signin_helper_.reset( | 58 signin_helper_.reset( |
| 59 new WalletSigninHelper(&mock_delegate_, request_context_.get())); | 59 new WalletSigninHelper(&mock_delegate_, request_context_.get())); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void TearDown() override { | 62 void TearDown() override { signin_helper_.reset(); } |
| 63 signin_helper_.reset(); | |
| 64 } | |
| 65 | 63 |
| 66 // Sets up a response for the mock URLFetcher and completes the request. | 64 // Sets up a response for the mock URLFetcher and completes the request. |
| 67 void SetUpFetcherResponseAndCompleteRequest( | 65 void SetUpFetcherResponseAndCompleteRequest( |
| 68 const std::string& url, | 66 const std::string& url, |
| 69 int response_code, | 67 int response_code, |
| 70 const net::ResponseCookies& cookies, | 68 const net::ResponseCookies& cookies, |
| 71 const std::string& response_string) { | 69 const std::string& response_string) { |
| 72 net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); | 70 net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); |
| 73 ASSERT_TRUE(fetcher); | 71 ASSERT_TRUE(fetcher); |
| 74 ASSERT_TRUE(fetcher->delegate()); | 72 ASSERT_TRUE(fetcher->delegate()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 request_context_->GetURLRequestContext() | 168 request_context_->GetURLRequestContext() |
| 171 ->set_cookie_store(cookie_monster); | 169 ->set_cookie_store(cookie_monster); |
| 172 signin_helper_->StartWalletCookieValueFetch(); | 170 signin_helper_->StartWalletCookieValueFetch(); |
| 173 base::RunLoop().RunUntilIdle(); | 171 base::RunLoop().RunUntilIdle(); |
| 174 } | 172 } |
| 175 | 173 |
| 176 // TODO(aruslan): http://crbug.com/188317 Need more tests. | 174 // TODO(aruslan): http://crbug.com/188317 Need more tests. |
| 177 | 175 |
| 178 } // namespace wallet | 176 } // namespace wallet |
| 179 } // namespace autofill | 177 } // namespace autofill |
| OLD | NEW |