New issue
Advanced search Search tips

Issue 842460 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Country related autofill browser tests fail when run in Europe

Project Member Reported by yn...@vivaldi.com, May 12 2018

Issue description

Some years ago I disabled the call to CountryCodeForCurrentTimezone() from PersonalDataManager::GetDefaultCountryCodeForNewAddress() in components/autofill/core/browser/personal_data_manager.cc for Vivaldi's code.

The reason at the time was that the function returned highly incorrect country codes, such as Hungary instead of Norway. This also caused at least one unit test to fail.

While checking old patches in our v67 code base, I checked the result of this function again, and found that it seemed to return the correct country code, at least for my location, based on the timezone (CET), and the old failing test case was no longer present, so I decided to remove our patch.

However, when running tests, a lot of tests started failing, most of them *crashes*:

PaymentRequestShippingAddressEditorTest.NoCountryNoState
PaymentRequestShippingAddressEditorTest.NoCountryValidState_AsyncRegionLoad
PaymentRequestShippingAddressEditorTest.SyncData
PaymentRequestShippingAddressEditorTest.AddImpossiblePhoneNumber
PaymentRequestShippingAddressEditorTest.AsyncData
PaymentRequestShippingAddressEditorTest.DefaultRegion_RegionCode
PaymentRequestShippingAddressEditorTest.NoCountryInvalidState
PaymentRequestShippingAddressEditorTest.NoCountryValidState_SyncRegionLoad
PaymentRequestShippingAddressEditorTest.SyncDataInIncognito
PaymentRequestShippingAddressEditorTest.AddPossiblePhoneNumber
PaymentRequestShippingAddressEditorTest.TimingOutRegionData
PaymentRequestShippingAddressEditorTest.AddInternationalPhoneNumberFromOtherCountry
PaymentRequestShippingAddressEditorTest.DefaultRegion_RegionName
PaymentRequestShippingAddressEditorTest.FailToLoadRegionData
PaymentRequestCreditCardEditorTest.CreateNewBillingAddress

The reason for the problem seems to be that the tests require a US country location, and will fail if they are run in other countries (I have tested with NO and GB returned from the function, and our testers run mostly on Iceland, some in Norway). BTW, I have noticed a tendency in other tests to require US specific keyboards, time and date formats, and other similar country or language specific requirements.

While this might only be a problem for the browser_tests, the fact that the crashes was in a call to combobox->model()->GetItemAt() (I have not checked, but either combobox or model is likely NULL) makes me concerned that this could be causing crashers during normal form autofill usage, as well.

I would recommend running unit tests in environments for multiple languages, keyboards, and countries, as well as time zones.
 
Components: UI>Browser>Payments

Comment 2 by ma...@chromium.org, May 14 2018

Cc: anthonyvd@chromium.org
Owner: ma...@chromium.org
Status: Available (was: Untriaged)
Yikes! Do you have a stack trace for the crash? Is it debug or release? Looks like it might be a DCHECK. With the trace, I can try to query our crash database. 

I'll assign this to myself for now unless someone wants to jump on it. 

Comment 3 by yn...@vivaldi.com, May 14 2018

The actual crash I am seeing is in a testcode function, I doubt you would see production builds with that trace.

However, it is crashing while accessing a combobox after retrieving it earlier, which I would guess happens other places.

Please note the need to provide a non-US country code from the timezone case in the function I mentioned above.

The relevant part of the stack trace for the first function above in v67 is:

[2404:22928:0514/170210.545:ERROR:shipping_address_editor_view_controller.cc(393)] Unexpected country:
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
        payments::PaymentRequestBrowserTestBase::GetComboboxValue [0x00007FF68CD4C103+59] chrome\browser\ui\views\payments\payment_request_browsertest_base.cc:653)
        payments::PaymentRequestShippingAddressEditorTest_NoCountryNoState_Test::RunTestOnMainThread [0x00007FF68CDA199F+1459] chrome\browser\ui\views\payments\shipping_address_editor_view_controller_browsertest.cc:967)

Status: Assigned (was: Available)
Is there any progress regarding this issue?

I'm also seeing the same failures when running browser_tests in Europe, you can see the logs at:
http://www.rt-rk.com/mips-buildbot/builders/build_and_test_chromium_browser_tests_for_MIPS/builds/10/steps/Run%20browser_tests_34/logs/stdio

I've investigate the test PaymentRequestShippingAddressEditorTest.AddImpossiblePhoneNumber and reason for failure seems to be the length of the test phone number which should be impossible.

// Trying to set an impossible number, note it has 11 digits.
SetEditorTextfieldValue(base::UTF8ToUTF16("02 9374 40001"),
                        autofill::PHONE_HOME_WHOLE_NUMBER);

https://cs.chromium.org/chromium/src/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc?rcl=5289d5920e020286fbfa56069b274f1d30d58681&l=715

It is 11 digits, but this is stil a valid phone number in United Kingdom for example.
Quick workaround is to try running browser tests in en-US locate:

env LANGUAGE=en-US out/Default/browser_tests
I've tried using LANGUAGE and LANG variables and set them to en-US and to en_US, but in all cases I still got GB for country_code in:

https://cs.chromium.org/chromium/src/components/autofill/core/browser/phone_number_i18n.cc?type=cs&q=components/autofill/core/browser/phone_number_i18n.cc&g=0&l=107

and test still failed.

Sign in to add a comment