chromium/third_party/blink/web_tests/external/wpt/css/css-typed-om/stylevalue-normalization/normalize-image.html

<!doctype html>
<meta charset="utf-8">
<title>CSSImageValue normalization tests</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#resourcevalue-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testhelper.js"></script>
<body>
<script>
'use strict';

const gTestUrl = '/media/1x1-green.png';
const gBadTestUrl = document.location.href;

test(t => {
  const result = CSSStyleValue.parse('background-image', 'url("' + gTestUrl + '")');
  assert_class_string(result, 'CSSImageValue');
}, 'Normalizing a valid <url> returns a CSSImageValue');

test(t => {
  const result = CSSStyleValue.parse('background-image', 'url("' + gBadTestUrl + '")');
  assert_class_string(result, 'CSSImageValue');
}, 'Normalizing a bad <url> returns a CSSImageValue');

test(t => {
  const result = CSSStyleValue.parse('background-image', 'linear-gradient(red, orange)');
  assert_equals(result.constructor.name, 'CSSImageValue');
}, 'Normalizing a <gradient> returns a CSSImageValue');

</script>