Skip to content

Commit

Permalink
Flutter tester default locales (#6689)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryQian committed Oct 29, 2018
1 parent 96bbd2b commit 3b17cfb
Showing 1 changed file with 13 additions and 0 deletions.
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

0 comments on commit 3b17cfb

Please sign in to comment.