Commit ebba8ce7 authored by rbpotter's avatar rbpotter Committed by Commit Bot

WebUI: Fix optimize_webui_test to account for preprocessing

Rollup now always reads resource files from the "preprocessed"
directory. Modify the test to account for this. Also remove the test
importing action link as there is now no manually curated list of non
generated files in rollup_plugin.js, and everything is simply read
from the preprocessed directory directly.

Change-Id: I588959f5a28f105c0006112f16be4af6dcf0819c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410443Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806729}
parent 7ad441bf
......@@ -83,19 +83,20 @@ import './element_in_dir/element_in_dir.js';
def _write_v3_files_with_resources_to_src_dir(self):
resources_path = os.path.join(
_HERE_DIR.replace('\\', '/'), 'gen', 'ui', 'webui', 'resources', 'js',
'fake_resource.m.js')
_HERE_DIR.replace('\\', '/'), 'gen', 'ui', 'webui', 'resources',
'preprocessed', 'js', 'fake_resource.js')
os.makedirs(os.path.dirname(resources_path))
self._tmp_dirs.append('gen')
with open(resources_path, 'w') as tmp_file:
tmp_file.write("alert('hello from shared resource');")
self._write_file_to_src_dir('element.js', '''
import 'chrome://resources/js/action_link.js';
import 'chrome://resources/js/fake_resource.js';
alert('yay');
''')
self._write_file_to_src_dir('element_in_dir/element_in_dir.js', '''
import {foo} from 'chrome://resources/js/fake_resource.m.js';
import {foo} from 'chrome://resources/js/fake_resource.js';
import '../strings.m.js';
alert('hello from element_in_dir');
''')
......@@ -174,10 +175,8 @@ import './element_in_dir/element_in_dir.js';
self.assertIn(os.path.normpath('element_in_dir/element_in_dir.js'),
depfile_d)
self.assertIn(
os.path.normpath('../../../../ui/webui/resources/js/action_link.js'),
depfile_d)
self.assertIn(
os.path.normpath('../gen/ui/webui/resources/js/fake_resource.m.js'),
os.path.normpath(
'../gen/ui/webui/resources/preprocessed/js/fake_resource.js'),
depfile_d)
def testV3MultiBundleOptimize(self):
......
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