Commit 9d2bdda8 authored by Jérémie Boulic's avatar Jérémie Boulic Committed by Chromium LUCI CQ

[Files app] Generate modules for ui/file_manager/.../metadata_proxy.js

Converted files:
- ui/file_manager/file_manager/background/js/metadata_proxy.js
- ui/file_manager/file_manager/background/js/metadata_proxy_unittest.js

Bug: 1133186
Change-Id: I81eb9d34fff12835ef5974acfee3817fec864340
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563105
Commit-Queue: Jeremie Boulic <jboulic@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833130}
parent b53ebdc3
......@@ -201,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataModel) {
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataProxyTest) {
RunTestURL("background/js/metadata_proxy_unittest_gen.html");
RunTestURL("background/js/metadata_proxy_unittest.m_gen.html");
}
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MountMetricsTest) {
......
......@@ -59,6 +59,7 @@ group("unit_test_data") {
deps = [
"base/js:js_test_gen_html",
"file_manager/background/js:js_test_gen_html",
"file_manager/background/js:js_test_gen_html_modules",
"file_manager/common/js:js_test_gen_html",
"file_manager/common/js:js_test_gen_html_modules",
"file_manager/foreground/elements:js_test_gen_html",
......
This diff is collapsed.
#!/bin/bash
#
# Copyright (c) 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Command usage:
# ui/file_manager/base/tools/modules.sh out/Release ui/file_manager/
# file_manager/foreground/js/list_thumbnail_loader.js
# ui/file_manager/base/tools/modules.sh out/Release ui/file_manager/
# file_manager/common/js/importer_common.js
# ui/file_manager/base/tools/modules.sh out/Release ui/file_manager/
# file_manager/foreground/js/list_thumbnail_loader_unittest.js
# Input: js file to convert.
build_dir=$1;
file_path=$2;
dir=`dirname $file_path`;
compiler_output="$build_dir/gen/ui/file_manager/base/tools/compiler_output.txt";
# Create containing directory of `compiler_output` if doesn't exist.
mkdir -p `dirname $compiler_output`;
# Process files with Python.
ui/file_manager/base/tools/modules.py $file_path 'generate';
# Parse closure compiler output and update files until the message 'X error(s),
# Y warning(s), Z% typed' doesn't change.
prev_output=""
new_output="."
while [[ $prev_output != $new_output ]]; do
prev_output=$new_output;
# Run closure compiler and save output.
ninja -C $build_dir $dir:closure_compile 2>&1 | tee $compiler_output;
# Parse closure compiler output.
ui/file_manager/base/tools/modules.py $file_path 'parse' $compiler_output;
# Get number of errors from modules.txt.
new_output=$(cat $compiler_output | grep 'error(s)' );
done;
# Format files.
git cl format --js;
if [[ $new_output == "" ]]; then
echo "No closure compiler error found"
else
echo "Final state: " $new_output;
fi;
......@@ -26,6 +26,7 @@ group("closure_compile") {
deps = [
":closure_compile_jsmodules",
":closure_compile_module",
":js_test_gen_html_modules_type_check_auto",
":js_test_gen_html_type_check_auto",
":test_support_modules_type_check",
":test_support_type_check",
......@@ -76,6 +77,7 @@ js_type_check("closure_compile_jsmodules") {
":app_windows.m",
":background_base.m",
":entry_location_impl.m",
":metadata_proxy.m",
":test_util_base.m",
":volume_info_impl.m",
":volume_info_list_impl.m",
......@@ -391,11 +393,19 @@ js_library("metadata_proxy") {
deps = [ "//ui/file_manager/file_manager/common/js:lru_cache" ]
}
js_unittest("metadata_proxy_unittest") {
js_library("metadata_proxy.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/background/js/metadata_proxy.m.js" ]
deps = [ "//ui/file_manager/file_manager/common/js:lru_cache.m" ]
extra_deps = [ ":modulize" ]
}
js_unittest("metadata_proxy_unittest.m") {
deps = [
":metadata_proxy",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/file_manager/common/js:mock_entry",
":metadata_proxy.m",
"//chrome/test/data/webui:chai_assert",
"//ui/file_manager/base/js:test_error_reporting.m",
"//ui/file_manager/file_manager/common/js:mock_entry.m",
]
}
......@@ -772,6 +782,19 @@ js_library("volume_manager_util.m") {
extra_deps = [ ":modulize" ]
}
js_test_gen_html("js_test_gen_html_modules") {
deps = [ ":metadata_proxy_unittest.m" ]
js_module = true
closure_flags =
strict_error_checking_closure_args + [
"js_module_root=./gen/ui",
"js_module_root=../../ui",
"browser_resolver_prefix_replacements=\"chrome://test/=./\"",
"hide_warnings_for=third_party/",
]
}
js_test_gen_html("js_test_gen_html") {
deps = [
":crostini_unittest",
......@@ -783,7 +806,6 @@ js_test_gen_html("js_test_gen_html") {
":import_history_unittest",
":media_import_handler_unittest",
":media_scanner_unittest",
":metadata_proxy_unittest",
":mount_metrics_unittest",
":task_queue_unittest",
":trash_unittest",
......@@ -793,6 +815,7 @@ js_test_gen_html("js_test_gen_html") {
js_modulizer("modulize") {
input_files = [
"metadata_proxy.js",
"app_windows.js",
"app_window_wrapper.js",
"background_base.js",
......
......@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview
* @suppress {uselessCode} Temporary suppress because of the line exporting.
*/
// #import {LRUCache} from '../../common/js/lru_cache.m.js';
// Namespace
const metadataProxy = {};
......@@ -76,3 +83,6 @@ metadataProxy.getEntryMetadata = entry => {
metadataProxy.overrideCacheTtlForTesting = ttl => {
metadataProxy.cache_ttl_seconds_ = ttl ? ttl : metadataProxy.MAX_TTL_SECONDS_;
};
// eslint-disable-next-line semi,no-extra-semi
/* #export */ {metadataProxy};
......@@ -2,7 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function testMetadataCaching(doneCallback) {
// clang-format off
import {assertEquals} from 'chrome://test/chai_assert.js';
import {reportPromise} from '../../../base/js/test_error_reporting.m.js';
import {MockFileSystem} from '../../common/js/mock_entry.m.js';
import {metadataProxy} from './metadata_proxy.m.js';
// clang-format on
export function testMetadataCaching(doneCallback) {
reportPromise(
(async function() {
const mockFileSystem = new MockFileSystem('volumeId');
......@@ -30,7 +37,7 @@ function testMetadataCaching(doneCallback) {
doneCallback);
}
function testMetadataCacheExpiry(doneCallback) {
export function testMetadataCacheExpiry(doneCallback) {
reportPromise(
(async function() {
const mockFileSystem = new MockFileSystem('volumeId');
......
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