diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 4fcf7ed7f8b1c..da61239bdda15 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -125,6 +125,19 @@ int RunTester(const blink::Settings& settings, bool run_forever) { return EXIT_FAILURE; } + // Initialize default testing locales. There is no platform to + // pass locales on the tester, so to retain expected locale behavior, + // we emulate it in here by passing in 'en_US' and 'zh_CN' as test locales. + const char* locale_json = + "{\"method\":\"setLocale\",\"args\":[\"en\",\"US\",\"\",\"\",\"zh\"," + "\"CN\",\"\",\"\"]}"; + std::vector locale_bytes(locale_json, + locale_json + std::strlen(locale_json)); + fml::RefPtr response; + shell->GetPlatformView()->DispatchPlatformMessage( + fml::MakeRefCounted("flutter/localization", + locale_bytes, response)); + std::initializer_list protection = { fml::FileMapping::Protection::kRead}; auto main_dart_file_mapping = std::make_unique(