OLD | NEW |
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 #import "ios/chrome/browser/ui/payments/address_edit_coordinator.h" | 5 #import "ios/chrome/browser/ui/payments/address_edit_coordinator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/test/ios/wait_util.h" | 11 #include "base/test/ios/wait_util.h" |
12 #include "base/test/scoped_task_environment.h" | 12 #include "base/test/scoped_task_environment.h" |
13 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
14 #include "components/autofill/core/browser/autofill_test_utils.h" | 14 #include "components/autofill/core/browser/autofill_test_utils.h" |
15 #include "components/autofill/core/browser/country_names.h" | 15 #include "components/autofill/core/browser/country_names.h" |
16 #include "components/autofill/core/browser/test_personal_data_manager.h" | 16 #include "components/autofill/core/browser/test_personal_data_manager.h" |
17 #include "components/autofill/core/browser/test_region_data_loader.h" | 17 #include "components/autofill/core/browser/test_region_data_loader.h" |
18 #include "components/payments/core/payments_profile_comparator.h" | 18 #include "components/payments/core/payments_profile_comparator.h" |
19 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
20 #include "ios/chrome/browser/application_context.h" | |
21 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 20 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
22 #include "ios/chrome/browser/payments/payment_request_test_util.h" | 21 #include "ios/chrome/browser/payments/payment_request_test_util.h" |
23 #include "ios/chrome/browser/payments/test_payment_request.h" | 22 #include "ios/chrome/browser/payments/test_payment_request.h" |
24 #import "ios/chrome/browser/ui/payments/payment_request_edit_view_controller.h" | 23 #import "ios/chrome/browser/ui/payments/payment_request_edit_view_controller.h" |
25 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h" | 24 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h" |
26 #import "ios/chrome/test/scoped_key_window.h" | 25 #import "ios/chrome/test/scoped_key_window.h" |
27 #import "ios/web/public/test/fakes/test_web_state.h" | 26 #import "ios/web/public/test/fakes/test_web_state.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "testing/platform_test.h" | 29 #include "testing/platform_test.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 : pref_service_(autofill::test::PrefServiceForTesting()), | 112 : pref_service_(autofill::test::PrefServiceForTesting()), |
114 chrome_browser_state_(TestChromeBrowserState::Builder().Build()) { | 113 chrome_browser_state_(TestChromeBrowserState::Builder().Build()) { |
115 autofill::CountryNames::SetLocaleString("en-US"); | 114 autofill::CountryNames::SetLocaleString("en-US"); |
116 personal_data_manager_.SetTestingPrefService(pref_service_.get()); | 115 personal_data_manager_.SetTestingPrefService(pref_service_.get()); |
117 | 116 |
118 payment_request_ = base::MakeUnique<MockTestPaymentRequest>( | 117 payment_request_ = base::MakeUnique<MockTestPaymentRequest>( |
119 payment_request_test_util::CreateTestWebPaymentRequest(), | 118 payment_request_test_util::CreateTestWebPaymentRequest(), |
120 chrome_browser_state_.get(), &web_state_, &personal_data_manager_); | 119 chrome_browser_state_.get(), &web_state_, &personal_data_manager_); |
121 | 120 |
122 profile_comparator_ = base::MakeUnique<MockPaymentsProfileComparator>( | 121 profile_comparator_ = base::MakeUnique<MockPaymentsProfileComparator>( |
123 GetApplicationContext()->GetApplicationLocale(), | 122 payment_request_->GetApplicationLocale(), *payment_request_.get()); |
124 *payment_request_.get()); | |
125 payment_request_->SetProfileComparator(profile_comparator_.get()); | 123 payment_request_->SetProfileComparator(profile_comparator_.get()); |
126 | 124 |
127 test_region_data_loader_.set_synchronous_callback(true); | 125 test_region_data_loader_.set_synchronous_callback(true); |
128 payment_request_->SetRegionDataLoader(&test_region_data_loader_); | 126 payment_request_->SetRegionDataLoader(&test_region_data_loader_); |
129 } | 127 } |
130 | 128 |
131 void TearDown() override { | 129 void TearDown() override { |
132 personal_data_manager_.SetTestingPrefService(nullptr); | 130 personal_data_manager_.SetTestingPrefService(nullptr); |
133 } | 131 } |
134 | 132 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 UINavigationController* navigation_controller = | 329 UINavigationController* navigation_controller = |
332 base::mac::ObjCCastStrict<UINavigationController>( | 330 base::mac::ObjCCastStrict<UINavigationController>( |
333 base_view_controller.presentedViewController); | 331 base_view_controller.presentedViewController); |
334 PaymentRequestEditViewController* view_controller = | 332 PaymentRequestEditViewController* view_controller = |
335 base::mac::ObjCCastStrict<PaymentRequestEditViewController>( | 333 base::mac::ObjCCastStrict<PaymentRequestEditViewController>( |
336 navigation_controller.visibleViewController); | 334 navigation_controller.visibleViewController); |
337 [coordinator paymentRequestEditViewControllerDidCancel:view_controller]; | 335 [coordinator paymentRequestEditViewControllerDidCancel:view_controller]; |
338 | 336 |
339 EXPECT_OCMOCK_VERIFY(delegate); | 337 EXPECT_OCMOCK_VERIFY(delegate); |
340 } | 338 } |
OLD | NEW |