Commit 9573ca90 authored by tapted's avatar tapted Committed by Commit bot

Simplify test locales in Mac's ui_unittests Framework (take 2)

Mac creates a mini-framework in `ui_unittests Framework` so that ui
tests can get a resource bundle without depending on the Chrome
framework.

The way it generated locale information was causing build flakes since
two instances of repack_locales.py could be writing to
out/../gen/repack. Tests always use en-US, so instead just repack the
strings made for ui_test.pak to en.lproj/locale.pak and roll it into the
mini-framework bundle.

Note we can't simply copy ui_test.pak because Mac system libraries will
annoy valgrind with leaks when they encounter unexpected things in it.

BUG=410468, 413034

Review URL: https://codereview.chromium.org/565063002

Cr-Commit-Position: refs/heads/master@{#294774}
parent 6026661e
......@@ -7,8 +7,6 @@
{
'product_name': 'ui_unittests Framework',
'variables': {
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/ui',
# There is no executable in the mock framework, and so nothing to strip.
'mac_strip': 0,
},
......@@ -25,7 +23,9 @@
'mac_bundle_resources': [
'test/framework-Info.plist',
'<(PRODUCT_DIR)/ui_test.pak',
'<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(locales))',
# Just include the English-US locale made by ui_resources.gyp:ui_test_pak.
'<(PRODUCT_DIR)/ui/en.lproj/locale.pak',
],
'mac_bundle_resources!': [
'test/framework-Info.plist',
......
......@@ -52,16 +52,14 @@ if (!is_mac) {
}
}
# On iOS the output needs to additionally be copied to another location, so
# we have this intermediate step.
# On iOS and Mac the string resources need to go into a locale subfolder, which
# introduces an extra dependency.
#
# GYP version: ui/resources/ui_resources.gyp:ui_test_pak
# (copy_ui_test_pak action)
if (is_ios) {
copy("ui_test_pak") {
sources = [ "$root_out_dir/ui_test.pak" ]
outputs = [ "$root_out_dir/ui/en.lproj/locale.pak" ]
deps = [ ":repack_ui_test_pak" ]
if (is_ios || is_mac) {
group("ui_test_pak") {
deps = [ ":repack_ui_test_pak", ":repack_ui_test_mac_locale_pack" ]
}
} else {
group("ui_test_pak") {
......@@ -74,7 +72,7 @@ repack("repack_ui_test_pak") {
# Depend on ui_test_pak instead of this one.
visibility = [ ":ui_test_pak" ]
sources = [
sources = [
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
......@@ -92,3 +90,22 @@ repack("repack_ui_test_pak") {
deps += [ ":copy_ui_resources_100_percent" ]
}
}
# Repack just the strings for the framework locales on Mac and iOS. This
# emulates repack_locales.py, but just for en-US. Note ui_test.pak is not simply
# copied, because it causes leaks from allocations within system libraries when
# trying to load non-string resources. http://crbug.com/413034.
repack("repack_ui_test_mac_locale_pack") {
visibility = [ ":ui_test_pak" ]
sources = [
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
]
output = "$root_out_dir/ui/en.lproj/locale.pak"
deps = [
"//ui/strings",
]
}
......@@ -74,24 +74,24 @@
},
],
}],
['OS == "ios"', {
['OS == "ios" or OS == "mac"', {
'actions': [
{
# GN version: //ui/resources:copy_ui_test_pak
'action_name': 'copy_ui_test_pak',
'message': 'Copying ui_test.pak into locale.pak',
'inputs': [
'<(PRODUCT_DIR)/ui_test.pak',
],
'outputs': [
'<(PRODUCT_DIR)/ui/en.lproj/locale.pak',
],
'action': [
'python',
'../../build/cp.py',
'<@(_inputs)',
'<@(_outputs)'
],
# GN version: //ui/resources:repack_ui_test_mac_locale_pack
# Repack just the strings for the framework locales on Mac and
# iOS. This emulates repack_locales.py, but just for en-US. Note
# ui_test.pak is not simply copied, because it causes leaks from
# allocations within system libraries when trying to load non-
# string resources. http://crbug.com/413034.
'action_name': 'repack_ui_test_mac_locale_pack',
'variables': {
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_en-US.pak',
'<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_en-US.pak',
],
'pak_output': '<(PRODUCT_DIR)/ui/en.lproj/locale.pak',
},
'includes': [ '../../build/repack_action.gypi' ],
},
],
}],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment