testing/web-platform/tests/signed-exchange/reporting/sxg-reporting-navigation-ok.tentative.html
author Tsuyoshi Horo <horo@chromium.org>
Wed, 06 Mar 2019 12:33:36 +0000
changeset 464642 5f4503098f271c69d34c5a028f5a5eb909859e79
parent 464308 f7ad412343b934e15dd1e4802143cd910bd3b743
permissions -rw-r--r--
Bug 1527961 [wpt PR 15372] - Implement Signed Exchange reporting for distributors, a=testonly Automatic update from web-platform-tests Implement Signed Exchange reporting for distributors This CL implements Signed Exchange reporting for distributors. Spec: https://github.com/WICG/webpackage/pull/374 This CL has two success test cases only. I will add more failure test cases in another CL. Bug: 910516 Change-Id: I31a6e629073970e03a93d2379be1ae63ef6adf6b Reviewed-on: https://chromium-review.googlesource.com/c/1468855 Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Christian Dullweber <dullweber@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org> Reviewed-by: Eric Orth <ericorth@chromium.org> Cr-Commit-Position: refs/heads/master@{#634161} -- wpt-commits: 66dbfd0ae579135db73772c534879c51f6dbc674 wpt-pr: 15372

<!DOCTYPE html>
<title>SXG reporting test of ok for navigation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/network-error-logging/support/nel.sub.js"></script>
<script src="../resources/sxg-util.js"></script>
<body>
<script>
const alt_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN;
const test_origin = get_host_info().HTTPS_ORIGIN;

nel_test(async t => {
  await fetchResourceWithBasicPolicy();
  const sxg_url = alt_origin + '/signed-exchange/resources/sxg/sxg-location.sxg?navigation';
  const cert_url = test_origin + '/signed-exchange/resources/127.0.0.1.sxg.pem.cbor';
  const message = await openSXGInIframeAndWaitForMessage(t, sxg_url);
  assert_equals(message.location,
                innerURLOrigin() + '/signed-exchange/resources/inner-url.html');
  assert_false(message.is_fallback);
  assert_true(await reportsExist([
    {
      url: sxg_url,
      user_agent: navigator.userAgent,
      type: "network-error",
      body: {
        phase: "sxg",
        type: "ok",
        status_code: 200,
        referrer: location.href,
        sxg: {
          outer_url: sxg_url,
          inner_url:
              innerURLOrigin() + '/signed-exchange/resources/inner-url.html',
          cert_url: [cert_url]
        }
      },
      metadata: {
        content_type: "application/reports+json",
      },
    },
    {
      url: sxg_url,
      user_agent: navigator.userAgent,
      type: "network-error",
      body: {
        phase: "application",
        type: "ok",
        status_code: 200,
        referrer: location.href,
      },
      metadata: {
        content_type: "application/reports+json",
      },
    },
  ]));
}, 'SXG success report must be sent for navigation.');
</script>
</body>