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