Commit 6a2fad56 authored by dpapad's avatar dpapad Committed by Chromium LUCI CQ

Convert chrome://interventions-internals tests to use JS modules.

Bug: None
Change-Id: Ib5410a1927a80967587111bb0fe89a2bb74709b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2597376
Commit-Queue: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838496}
parent 1f039b33
......@@ -13,9 +13,7 @@ import {$} from 'chrome://resources/js/util.m.js';
const ENABLE_BLOCKLIST_BUTTON = 'Enable Blocklist';
const IGNORE_BLOCKLIST_BUTTON = 'Ignore Blocklist';
const IGNORE_BLOCKLIST_MESSAGE = 'Blocklist decisions are ignored.';
const URL_THRESHOLD = 40; // Maximum URL length
// Export on |window| for tests.
window.URL_THRESHOLD = URL_THRESHOLD;
export const URL_THRESHOLD = 40; // Maximum URL length
window.logTableMap = {};
......@@ -38,7 +36,7 @@ function getPaddedValue(value, length) {
* @param {number} time Time in millisecond since Unix Epoch.
* @return The converted string format.
*/
function getTimeFormat(time) {
export function getTimeFormat(time) {
const date = new Date(time);
const options = {
year: 'numeric',
......@@ -53,8 +51,6 @@ function getTimeFormat(time) {
const millisec = getPaddedValue(date.getMilliseconds(), 3);
return dateString + ' ' + hour + ':' + min + ':' + sec + '.' + millisec;
}
// Export on |window| for tests.
window.getTimeFormat = getTimeFormat;
/**
* Append a button to |element|, so that when the button is clicked, the
......@@ -462,11 +458,9 @@ function setupLogClear() {
* @constructor
* @implements {mojom.InterventionsInternalsPageInterface}
*/
const InterventionsInternalPageImpl = function() {
export const InterventionsInternalPageImpl = function() {
this.receiver_ = new mojom.InterventionsInternalsPageReceiver(this);
};
// Export on |window| for tests.
window.InterventionsInternalPageImpl = InterventionsInternalPageImpl;
InterventionsInternalPageImpl.prototype = {
/**
......
......@@ -31,6 +31,13 @@ content::WebUIDataSource* GetSource() {
"interventions_internals.mojom-lite.js",
IDR_INTERVENTIONS_INTERNALS_MOJOM_LITE_JS);
source->SetDefaultResource(IDR_INTERVENTIONS_INTERNALS_INDEX_HTML);
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::TrustedTypes,
"trusted-types interventions-internals-test-script;");
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ScriptSrc,
"script-src chrome://resources chrome://test 'self';");
return source;
}
......
This diff is collapsed.
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