<!DOCTYPE html>
<!--
This test was procedurally generated. Please do not modify it directly.
Sources:
- fetch/metadata/tools/fetch-metadata.conf.yml
- fetch/metadata/tools/templates/element-picture.sub.html
-->
<html lang="en">
  <meta charset="utf-8">
  <title>HTTP headers on request for HTML "picture" element source</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/fetch/metadata/resources/helper.sub.js"></script>
  <body>
  <script>
  'use strict';

  function induceRequest(url, sourceEl, sourceAttr, attributes) {
    const picture = document.createElement('picture');
    const els = {
      img: document.createElement('img'),
      source: document.createElement('source')
    };
    picture.appendChild(els.source);
    picture.appendChild(els.img);
    document.body.appendChild(picture);

    for (const [ name, value ] of Object.entries(attributes)) {
      els.img.setAttribute(name, value);
    }

    return new Promise((resolve) => {
        els[sourceEl].setAttribute(sourceAttr, url);
        els.img.onload = els.img.onerror = resolve;
      });
  }

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
        });
  }, 'sec-fetch-site - img[src] - Same origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
        });
  }, 'sec-fetch-site - img[srcset] - Same origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
        });
  }, 'sec-fetch-site - source[srcset] - Same origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Cross-site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Cross-site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Cross-site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[src] - Same site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite', 'httpsOrigin']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Origin -> Cross-Site -> Same-Origin redirect, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite', 'httpsOrigin']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Origin -> Cross-Site -> Same-Origin redirect, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite', 'httpsOrigin']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Origin -> Cross-Site -> Same-Origin redirect, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsSameSite', 'httpsOrigin']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Origin -> Same-Site -> Same-Origin redirect, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsSameSite', 'httpsOrigin']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Origin -> Same-Site -> Same-Origin redirect, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsSameSite', 'httpsOrigin']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Origin -> Same-Site -> Same-Origin redirect, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsOrigin']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Cross-Site -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsOrigin']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Cross-Site -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsOrigin']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Cross-Site -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsSameSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Cross-Site -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsSameSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Cross-Site -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsSameSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Cross-Site -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsCrossSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Cross-Site -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsCrossSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Cross-Site -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite', 'httpsCrossSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Cross-Site -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsOrigin']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
        });
  }, 'sec-fetch-site - img[src] - Same-Origin -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsOrigin']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Origin -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsOrigin']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Origin -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsSameSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Origin -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsSameSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Origin -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsSameSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Origin -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Origin -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Origin -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Origin -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsOrigin']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Site -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsOrigin']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Site -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsOrigin']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Site -> Same Origin, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsSameSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Site -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsSameSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Site -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsSameSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Site -> Same-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsCrossSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[src] - Same-Site -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsCrossSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - img[srcset] - Same-Site -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite', 'httpsCrossSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-site');
          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
        });
  }, 'sec-fetch-site - source[srcset] - Same-Site -> Cross-Site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['no-cors']);
        });
  }, 'sec-fetch-mode - img[src] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['no-cors']);
        });
  }, 'sec-fetch-mode - img[srcset] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['no-cors']);
        });
  }, 'sec-fetch-mode - source[srcset] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'src',
        {"crossorigin": ""}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - img[src] - attributes: crossorigin');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'srcset',
        {"crossorigin": ""}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - img[srcset] - attributes: crossorigin');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'source',
        'srcset',
        {"crossorigin": ""}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - source[srcset] - attributes: crossorigin');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'src',
        {"crossorigin": "anonymous"}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - img[src] - attributes: crossorigin=anonymous');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'srcset',
        {"crossorigin": "anonymous"}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - img[srcset] - attributes: crossorigin=anonymous');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'source',
        'srcset',
        {"crossorigin": "anonymous"}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - source[srcset] - attributes: crossorigin=anonymous');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'src',
        {"crossorigin": "use-credentials"}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - img[src] - attributes: crossorigin=use-credentials');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'srcset',
        {"crossorigin": "use-credentials"}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - img[srcset] - attributes: crossorigin=use-credentials');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'source',
        'srcset',
        {"crossorigin": "use-credentials"}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-mode');
          assert_array_equals(headers['sec-fetch-mode'], ['cors']);
        });
  }, 'sec-fetch-mode - source[srcset] - attributes: crossorigin=use-credentials');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-dest');
          assert_array_equals(headers['sec-fetch-dest'], ['image']);
        });
  }, 'sec-fetch-dest - img[src] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-dest');
          assert_array_equals(headers['sec-fetch-dest'], ['image']);
        });
  }, 'sec-fetch-dest - img[srcset] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-dest');
          assert_array_equals(headers['sec-fetch-dest'], ['image']);
        });
  }, 'sec-fetch-dest - source[srcset] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_not_own_property(headers, 'sec-fetch-user');
        });
  }, 'sec-fetch-user - img[src] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_not_own_property(headers, 'sec-fetch-user');
        });
  }, 'sec-fetch-user - img[srcset] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, []),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_not_own_property(headers, 'sec-fetch-user');
        });
  }, 'sec-fetch-user - source[srcset] - no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-storage-access');
          assert_array_equals(headers['sec-fetch-storage-access'], ['none']);
        });
  }, 'sec-fetch-storage-access - img[src] - Cross-site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-storage-access');
          assert_array_equals(headers['sec-fetch-storage-access'], ['none']);
        });
  }, 'sec-fetch-storage-access - img[srcset] - Cross-site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsCrossSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_own_property(headers, 'sec-fetch-storage-access');
          assert_array_equals(headers['sec-fetch-storage-access'], ['none']);
        });
  }, 'sec-fetch-storage-access - source[srcset] - Cross-site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite']),
        'img',
        'src',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_not_own_property(headers, 'sec-fetch-storage-access');
        });
  }, 'sec-fetch-storage-access - img[src] - Same site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite']),
        'img',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_not_own_property(headers, 'sec-fetch-storage-access');
        });
  }, 'sec-fetch-storage-access - img[srcset] - Same site, no attributes');

  promise_test(() => {
    const key = '{{uuid()}}';

    return induceRequest(
        makeRequestURL(key, ['httpsSameSite']),
        'source',
        'srcset',
        {}
      )
      .then(() => retrieve(key))
      .then((headers) => {
          assert_not_own_property(headers, 'sec-fetch-storage-access');
        });
  }, 'sec-fetch-storage-access - source[srcset] - Same site, no attributes');
  </script>
  </body>
</html>

