| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
| 7 #include "components/autofill/core/browser/autofill_test_utils.h" | 7 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 8 #include "components/autofill/core/browser/wallet/real_pan_wallet_client.h" | 8 #include "components/autofill/core/browser/wallet/real_pan_wallet_client.h" |
| 9 #include "components/autofill/core/common/autofill_switches.h" | 9 #include "components/autofill/core/common/autofill_switches.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 void OnDidGetRealPan(AutofillClient::GetRealPanResult result, | 46 void OnDidGetRealPan(AutofillClient::GetRealPanResult result, |
| 47 const std::string& real_pan) override { | 47 const std::string& real_pan) override { |
| 48 result_ = result; | 48 result_ = result; |
| 49 real_pan_ = real_pan; | 49 real_pan_ = real_pan; |
| 50 } | 50 } |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 void StartUnmasking() { | 53 void StartUnmasking() { |
| 54 token_service_->AddAccount("example@gmail.com"); | 54 token_service_->GetDelegate()->UpdateCredentials("example@gmail.com", |
| 55 "refresh_token"); |
| 55 identity_provider_->LogIn("example@gmail.com"); | 56 identity_provider_->LogIn("example@gmail.com"); |
| 56 CreditCard card = test::GetMaskedServerCard(); | 57 CreditCard card = test::GetMaskedServerCard(); |
| 57 CardUnmaskDelegate::UnmaskResponse response; | 58 CardUnmaskDelegate::UnmaskResponse response; |
| 58 response.cvc = base::ASCIIToUTF16("123"); | 59 response.cvc = base::ASCIIToUTF16("123"); |
| 59 client_->UnmaskCard(card, response); | 60 client_->UnmaskCard(card, response); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void IssueOAuthToken() { | 63 void IssueOAuthToken() { |
| 63 token_service_->IssueAllTokensForAccount( | 64 token_service_->IssueAllTokensForAccount( |
| 64 "example@gmail.com", | 65 "example@gmail.com", |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 TEST_F(RealPanWalletClientTest, OtherError) { | 189 TEST_F(RealPanWalletClientTest, OtherError) { |
| 189 StartUnmasking(); | 190 StartUnmasking(); |
| 190 IssueOAuthToken(); | 191 IssueOAuthToken(); |
| 191 ReturnResponse(net::HTTP_FORBIDDEN, std::string()); | 192 ReturnResponse(net::HTTP_FORBIDDEN, std::string()); |
| 192 EXPECT_EQ(AutofillClient::PERMANENT_FAILURE, result_); | 193 EXPECT_EQ(AutofillClient::PERMANENT_FAILURE, result_); |
| 193 EXPECT_EQ("", real_pan_); | 194 EXPECT_EQ("", real_pan_); |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace autofill | 197 } // namespace autofill |
| 197 } // namespace wallet | 198 } // namespace wallet |
| OLD | NEW |