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

Side by Side Diff: components/payments/content/payment_request_spec_unittest.cc

Issue 2741343011: [Payments] Move PersonalDataManager and locale to PaymentRequestState (Closed)
Patch Set: Initial Created 3 years, 9 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/payments/content/payment_request_spec.h" 5 #include "components/payments/content/payment_request_spec.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "components/payments/content/payment_request.mojom.h" 10 #include "components/payments/content/payment_request.mojom.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace payments { 13 namespace payments {
14 14
15 class PaymentRequestSpecTest : public testing::Test, 15 class PaymentRequestSpecTest : public testing::Test,
16 public PaymentRequestSpec::Observer { 16 public PaymentRequestSpec::Observer {
17 protected: 17 protected:
18 ~PaymentRequestSpecTest() override {} 18 ~PaymentRequestSpecTest() override {}
19 19
20 void OnInvalidSpecProvided() override { 20 void OnInvalidSpecProvided() override {
21 on_invalid_spec_provided_called_ = true; 21 on_invalid_spec_provided_called_ = true;
22 } 22 }
23 23
24 void RecreateSpecWithMethodData( 24 void RecreateSpecWithMethodData(
25 std::vector<payments::mojom::PaymentMethodDataPtr> method_data) { 25 std::vector<payments::mojom::PaymentMethodDataPtr> method_data) {
26 spec_ = base::MakeUnique<PaymentRequestSpec>(nullptr, nullptr, 26 spec_ = base::MakeUnique<PaymentRequestSpec>(
27 std::move(method_data), this); 27 nullptr, nullptr, std::move(method_data), this, "en-US");
28 } 28 }
29 29
30 PaymentRequestSpec* spec() { return spec_.get(); } 30 PaymentRequestSpec* spec() { return spec_.get(); }
31 bool on_invalid_spec_provided_called() { 31 bool on_invalid_spec_provided_called() {
32 return on_invalid_spec_provided_called_; 32 return on_invalid_spec_provided_called_;
33 } 33 }
34 34
35 private: 35 private:
36 std::unique_ptr<PaymentRequestSpec> spec_; 36 std::unique_ptr<PaymentRequestSpec> spec_;
37 bool on_invalid_spec_provided_called_ = false; 37 bool on_invalid_spec_provided_called_ = false;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 RecreateSpecWithMethodData(std::move(method_data)); 203 RecreateSpecWithMethodData(std::move(method_data));
204 EXPECT_FALSE(on_invalid_spec_provided_called()); 204 EXPECT_FALSE(on_invalid_spec_provided_called());
205 205
206 // Only the specified networks are supported. 206 // Only the specified networks are supported.
207 EXPECT_EQ(2u, spec()->supported_card_networks().size()); 207 EXPECT_EQ(2u, spec()->supported_card_networks().size());
208 EXPECT_EQ("visa", spec()->supported_card_networks()[0]); 208 EXPECT_EQ("visa", spec()->supported_card_networks()[0]);
209 EXPECT_EQ("unionpay", spec()->supported_card_networks()[1]); 209 EXPECT_EQ("unionpay", spec()->supported_card_networks()[1]);
210 } 210 }
211 211
212 } // namespace payments 212 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_spec.cc ('k') | components/payments/content/payment_request_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698