Commit 3317f6dd authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Add SignedExchange related DevTools layout tests

We are trying to show SignedExchange related information in DevTools.
https://bit.ly/2HXVbCU

This CL adds LayoutTests and -expected.txt files to track the progress
of the implementation.

Currently there are some difference from the ideal behavior:
- The status code of the succeeded .htxg should be 200. Currenly it is
  302 which is the status code of internally generated redirect
  response.
- The status code of the invalid .htxg should be 200. Currenly it is 0
  because the actual response is not sent to DevTools. DevTools just
  recieves "loadingFailed" event.
- The request to the certificate file shold be displayed. Currenly
  DevTools doesn't recieve the certificate request which is sent from
  the browser process.
- There is no signed exchange related information in the network log.

Bug: 830505
Change-Id: I80c4c648c466505fef4f729eb046a91ede4a4660
Reviewed-on: https://chromium-review.googlesource.com/1027574
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553882}
parent e4b207b7
......@@ -4040,6 +4040,7 @@ crbug.com/818154 [ Linux Debug ] virtual/gpu-rasterization/images/gif-loop-count
crbug.com/818650 [ Linux ] fast/speech/scripted/speechrecognition-restart-onend.html [ Crash Pass ]
# These tests will pass once the --enable-features=SignedHTTPExchange flag is enabled by default.
crbug.com/803774 http/tests/devtools/htxg/ [ Skip ]
crbug.com/803774 http/tests/loading/htxg/ [ Skip ]
# Sheriff 2018-03-22
......
......@@ -629,11 +629,21 @@
"base": "http/tests/loading/htxg",
"args": ["--enable-features=SignedHTTPExchange"]
},
{
"prefix": "htxg",
"base": "http/tests/devtools/htxg",
"args": ["--enable-features=SignedHTTPExchange"]
},
{
"prefix": "htxg-with-network-service",
"base": "http/tests/loading/htxg",
"args": ["--enable-features=SignedHTTPExchange,NetworkService"]
},
{
"prefix": "htxg-with-network-service",
"base": "http/tests/devtools/htxg",
"args": ["--enable-features=SignedHTTPExchange,NetworkService"]
},
{
"prefix": "picture-in-picture",
"base": "external/wpt/picture-in-picture",
......
Tests the signed exchange information are available when the navigation succeeded.
* http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg
failed: false
statusCode: 302
* https://www.127.0.0.1/test.html
failed: false
statusCode: 200
Tests the signed exchange information are available when the navigation failed.
inspected-page.html:1 Invalid timestamp. creation_time: 1522540800, expires_time: 1523145600, verification_time: 1523318460
inspected-page.html:1 Failed to verify the signed exchange header.
* http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg
failed: true
statusCode: 0
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult('Tests the signed exchange information are available when the navigation failed.\n');
await TestRunner.loadModule('network_test_runner');
await TestRunner.loadModule('console_test_runner');
await TestRunner.showPanel('network');
await TestRunner.addScriptTag('/loading/htxg/resources/htxg-util.js');
// The timestamp of the test HTXG file is "Apr 1 2018 00:00 UTC" and valid
// until "Apr 8 2018 00:00 UTC". So in Apr 10, the page load should fail.
await TestRunner.evaluateInPageAsync(
'setSignedExchangeVerificationTime(new Date("Apr 10 2018 00:01 UTC"))');
BrowserSDK.networkLog.reset();
await TestRunner.addIframe('/loading/htxg/resources/htxg-location.htxg');
ConsoleTestRunner.dumpConsoleMessages();
for (var request of BrowserSDK.networkLog.requests()) {
TestRunner.addResult(`* ${request.url()}`);
TestRunner.addResult(` failed: ${!!request.failed}`);
TestRunner.addResult(` statusCode: ${request.statusCode}`);
// TODO(crbug/830505): Check the existance of signed exchange information.
}
TestRunner.completeTest();
})();
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult('Tests the signed exchange information are available when the navigation succeeded.\n');
await TestRunner.loadModule('network_test_runner');
await TestRunner.loadModule('console_test_runner');
await TestRunner.showPanel('network');
await TestRunner.addScriptTag('/loading/htxg/resources/htxg-util.js');
// The timestamp of the test HTXG file is "Apr 1 2018 00:00 UTC" and valid
// until "Apr 8 2018 00:00 UTC".
await TestRunner.evaluateInPageAsync(
'setSignedExchangeVerificationTime(new Date("Apr 1 2018 00:01 UTC"))');
BrowserSDK.networkLog.reset();
await TestRunner.addIframe('/loading/htxg/resources/htxg-location.htxg');
ConsoleTestRunner.dumpConsoleMessages();
for (var request of BrowserSDK.networkLog.requests()) {
TestRunner.addResult(`* ${request.url()}`);
TestRunner.addResult(` failed: ${!!request.failed}`);
TestRunner.addResult(` statusCode: ${request.statusCode}`);
// TODO(crbug/830505): Check the existance of signed exchange information.
}
TestRunner.completeTest();
})();
Tests the signed exchange information are available when the prefetch succeeded.
* http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg
failed: false
statusCode: 302
* https://www.127.0.0.1/test.html
failed: false
statusCode: 200
Tests the signed exchange information are available when the prefetch failed.
* http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg
failed: true
statusCode: 0
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult('Tests the signed exchange information are available when the prefetch failed.\n');
await TestRunner.loadModule('network_test_runner');
await TestRunner.loadModule('console_test_runner');
await TestRunner.showPanel('network');
await TestRunner.addScriptTag('/loading/htxg/resources/htxg-util.js');
// The timestamp of the test HTXG file is "Apr 1 2018 00:00 UTC" and valid
// until "Apr 8 2018 00:00 UTC". So in Apr 10, the prefetch should fail.
await TestRunner.evaluateInPageAsync(
'setSignedExchangeVerificationTime(new Date("Apr 10 2018 00:01 UTC"))');
BrowserSDK.networkLog.reset();
const promise = new Promise(resolve => {
TestRunner.addSniffer(SDK.NetworkDispatcher.prototype, 'loadingFailed', loadingFailed, true);
function loadingFailed(requestId, time, localizedDescription, canceled) {
var request = BrowserSDK.networkLog.requestByManagerAndId(TestRunner.networkManager, requestId);
if (/htxg-location\.htxg/.exec(request.url()))
resolve();
}
});
TestRunner.evaluateInPage(`
(function () {
const link = document.createElement('link');
link.rel = 'prefetch';
link.href = '/loading/htxg/resources/htxg-location.htxg';
document.body.appendChild(link);
})()
`);
await promise;
for (var request of BrowserSDK.networkLog.requests()) {
TestRunner.addResult(`* ${request.url()}`);
TestRunner.addResult(` failed: ${!!request.failed}`);
TestRunner.addResult(` statusCode: ${request.statusCode}`);
// TODO(crbug/830505): Check the existance of signed exchange information.
}
TestRunner.completeTest();
})();
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult('Tests the signed exchange information are available when the prefetch succeeded.\n');
await TestRunner.loadModule('network_test_runner');
await TestRunner.loadModule('console_test_runner');
await TestRunner.showPanel('network');
await TestRunner.addScriptTag('/loading/htxg/resources/htxg-util.js');
// The timestamp of the test HTXG file is "Apr 1 2018 00:00 UTC" and valid
// until "Apr 8 2018 00:00 UTC".
await TestRunner.evaluateInPageAsync(
'setSignedExchangeVerificationTime(new Date("Apr 1 2018 00:01 UTC"))');
BrowserSDK.networkLog.reset();
const promise = new Promise(resolve => {
TestRunner.addSniffer(SDK.NetworkDispatcher.prototype, 'loadingFinished', loadingFinished, true);
function loadingFinished(requestId, finishTime, encodedDataLength) {
var request = BrowserSDK.networkLog.requestByManagerAndId(TestRunner.networkManager, requestId);
if (/test\.html/.exec(request.url()))
resolve();
}
});
TestRunner.evaluateInPage(`
(function () {
const link = document.createElement('link');
link.rel = 'prefetch';
link.href = '/loading/htxg/resources/htxg-location.htxg';
document.body.appendChild(link);
})()
`);
await promise;
for (var request of BrowserSDK.networkLog.requests()) {
TestRunner.addResult(`* ${request.url()}`);
TestRunner.addResult(` failed: ${!!request.failed}`);
TestRunner.addResult(` statusCode: ${request.statusCode}`);
// TODO(crbug/830505): Check the existance of signed exchange information.
}
TestRunner.completeTest();
})();
This directory is for testing the SignedHTTPExchange feature.
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