Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter tester default locales. #6689

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions shell/testing/tester_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down