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

Side by Side Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc

Issue 2888733004: Change text and disable empty combobox for payment request shipping address (Closed)
Patch Set: Fixed a weird goof Created 3 years, 7 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 478
479 // Still have one instrument, but now it's selected. 479 // Still have one instrument, but now it's selected.
480 EXPECT_EQ(1U, request->state()->available_instruments().size()); 480 EXPECT_EQ(1U, request->state()->available_instruments().size());
481 EXPECT_EQ(request->state()->available_instruments().back().get(), 481 EXPECT_EQ(request->state()->available_instruments().back().get(),
482 request->state()->selected_instrument()); 482 request->state()->selected_instrument());
483 } 483 }
484 484
485 IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, 485 IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
486 CreateNewBillingAddress) { 486 CreateNewBillingAddress) {
487 autofill::CreditCard card = autofill::test::GetCreditCard(); 487 autofill::CreditCard card = autofill::test::GetCreditCard();
488 // Make sure to clear billing address. 488 // Make sure to clear billing address and have none available.
489 card.set_billing_address_id(""); 489 card.set_billing_address_id("");
490 AddCreditCard(card); 490 AddCreditCard(card);
491 491
492 autofill::TestAutofillClock test_clock; 492 autofill::TestAutofillClock test_clock;
493 test_clock.SetNow(kJune2017); 493 test_clock.SetNow(kJune2017);
494 autofill::AutofillProfile billing_profile(autofill::test::GetFullProfile());
495 AddAutofillProfile(billing_profile);
496 494
497 InvokePaymentRequestUI(); 495 InvokePaymentRequestUI();
498 496
499 // One instrument is available, but it's not selected. 497 // One instrument is available, but it's not selected.
500 PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front(); 498 PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front();
501 EXPECT_EQ(1U, request->state()->available_instruments().size()); 499 EXPECT_EQ(1U, request->state()->available_instruments().size());
502 EXPECT_EQ(nullptr, request->state()->selected_instrument()); 500 EXPECT_EQ(nullptr, request->state()->selected_instrument());
503 501
504 OpenPaymentMethodScreen(); 502 OpenPaymentMethodScreen();
505 503
506 ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED); 504 ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED);
507 ClickOnChildInListViewAndWait(/*child_index=*/0, /*num_children=*/1, 505 ClickOnChildInListViewAndWait(/*child_index=*/0, /*num_children=*/1,
508 DialogViewID::PAYMENT_METHOD_SHEET_LIST_VIEW); 506 DialogViewID::PAYMENT_METHOD_SHEET_LIST_VIEW);
507 // Billing address combobox must be disabled since there are no saved address.
508 views::View* billing_address_combobox = dialog_view()->GetViewByID(
509 static_cast<int>(autofill::ADDRESS_BILLING_LINE1));
510 ASSERT_NE(nullptr, billing_address_combobox);
511 EXPECT_FALSE(billing_address_combobox->enabled());
512
509 // Click to open the address editor 513 // Click to open the address editor
510 ResetEventObserver(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); 514 ResetEventObserver(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED);
511 ClickOnDialogViewAndWait(DialogViewID::ADD_BILLING_ADDRESS_BUTTON); 515 ClickOnDialogViewAndWait(DialogViewID::ADD_BILLING_ADDRESS_BUTTON);
512 516
513 // Set valid address values. 517 // Set valid address values.
514 SetEditorTextfieldValue(base::ASCIIToUTF16("Bob"), autofill::NAME_FULL); 518 SetEditorTextfieldValue(base::ASCIIToUTF16("Bob"), autofill::NAME_FULL);
515 SetEditorTextfieldValue(base::ASCIIToUTF16("42 BobStreet"), 519 SetEditorTextfieldValue(base::ASCIIToUTF16("42 BobStreet"),
516 autofill::ADDRESS_HOME_STREET_ADDRESS); 520 autofill::ADDRESS_HOME_STREET_ADDRESS);
517 SetEditorTextfieldValue(base::ASCIIToUTF16("BobCity"), 521 SetEditorTextfieldValue(base::ASCIIToUTF16("BobCity"),
518 autofill::ADDRESS_HOME_CITY); 522 autofill::ADDRESS_HOME_CITY);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 autofill::CREDIT_CARD_NAME_FULL); 600 autofill::CREDIT_CARD_NAME_FULL);
597 601
598 ValidatingTextfield* textfield = 602 ValidatingTextfield* textfield =
599 static_cast<ValidatingTextfield*>(dialog_view()->GetViewByID( 603 static_cast<ValidatingTextfield*>(dialog_view()->GetViewByID(
600 static_cast<int>(autofill::CREDIT_CARD_NAME_FULL))); 604 static_cast<int>(autofill::CREDIT_CARD_NAME_FULL)));
601 EXPECT_TRUE(textfield); 605 EXPECT_TRUE(textfield);
602 EXPECT_TRUE(textfield->invalid()); 606 EXPECT_TRUE(textfield->invalid());
603 } 607 }
604 608
605 } // namespace payments 609 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698