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

Unified Diff: chrome/browser/ui/views/payments/contact_info_editor_view_controller_browsertest.cc

Issue 2866443002: [Web Payments] Handle "Enter" accelerator when there's a primary action (Closed)
Patch Set: Add tests to sheets that handle the enter accelerator 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/contact_info_editor_view_controller_browsertest.cc
diff --git a/chrome/browser/ui/views/payments/contact_info_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/contact_info_editor_view_controller_browsertest.cc
index 8fe5194271eab93bb90d26e97da0199f4efe50cd..e656af7e2bef8a0663d617df3c553edf6a552b43 100644
--- a/chrome/browser/ui/views/payments/contact_info_editor_view_controller_browsertest.cc
+++ b/chrome/browser/ui/views/payments/contact_info_editor_view_controller_browsertest.cc
@@ -72,6 +72,46 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestContactInfoEditorTest, HappyPath) {
GetLocale()));
}
+IN_PROC_BROWSER_TEST_F(PaymentRequestContactInfoEditorTest,
+ EnterAcceleratorHappyPath) {
+ InvokePaymentRequestUI();
+ OpenContactInfoEditorScreen();
+
+ SetEditorTextfieldValue(base::ASCIIToUTF16(kNameFull), autofill::NAME_FULL);
+ SetEditorTextfieldValue(base::ASCIIToUTF16(kPhoneNumber),
+ autofill::PHONE_HOME_WHOLE_NUMBER);
+ SetEditorTextfieldValue(base::ASCIIToUTF16(kEmailAddress),
+ autofill::EMAIL_ADDRESS);
+
+ autofill::PersonalDataManager* personal_data_manager = GetDataManager();
+ personal_data_manager->AddObserver(&personal_data_observer_);
+
+ // Wait until the web database has been updated and the notification sent.
+ base::RunLoop data_loop;
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
+ .WillOnce(QuitMessageLoop(&data_loop));
+ views::View* editor_sheet = dialog_view()->GetViewByID(
+ static_cast<int>(DialogViewID::CONTACT_INFO_EDITOR_SHEET));
+ editor_sheet->AcceleratorPressed(
+ ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
+ data_loop.Run();
+
+ ASSERT_EQ(1UL, personal_data_manager->GetProfiles().size());
+ autofill::AutofillProfile* profile = personal_data_manager->GetProfiles()[0];
+ DCHECK(profile);
+
+ EXPECT_EQ(base::ASCIIToUTF16(kNameFull),
+ profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL),
+ GetLocale()));
+ EXPECT_EQ(base::ASCIIToUTF16(kPhoneNumber),
+ profile->GetInfo(
+ autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER),
+ GetLocale()));
+ EXPECT_EQ(base::ASCIIToUTF16(kEmailAddress),
+ profile->GetInfo(autofill::AutofillType(autofill::EMAIL_ADDRESS),
+ GetLocale()));
+}
+
IN_PROC_BROWSER_TEST_F(PaymentRequestContactInfoEditorTest, Validation) {
InvokePaymentRequestUI();
OpenContactInfoEditorScreen();

Powered by Google App Engine
This is Rietveld 408576698