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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
10 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 autofill::AutofillProfile other_incomplete_profile; | 231 autofill::AutofillProfile other_incomplete_profile; |
232 other_incomplete_profile.SetInfo(autofill::AutofillType(autofill::NAME_FULL), | 232 other_incomplete_profile.SetInfo(autofill::AutofillType(autofill::NAME_FULL), |
233 base::ASCIIToUTF16("other"), GetLocale()); | 233 base::ASCIIToUTF16("other"), GetLocale()); |
234 AddAutofillProfile(other_incomplete_profile); | 234 AddAutofillProfile(other_incomplete_profile); |
235 | 235 |
236 InvokePaymentRequestUI(); | 236 InvokePaymentRequestUI(); |
237 OpenContactInfoScreen(); | 237 OpenContactInfoScreen(); |
238 | 238 |
239 PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front(); | 239 PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front(); |
240 EXPECT_EQ(request->state()->contact_profiles().front(), | 240 |
241 request->state()->selected_contact_profile()); | 241 // No contact profiles are selected because both are incomplete. |
| 242 EXPECT_EQ(nullptr, request->state()->selected_contact_profile()); |
242 | 243 |
243 views::View* list_view = dialog_view()->GetViewByID( | 244 views::View* list_view = dialog_view()->GetViewByID( |
244 static_cast<int>(DialogViewID::CONTACT_INFO_SHEET_LIST_VIEW)); | 245 static_cast<int>(DialogViewID::CONTACT_INFO_SHEET_LIST_VIEW)); |
245 DCHECK(list_view); | 246 DCHECK(list_view); |
246 ClickOnDialogViewAndWait(list_view->child_at(1)); | 247 ClickOnDialogViewAndWait(list_view->child_at(1)); |
247 | 248 |
248 SetEditorTextfieldValue(base::ASCIIToUTF16(kPhoneNumber), | 249 SetEditorTextfieldValue(base::ASCIIToUTF16(kPhoneNumber), |
249 autofill::PHONE_HOME_WHOLE_NUMBER); | 250 autofill::PHONE_HOME_WHOLE_NUMBER); |
250 SetEditorTextfieldValue(base::ASCIIToUTF16(kEmailAddress), | 251 SetEditorTextfieldValue(base::ASCIIToUTF16(kEmailAddress), |
251 autofill::EMAIL_ADDRESS); | 252 autofill::EMAIL_ADDRESS); |
(...skipping 10 matching lines...) Expand all Loading... |
262 DCHECK(profile); | 263 DCHECK(profile); |
263 | 264 |
264 EXPECT_EQ(base::ASCIIToUTF16("16515558946"), | 265 EXPECT_EQ(base::ASCIIToUTF16("16515558946"), |
265 profile->GetInfo( | 266 profile->GetInfo( |
266 autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), | 267 autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), |
267 GetLocale())); | 268 GetLocale())); |
268 EXPECT_EQ(base::ASCIIToUTF16(kEmailAddress), | 269 EXPECT_EQ(base::ASCIIToUTF16(kEmailAddress), |
269 profile->GetInfo(autofill::AutofillType(autofill::EMAIL_ADDRESS), | 270 profile->GetInfo(autofill::AutofillType(autofill::EMAIL_ADDRESS), |
270 GetLocale())); | 271 GetLocale())); |
271 | 272 |
| 273 // Expect the newly-completed profile to be selected. |
272 EXPECT_EQ(2U, request->state()->contact_profiles().size()); | 274 EXPECT_EQ(2U, request->state()->contact_profiles().size()); |
273 EXPECT_EQ(request->state()->contact_profiles().back(), profile); | 275 EXPECT_EQ(request->state()->contact_profiles().back(), profile); |
274 } | 276 } |
275 | 277 |
276 } // namespace payments | 278 } // namespace payments |
OLD | NEW |