Commit eeff0a91 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

JS type-check chrome/test/data/webui/test_api.js .

This is needed to allow JS tests themselves to be compiled to ease
future maintenance. js2gtest.js also needs to be compiled for that,
which will be done in a follow-up.

Hand-crafted externs are added for mock4js since it is not able to
be consumed by the compiler directly.

axs_testing.js is precompiled and also not easily consumed by the
compiler, so appropriate suppressions are added to the a11y methods
of test_api.js that deal with it.

Bug: 1000989
Change-Id: Ife6b7595674ffc79c2eadc5484d0804830a648ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787477
Commit-Queue: Trent Apted <tapted@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713357}
parent 8624ee2a
......@@ -1308,6 +1308,7 @@ if (closure_compile) {
testonly = true
data_deps = [
"chrome/browser/resources:closure_compile",
"chrome/test:closure_compile",
"components/neterror/resources:closure_compile",
"components/security_interstitials/core/common/resources:closure_compile",
"components/sync/driver/resources:closure_compile",
......
......@@ -6585,3 +6585,12 @@ if (is_win) {
]
}
}
group("closure_compile") {
testonly = true
deps = [
"data:closure_compile",
# TODO(crbug/1000989): Add a dep for base/js2gtest.js.
]
}
......@@ -4,6 +4,7 @@
import("//chrome/common/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
grit("webui_test_resources") {
......@@ -30,3 +31,23 @@ mojom("web_ui_test_bindings") {
"webui/web_ui_test.mojom",
]
}
js_type_check("closure_compile") {
deps = [
":test_api_js",
]
}
js_library("test_api_js") {
sources = [
"webui/test_api.js",
]
externs_list = [
"webui/mock4js_externs.js",
"//third_party/chaijs/externs/chai-3.5.js",
"//ui/webui/resources/js/dom_automation_controller.js",
]
deps = [
":web_ui_test_bindings_js_library_for_compile",
]
}
// Copyright 2019 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.
/**
* @fileoverview
* Limited externs used by webui testing from http://mock4js.sourceforge.net/.
* Mock4JS is not closure-annotated and unmaintained.
* TODO(crbug/844820): Eliminate/replace usage of mock4js and delete this file.
*/
function mock(klass) {}
const Mock4JS = {
verifyAllMocks: function() {},
addMockSupport: function(exports) {},
};
class Mock {
proxy() {}
expects(expectedCallCount) {}
stubs() {}
verify() {}
}
This diff is collapsed.
......@@ -16,3 +16,5 @@ Local Modifications:
- Copied license text out of README.md.
- Externs file from
https://github.com/google/closure-compiler/tree/master/contrib/externs
- Add mising assert.notStrictEqual
- Add missing export of chai.expect
......@@ -310,6 +310,13 @@ assert.equal = function(actual, expected, opt_message) {};
*/
assert.strictEqual = function(actual, expected, opt_message) {};
/**
* @param {*} actual
* @param {*} expected
* @param {string=} opt_message
*/
assert.notStrictEqual = function(actual, expected, opt_message) {};
/**
* @param {*} actual
* @param {*} expected
......@@ -535,6 +542,9 @@ chai.Assertion.prototype.assert = function(
/** @const */
chai.assert = assert;
/** @const */
chai.expect = expect;
/** @const */
chai.util = {};
......
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