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

Unified Diff: chrome/browser/ui/views/payments/shipping_address_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
« no previous file with comments | « chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc
index 71612412ef9bd586ff1ca8972f42ca3d6ab85dd1..77386fec09803595fd98dfa2a1bbda99a0853788 100644
--- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc
+++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc
@@ -179,6 +179,51 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestShippingAddressEditorTest, SyncData) {
ExpectExistingRequiredFields(/*unset_types=*/nullptr);
}
+IN_PROC_BROWSER_TEST_F(PaymentRequestShippingAddressEditorTest,
+ EnterAcceleratorSyncData) {
+ InvokePaymentRequestUI();
+ SetRegionDataLoader(&test_region_data_loader_);
+
+ // No shipping profiles are available.
+ PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front();
+ EXPECT_EQ(0U, request->state()->shipping_profiles().size());
+ EXPECT_EQ(nullptr, request->state()->selected_shipping_profile());
+
+ test_region_data_loader_.set_synchronous_callback(true);
+ OpenShippingAddressEditorScreen();
+
+ std::string country_code(GetSelectedCountryCode());
+
+ SetCommonFields();
+ // We also need to set the state when no region data is provided.
+ SetFieldTestValue(autofill::ADDRESS_HOME_STATE);
+
+ ResetEventObserver(DialogEvent::BACK_TO_PAYMENT_SHEET_NAVIGATION);
+
+ // Verifying the data is in the DB.
+ 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::SHIPPING_ADDRESS_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(country_code),
+ profile->GetRawInfo(autofill::ADDRESS_HOME_COUNTRY));
+ EXPECT_EQ(base::ASCIIToUTF16(kAnyState),
+ profile->GetRawInfo(autofill::ADDRESS_HOME_STATE));
+ ExpectExistingRequiredFields(/*unset_types=*/nullptr);
+}
+
IN_PROC_BROWSER_TEST_F(PaymentRequestShippingAddressEditorTest, AsyncData) {
InvokePaymentRequestUI();
SetRegionDataLoader(&test_region_data_loader_);
« no previous file with comments | « chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698