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/contact_info_edit_coordinator.h" | 5 #import "ios/chrome/browser/ui/payments/contact_info_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" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 EXPECT_EQ(nil, base_view_controller.presentedViewController); | 177 EXPECT_EQ(nil, base_view_controller.presentedViewController); |
178 | 178 |
179 [coordinator start]; | 179 [coordinator start]; |
180 // Spin the run loop to trigger the animation. | 180 // Spin the run loop to trigger the animation. |
181 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); | 181 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); |
182 EXPECT_NE(nil, base_view_controller.presentedViewController); | 182 EXPECT_NE(nil, base_view_controller.presentedViewController); |
183 | 183 |
184 // Expect an autofill profile to be added to the PaymentRequest. | 184 // Expect an autofill profile to be added to the PaymentRequest. |
185 EXPECT_CALL(*payment_request_, | 185 EXPECT_CALL(*payment_request_, |
186 AddAutofillProfile( | 186 AddAutofillProfile( |
187 ProfileMatches("John Doe", "john@doe.com", "16502111111"))) | 187 ProfileMatches("John Doe", "john@doe.com", "1 650-211-1111"))) |
188 .Times(1); | 188 .Times(1); |
189 // Expect an autofill profile to be added to the PersonalDataManager. | 189 // Expect an autofill profile to be added to the PersonalDataManager. |
190 EXPECT_CALL( | 190 EXPECT_CALL( |
191 personal_data_manager_, | 191 personal_data_manager_, |
192 AddProfile(ProfileMatches("John Doe", "john@doe.com", "16502111111"))) | 192 AddProfile(ProfileMatches("John Doe", "john@doe.com", "1 650-211-1111"))) |
193 .Times(1); | 193 .Times(1); |
194 // No autofill profile should get updated in the PersonalDataManager. | 194 // No autofill profile should get updated in the PersonalDataManager. |
195 EXPECT_CALL(personal_data_manager_, UpdateProfile(_)).Times(0); | 195 EXPECT_CALL(personal_data_manager_, UpdateProfile(_)).Times(0); |
196 // No autofill profile should get invalidated in PaymentsProfileComparator. | 196 // No autofill profile should get invalidated in PaymentsProfileComparator. |
197 EXPECT_CALL(*profile_comparator_, Invalidate(_)).Times(0); | 197 EXPECT_CALL(*profile_comparator_, Invalidate(_)).Times(0); |
198 | 198 |
199 // Call the controller delegate method. | 199 // Call the controller delegate method. |
200 EXPECT_TRUE([base_view_controller.presentedViewController | 200 EXPECT_TRUE([base_view_controller.presentedViewController |
201 isMemberOfClass:[UINavigationController class]]); | 201 isMemberOfClass:[UINavigationController class]]); |
202 UINavigationController* navigation_controller = | 202 UINavigationController* navigation_controller = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 [coordinator start]; | 243 [coordinator start]; |
244 // Spin the run loop to trigger the animation. | 244 // Spin the run loop to trigger the animation. |
245 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); | 245 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); |
246 EXPECT_NE(nil, base_view_controller.presentedViewController); | 246 EXPECT_NE(nil, base_view_controller.presentedViewController); |
247 | 247 |
248 // No autofill profile should get added to the PaymentRequest. | 248 // No autofill profile should get added to the PaymentRequest. |
249 EXPECT_CALL(*payment_request_, AddAutofillProfile(_)).Times(0); | 249 EXPECT_CALL(*payment_request_, AddAutofillProfile(_)).Times(0); |
250 // No autofill profile should get added to the PersonalDataManager. | 250 // No autofill profile should get added to the PersonalDataManager. |
251 EXPECT_CALL(personal_data_manager_, AddProfile(_)).Times(0); | 251 EXPECT_CALL(personal_data_manager_, AddProfile(_)).Times(0); |
252 // Expect an autofill profile to be updated in the PersonalDataManager. | 252 // Expect an autofill profile to be updated in the PersonalDataManager. |
253 EXPECT_CALL( | 253 EXPECT_CALL(personal_data_manager_, |
254 personal_data_manager_, | 254 UpdateProfile( |
255 UpdateProfile(ProfileMatches("John Doe", "john@doe.com", "16502111111"))) | 255 ProfileMatches("John Doe", "john@doe.com", "1 650-211-1111"))) |
256 .Times(1); | 256 .Times(1); |
257 // Expect an autofill profile to be invalidated in PaymentsProfileComparator. | 257 // Expect an autofill profile to be invalidated in PaymentsProfileComparator. |
258 EXPECT_CALL( | 258 EXPECT_CALL( |
259 *profile_comparator_, | 259 *profile_comparator_, |
260 Invalidate(ProfileMatches("John Doe", "john@doe.com", "16502111111"))) | 260 Invalidate(ProfileMatches("John Doe", "john@doe.com", "1 650-211-1111"))) |
261 .Times(1); | 261 .Times(1); |
262 | 262 |
263 // Call the controller delegate method. | 263 // Call the controller delegate method. |
264 EXPECT_TRUE([base_view_controller.presentedViewController | 264 EXPECT_TRUE([base_view_controller.presentedViewController |
265 isMemberOfClass:[UINavigationController class]]); | 265 isMemberOfClass:[UINavigationController class]]); |
266 UINavigationController* navigation_controller = | 266 UINavigationController* navigation_controller = |
267 base::mac::ObjCCastStrict<UINavigationController>( | 267 base::mac::ObjCCastStrict<UINavigationController>( |
268 base_view_controller.presentedViewController); | 268 base_view_controller.presentedViewController); |
269 PaymentRequestEditViewController* view_controller = | 269 PaymentRequestEditViewController* view_controller = |
270 base::mac::ObjCCastStrict<PaymentRequestEditViewController>( | 270 base::mac::ObjCCastStrict<PaymentRequestEditViewController>( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 UINavigationController* navigation_controller = | 306 UINavigationController* navigation_controller = |
307 base::mac::ObjCCastStrict<UINavigationController>( | 307 base::mac::ObjCCastStrict<UINavigationController>( |
308 base_view_controller.presentedViewController); | 308 base_view_controller.presentedViewController); |
309 PaymentRequestEditViewController* view_controller = | 309 PaymentRequestEditViewController* view_controller = |
310 base::mac::ObjCCastStrict<PaymentRequestEditViewController>( | 310 base::mac::ObjCCastStrict<PaymentRequestEditViewController>( |
311 navigation_controller.visibleViewController); | 311 navigation_controller.visibleViewController); |
312 [coordinator paymentRequestEditViewControllerDidCancel:view_controller]; | 312 [coordinator paymentRequestEditViewControllerDidCancel:view_controller]; |
313 | 313 |
314 EXPECT_OCMOCK_VERIFY(delegate); | 314 EXPECT_OCMOCK_VERIFY(delegate); |
315 } | 315 } |
OLD | NEW |