Commit e3803a78 authored by Allen Robinson's avatar Allen Robinson Committed by Commit Bot

Add a test for the TrustedDOMTypes origin trial integration

Change-Id: I2bfe4f20b0980dfa920586becfe9f2b9f9a97d87
Bug: 970240,934451
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1669231Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Auto-Submit: Allen Robinson <arobins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672126}
parent cdc0b4de
<!DOCTYPE html>
<meta charset="utf-8">
<title>Trusted types - exposed by origin trial</title>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/origin-trials-helper.js"></script>
<script>
// Can only run this test if TrustedDOMTypes is not enabled via a Chrome flag.
// That is only the case when running this in a virtual test suite (by default,
// runtime enabled features are on for layout tests).
// To run in virtual test suite:
// tools/run_web_tests.py virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed
if (!self.internals.runtimeFlags.trustedDOMTypesEnabled) {
test(t => {
assert_not_own_property(window, 'TrustedTypes', 'TrustedTypes is defined on the window');
}, 'trusted types in Origin-Trial disabled document.');
}
// generated with command
// tools/origin_trials/generate_token.py http://127.0.0.1:8000 TrustedDOMTypes --expire-timestamp=2000000000
const token = 'AqXgC692H4wuaTLMJ0jzBazq/pN6WCvcllT60HwwZpdNy/vrnklJOcAL7D6wcSDL+FjyR16xxhbcTtB8Mc1Q4wMAAABXeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiVHJ1c3RlZERPTVR5cGVzIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9';
OriginTrialsHelper.add_token(token);
test(t => {
assert_own_property(window, 'TrustedTypes', 'TrustedTypes is not defined on the window');
assert_own_property(window.TrustedTypes, 'createPolicy', 'createPolicy is not defined on TrustedTypes');
}, 'trusted types in Origin-Trial enabled document.');
</script>
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