Flutter tester default locales (flutter/engine#6689)

This commit is contained in:
Gary Qian
2018-10-29 14:06:04 -07:00
committed by GitHub
parent d69ddf9966
commit db2208a1fc

View File

@@ -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<uint8_t> locale_bytes(locale_json,
locale_json + std::strlen(locale_json));
fml::RefPtr<blink::PlatformMessageResponse> response;
shell->GetPlatformView()->DispatchPlatformMessage(
fml::MakeRefCounted<blink::PlatformMessage>("flutter/localization",
locale_bytes, response));
std::initializer_list<fml::FileMapping::Protection> protection = {
fml::FileMapping::Protection::kRead};
auto main_dart_file_mapping = std::make_unique<fml::FileMapping>(