Commit 66a37682 authored by Jérémie Boulic's avatar Jérémie Boulic Committed by Chromium LUCI CQ

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

This is a reland of 9d2bdda8

Original change's description:
> [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: Luciano Pacheco <lucmult@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#833130}

Bug: 1133186
Change-Id: Idee34300befe5605219967ee7cea0ed803f4aeda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2573699Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Auto-Submit: Jeremie Boulic <jboulic@chromium.org>
Commit-Queue: Jeremie Boulic <jboulic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833622}
parent 434f33b8
...@@ -201,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataModel) { ...@@ -201,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataModel) {
} }
IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MetadataProxyTest) { 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) { IN_PROC_BROWSER_TEST_F(FileManagerJsTest, MountMetricsTest) {
......
...@@ -59,6 +59,7 @@ group("unit_test_data") { ...@@ -59,6 +59,7 @@ group("unit_test_data") {
deps = [ deps = [
"base/js:js_test_gen_html", "base/js:js_test_gen_html",
"file_manager/background/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",
"file_manager/common/js:js_test_gen_html_modules", "file_manager/common/js:js_test_gen_html_modules",
"file_manager/foreground/elements:js_test_gen_html", "file_manager/foreground/elements:js_test_gen_html",
......
...@@ -26,6 +26,7 @@ group("closure_compile") { ...@@ -26,6 +26,7 @@ group("closure_compile") {
deps = [ deps = [
":closure_compile_jsmodules", ":closure_compile_jsmodules",
":closure_compile_module", ":closure_compile_module",
":js_test_gen_html_modules_type_check_auto",
":js_test_gen_html_type_check_auto", ":js_test_gen_html_type_check_auto",
":test_support_modules_type_check", ":test_support_modules_type_check",
":test_support_type_check", ":test_support_type_check",
...@@ -76,6 +77,7 @@ js_type_check("closure_compile_jsmodules") { ...@@ -76,6 +77,7 @@ js_type_check("closure_compile_jsmodules") {
":app_windows.m", ":app_windows.m",
":background_base.m", ":background_base.m",
":entry_location_impl.m", ":entry_location_impl.m",
":metadata_proxy.m",
":test_util_base.m", ":test_util_base.m",
":volume_info_impl.m", ":volume_info_impl.m",
":volume_info_list_impl.m", ":volume_info_list_impl.m",
...@@ -392,11 +394,19 @@ js_library("metadata_proxy") { ...@@ -392,11 +394,19 @@ js_library("metadata_proxy") {
deps = [ "//ui/file_manager/file_manager/common/js:lru_cache" ] 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 = [ deps = [
":metadata_proxy", ":metadata_proxy.m",
"//ui/file_manager/base/js:test_error_reporting", "//chrome/test/data/webui:chai_assert",
"//ui/file_manager/file_manager/common/js:mock_entry", "//ui/file_manager/base/js:test_error_reporting.m",
"//ui/file_manager/file_manager/common/js:mock_entry.m",
] ]
} }
...@@ -773,6 +783,19 @@ js_library("volume_manager_util.m") { ...@@ -773,6 +783,19 @@ js_library("volume_manager_util.m") {
extra_deps = [ ":modulize" ] 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") { js_test_gen_html("js_test_gen_html") {
deps = [ deps = [
":crostini_unittest", ":crostini_unittest",
...@@ -784,7 +807,6 @@ js_test_gen_html("js_test_gen_html") { ...@@ -784,7 +807,6 @@ js_test_gen_html("js_test_gen_html") {
":import_history_unittest", ":import_history_unittest",
":media_import_handler_unittest", ":media_import_handler_unittest",
":media_scanner_unittest", ":media_scanner_unittest",
":metadata_proxy_unittest",
":mount_metrics_unittest", ":mount_metrics_unittest",
":task_queue_unittest", ":task_queue_unittest",
":trash_unittest", ":trash_unittest",
...@@ -794,6 +816,7 @@ js_test_gen_html("js_test_gen_html") { ...@@ -794,6 +816,7 @@ js_test_gen_html("js_test_gen_html") {
js_modulizer("modulize") { js_modulizer("modulize") {
input_files = [ input_files = [
"metadata_proxy.js",
"app_windows.js", "app_windows.js",
"app_window_wrapper.js", "app_window_wrapper.js",
"background_base.js", "background_base.js",
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 // Namespace
const metadataProxy = {}; const metadataProxy = {};
...@@ -76,3 +83,6 @@ metadataProxy.getEntryMetadata = entry => { ...@@ -76,3 +83,6 @@ metadataProxy.getEntryMetadata = entry => {
metadataProxy.overrideCacheTtlForTesting = ttl => { metadataProxy.overrideCacheTtlForTesting = ttl => {
metadataProxy.cache_ttl_seconds_ = ttl ? ttl : metadataProxy.MAX_TTL_SECONDS_; metadataProxy.cache_ttl_seconds_ = ttl ? ttl : metadataProxy.MAX_TTL_SECONDS_;
}; };
// eslint-disable-next-line semi,no-extra-semi
/* #export */ {metadataProxy};
...@@ -2,7 +2,14 @@ ...@@ -2,7 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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( reportPromise(
(async function() { (async function() {
const mockFileSystem = new MockFileSystem('volumeId'); const mockFileSystem = new MockFileSystem('volumeId');
...@@ -30,7 +37,7 @@ function testMetadataCaching(doneCallback) { ...@@ -30,7 +37,7 @@ function testMetadataCaching(doneCallback) {
doneCallback); doneCallback);
} }
function testMetadataCacheExpiry(doneCallback) { export function testMetadataCacheExpiry(doneCallback) {
reportPromise( reportPromise(
(async function() { (async function() {
const mockFileSystem = new MockFileSystem('volumeId'); 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