Commit a834c680 authored by Will Chen's avatar Will Chen Committed by Commit Bot

DevTools: test migration cleanup - remove LayoutTests/http/tests/inspector

Now that all the tests have been migrated to the new integration test
framework, we can remove the remaining bits of the legacy framework.

There were a few references to inspector files in a handful of network
tests, which have been updated to their respective devtools' resources files.

Also found a (disabled) virtual test that slipped through the cracks:
virtual/threaded/http/tests/devtools/tracing/idle-callback.js

Bug: 667560
Change-Id: I2fddfee0af766c7f672bd118ff3fc75d23418d89
Reviewed-on: https://chromium-review.googlesource.com/828268Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Will Chen <chenwilliam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524533}
parent 154380ac
......@@ -1947,7 +1947,7 @@ crbug.com/626703 external/wpt/css/css-writing-modes/wm-propagation-body-008.xht
crbug.com/655458 crbug.com/721814 external/wpt/mediacapture-image/idlharness.html [ Skip ]
crbug.com/626703 external/wpt/web-nfc/idlharness.https.html [ Skip ]
crbug.com/723741 virtual/threaded/http/tests/devtools/tracing/idle-callback.html [ Failure Pass Timeout ]
crbug.com/723741 virtual/threaded/http/tests/devtools/tracing/idle-callback.js [ Failure Pass Timeout ]
crbug.com/723826 http/tests/security/w3c/cross-origin-objects.html [ Failure Pass ]
......
......@@ -2,19 +2,19 @@ Test loading resource for frontend.
Running: testNetworkResourceNonCached
Loading resource from http://localhost:8080/inspector/network/resources/resource.php
Loading resource from http://localhost:8080/devtools/network/resources/resource.php
Success: 200
Logged headers: cache-control, expires, pragma
Content: "Hello world"
Running: testNetworkResourceCached
Loading resource from http://localhost:8080/inspector/network/resources/resource.php?cached=1
Loading resource from http://localhost:8080/devtools/network/resources/resource.php?cached=1
Success: 200
Logged headers: cache-control, expires, last-modified
Content: "Hello world"
Running: testNetworkResourceIfModifiedSince
Loading resource from http://localhost:8080/inspector/network/resources/resource.php?cached=1
Loading resource from http://localhost:8080/devtools/network/resources/resource.php?cached=1
Success: 304
Logged headers:
Content: ""
......@@ -26,7 +26,7 @@ Logged headers:
Content: ""
Running: testResourceWithCookie
Loading resource from http://127.0.0.1:8000/inspector/network/resources/print-cookie.php
Loading resource from http://127.0.0.1:8000/devtools/network/resources/print-cookie.php
Success: 200
Logged headers: cache-control, expires, pragma
Content: "Cookie value: TestCookieValue."
......
......@@ -32,16 +32,16 @@
TestRunner.runTestSuite([
function testNetworkResourceNonCached(next) {
testLoadForURL('http://localhost:8080/inspector/network/resources/resource.php', undefined, next);
testLoadForURL('http://localhost:8080/devtools/network/resources/resource.php', undefined, next);
},
function testNetworkResourceCached(next) {
testLoadForURL('http://localhost:8080/inspector/network/resources/resource.php?cached=1', undefined, next);
testLoadForURL('http://localhost:8080/devtools/network/resources/resource.php?cached=1', undefined, next);
},
function testNetworkResourceIfModifiedSince(next) {
testLoadForURL(
'http://localhost:8080/inspector/network/resources/resource.php?cached=1',
'http://localhost:8080/devtools/network/resources/resource.php?cached=1',
{'if-modified-since': new Date().toUTCString()}, next);
},
......@@ -51,10 +51,10 @@
function testResourceWithCookie(next) {
NetworkTestRunner.makeSimpleXHR(
'GET', 'http://127.0.0.1:8000/inspector/network/resources/set-cookie.php', false, callback);
'GET', 'http://127.0.0.1:8000/devtools/network/resources/set-cookie.php', false, callback);
function callback() {
testLoadForURL('http://127.0.0.1:8000/inspector/network/resources/print-cookie.php', undefined, next);
testLoadForURL('http://127.0.0.1:8000/devtools/network/resources/print-cookie.php', undefined, next);
}
}
]);
......
Tests that preflight OPTIONS is always sent if 'Disable cache' is checked, and that network instrumentation does not produce errors for redirected preflights.
OPTIONS: http://localhost:8080/inspector/network/resources/cors-redirect.cgi
OPTIONS: http://localhost:8080/inspector/network/resources/cors-redirect.cgi
OPTIONS: http://localhost:8000/inspector/network/resources/cors.cgi
POST: http://localhost:8000/inspector/network/resources/cors.cgi
OPTIONS: http://localhost:8000/inspector/network/resources/cors.cgi
POST: http://localhost:8000/inspector/network/resources/cors.cgi
OPTIONS: http://localhost:8080/devtools/network/resources/cors-redirect.cgi
OPTIONS: http://localhost:8080/devtools/network/resources/cors-redirect.cgi
OPTIONS: http://localhost:8000/devtools/network/resources/cors.cgi
POST: http://localhost:8000/devtools/network/resources/cors.cgi
OPTIONS: http://localhost:8000/devtools/network/resources/cors.cgi
POST: http://localhost:8000/devtools/network/resources/cors.cgi
......@@ -17,7 +17,7 @@
if (xhr.readyState === XMLHttpRequest.DONE)
callback();
};
xhr.open("POST", "http://localhost:8000/inspector/network/resources/cors.cgi");
xhr.open("POST", "http://localhost:8000/devtools/network/resources/cors.cgi");
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.send("<xml></xml>");
}
......@@ -40,9 +40,9 @@
`);
NetworkTestRunner.makeFetch(
'http://localhost:8080/inspector/network/resources/cors-redirect.cgi', {headers: {'x-test': 'redirect'}},
'http://localhost:8080/devtools/network/resources/cors-redirect.cgi', {headers: {'x-test': 'redirect'}},
function() {});
NetworkTestRunner.makeFetch('http://localhost:8080/inspector/network/resources/cors-redirect.cgi', {}, disableCache);
NetworkTestRunner.makeFetch('http://localhost:8080/devtools/network/resources/cors-redirect.cgi', {}, disableCache);
async function disableCache() {
await TestRunner.NetworkAgent.setCacheDisabled(true);
......
Test network status of non http request.
network-test.js:200 OKFinished
network-status-non-http.js:200 OKFinished
non-existent-file.js:404 Not Found(failed)
data:application/ja…:200 OKFinished
......@@ -16,7 +16,7 @@
function loadResources()
{
addScriptElement("../../inspector/network-test.js");
addScriptElement("network-status-non-http.js");
addScriptElement("non-existent-file.js");
// Test that data-url doesn't appear in network panel.
......@@ -25,7 +25,7 @@
`);
await TestRunner.NetworkAgent.setCacheDisabled(true);
var requestsToWatch = /\/network-test\.js$|\/non-existent-file.js$|^data:application\/javascript,|/;
var requestsToWatch = /\/network-status-non-http\.js$|\/non-existent-file.js$|^data:application\/javascript,|/;
var seenRequests = 0;
function dumpRequests() {
......
Checks that we show warning message for long cookie.
VM:58 Set-Cookie header is ignored in response from url: http://127.0.0.1:8000/inspector/network/resources/set-cookie.php?length=4097. Cookie length should be less than or equal to 4096 characters.
VM:58 Set-Cookie header is ignored in response from url: http://127.0.0.1:8000/devtools/network/resources/set-cookie.php?length=4097. Cookie length should be less than or equal to 4096 characters.
makeFetch @ VM:58
(anonymous) @ VM:1
......@@ -9,11 +9,11 @@
await TestRunner.showPanel('network');
NetworkTestRunner.makeFetch(
'http://127.0.0.1:8000/inspector/network/resources/set-cookie.php?length=4096', {}, step1);
'http://127.0.0.1:8000/devtools/network/resources/set-cookie.php?length=4096', {}, step1);
function step1() {
NetworkTestRunner.makeFetch(
'http://127.0.0.1:8000/inspector/network/resources/set-cookie.php?length=4097', {}, dumpMessages);
'http://127.0.0.1:8000/devtools/network/resources/set-cookie.php?length=4097', {}, dumpMessages);
}
function dumpMessages() {
......
var initialize_ApplicationCacheTest = function() {
InspectorTest.preloadModule("application_test_runner");
};
var initialize_BindingsTest = function() {
InspectorTest.preloadModule("bindings_test_runner");
InspectorTest.preloadModule("sources");
}
// Copyright 2015 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.
var initialize_CacheStorageTest = function() {
InspectorTest.preloadModule("application_test_runner");
InspectorTest.preloadPanel("resources");
}
var initialize_ConsoleTest = function() {
InspectorTest.preloadModule("console_test_runner");
InspectorTest.preloadModule("source_frame");
InspectorTest.preloadPanel("console");
}
var initialize_DebuggerTest = function() {
InspectorTest.preloadModule('sources_test_runner');
InspectorTest.preloadPanel("sources");
};
var initialize_ElementTest = function() {
InspectorTest.preloadModule('elements_test_runner');
InspectorTest.preloadPanel("elements");
};
function extension_getRequestByUrl(urls, callback)
{
function onHAR(response)
{
var entries = response.entries;
for (var i = 0; i < entries.length; ++i) {
for (var url = 0; url < urls.length; ++url) {
if (urls[url].test(entries[i].request.url)) {
callback(entries[i]);
return;
}
}
}
output("no item found");
callback(null);
}
webInspector.network.getHAR(onHAR);
}
var initialize_ExtensionsTest = function()
{
InspectorTest.preloadModule('extensions_test_runner');
}
// TODO(chenwilliam): these should be in ExtensionsTestRunner.js initAsync(...)
// however these are here because they need to be executed when the inspected page reloads
function extensionFunctions()
{
var functions = "";
for (symbol in window) {
if (/^extension_/.exec(symbol) && typeof window[symbol] === "function")
functions += window[symbol].toString();
}
return functions;
}
var extensionsOrigin = "http://devtools-extensions.oopif.test:8000";
function extension_showPanel(panelId, callback)
{
evaluateOnFrontend("InspectorTest.showPanel(unescape('" + escape(panelId) + "')).then(function() { reply(); });", callback);
}
var test = function()
{
Common.moduleSetting("shortcutPanelSwitch").set(true);
ExtensionsTestRunner.runExtensionTests();
}
var initialize_IndexedDBTest = function() {
InspectorTest.preloadModule("application_test_runner");
InspectorTest.preloadPanel("resources");
}
var initialize_IsolatedFileSystemTest = function() {
InspectorTest.preloadModule('bindings_test_runner');
};
function initialize_LayerTreeTests() {
InspectorTest.preloadModule('layers_test_runner');
}
var initialize_LiveEditTest = function() {
InspectorTest.preloadModule('sources_test_runner');
};
var initialize_NetworkTest = function() {
InspectorTest.preloadModule("network_test_runner");
InspectorTest.preloadPanel("network");
};
#!/usr/bin/perl -wT
use strict;
use CGI;
my $q = CGI->new;
my %headers = map { $_ => $q->http($_) } $q->http();
print "Status: 307 Internal Redirect\n";
print "Location: cors.cgi\n";
print "Access-Control-Allow-Headers:X-PINGARUNER, CONTENT-TYPE, X-TEST\n";
print "Access-Control-Allow-Methods:POST, GET, OPTIONS\n";
print "Access-Control-Allow-Origin:http://127.0.0.1:8000\n";
print "Access-Control-Max-Age:1728000\n";
print "\n";
print "OK";
#!/usr/bin/perl -wT
use strict;
print "Status: 200 OK\n";
print "Access-Control-Allow-Headers:X-PINGARUNER, CONTENT-TYPE\n";
print "Access-Control-Allow-Methods:POST, GET, OPTIONS\n";
print "Access-Control-Allow-Origin:http://127.0.0.1:8000\n";
print "Access-Control-Max-Age:1728000\n";
print "\n";
print "OK";
<?php
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/plain");
setcookie("TestCookie", "TestCookieValue");
echo("Cookie value: " . $_COOKIE["TestCookie"] . ".");
?>
<?php
$type = $_GET["type"];
$wait = $_GET["wait"];
$send = $_GET["send"];
$size = $_GET["size"];
$gzip = $_GET["gzip"];
$jsdelay = $_GET["jsdelay"];
$jscontent = $_GET["jscontent"];
$chunked = $_GET["chunked"];
$random = $_GET["random"];
$cached = $_GET["cached"];
# Wait before sending response
if ($wait)
usleep($wait * 1000);
# Exit early if we return 304 code.
if ($cached && $_SERVER["HTTP_IF_MODIFIED_SINCE"]) {
header("HTTP/1.0 304 Not Modified");
exit;
}
# Enable gzip compression if needed
if ($gzip)
ob_start("ob_gzhandler");
# Send headers
if ($cached) {
$max_age = 12 * 31 * 24 * 60 * 60; //one year
$expires = gmdate(DATE_RFC1123, time() + $max_age);
$last_modified = gmdate(DATE_RFC1123, time() - $max_age);
header("Cache-Control: public, max-age=" . 5*$max_age);
header("Cache-control: max-age=0");
header("Expires: " . $expires);
header("Last-Modified: " . $last_modified);
} else {
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
}
if ($type == "js")
header("Content-Type:text/javascript; charset=UTF-8");
else if ($type == "image")
header("Content-Type: image/png");
else
header("Content-Type: text/plain");
# Flush headers and sleep bofore sending response
if ($send) {
flush();
usleep($send * 1000);
}
if ($type == "js") {
# Send JavaScript file
$bytes_emitted = 0;
if ($jsdelay) {
# JavaScript file should block on load
?>
function __foo(seconds) {
var now = Date.now();
var counter = Number(0);
while(now + seconds > Date.now()) { counter = Number(counter + 1); }
}
__foo(<?php echo($jsdelay)?>);
<?php
$bytes_emitted += 175;
}
if (!$jscontent)
$jscontent = "function foo() {}";
# JavaScript file should issue given command.
echo($jscontent);
$bytes_emitted += strlen($jscontent);
if ($size) {
for ($i = 0; $i < $size - $bytes_emitted; ++$i)
echo("/");
}
} else if ($type == "image") {
$base64data = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kICQsw" .
"ARCJCogAAABFSURBVEjH7ZLBCQAwCAONdP+V0xVqq0gx9w+Gi2ZCTAcXGWbe8G4Dq9DekS" .
"kPaGeFgfYJVODlCTnWADILoEg3vplACLEBN9UGG9+mxboAAAAASUVORK5CYII=";
$data = base64_decode($base64data);
$data_len = strlen($data);
print($data);
if ($size) {
if ($chunked) {
ob_flush();
flush();
}
for ($i = 0; $size && $i < $size - $data_len; ++$i)
echo("=");
} else if ($random)
echo(rand());
} else {
# Generate dummy text/html.
if ($size) {
for ($i = 0; $i < $size; ++$i) {
if ($chunked && (1 == $i)) {
ob_flush();
flush();
}
echo("*");
}
} else {
echo("Hello ");
if ($chunked) {
ob_flush();
flush();
}
echo("world");
if ($random)
echo(": " . rand());
}
}
?>
<?php
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/plain");
header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
$length = isset($_GET["length"]) ? (int) $_GET["length"] : 0;
if (!$length) {
setcookie("TestCookie", "TestCookieValue");
} else {
$data = "";
for ($i = 0; $i < $length; $i++) {
$data .= "a";
}
header("Set-Cookie: $data");
}
echo("Cookie set.");
?>
var initialize_EmptyPageMock = function() {
InspectorTest.preloadModule("sdk_test_runner");
};
\ No newline at end of file
var initialize_AutomappingTest = function() {
InspectorTest.preloadModule('bindings_test_runner');
}
var initialize_PersistenceTest = function() {
InspectorTest.preloadModule('bindings_test_runner');
InspectorTest.preloadModule("sources");
}
var initialize_ProductRegistry = function() {
InspectorTest.preloadModule("network_test_runner");
};
var initialize_ResourceTreeTest = function() {
InspectorTest.preloadModule('application_test_runner');
};
var initialize_ResourceTest = function() {
InspectorTest.preloadModule("application_test_runner");
InspectorTest.preloadPanel("sources");
InspectorTest.preloadPanel("resources");
}
var initialize_SearchTest = function() {
InspectorTest.preloadModule('sources_test_runner');
};
var initialize_SecurityTest = function() {
InspectorTest.preloadModule("security_test_runner");
InspectorTest.preloadPanel("security");
}
var initialize_ServiceWorkersTest = function() {
InspectorTest.preloadModule('application_test_runner');
}
var initialize_SourcesTest = function() {
InspectorTest.preloadModule('sources_test_runner');
InspectorTest.preloadPanel("sources");
};
var initialize_Timeline = function() {
InspectorTest.preloadModule("performance_test_runner");
InspectorTest.preloadPanel("timeline");
};
<html>
<head>
<script src="../../../../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../../../../http/tests/inspector/timeline-test.js"></script>
<script>
function performActions(idleWarningAddOn)
{
var callback;
var promise = new Promise((fulfill) => callback = fulfill);
var requestId = window.requestIdleCallback(idleCallback);
window.cancelIdleCallback(requestId);
window.requestIdleCallback(idleCallback);
function idleCallback()
{
window.requestIdleCallback(slowIdleCallback);
}
function slowIdleCallback(deadline)
{
while (deadline.timeRemaining()) {};
var addOnDeadline = performance.now() + idleWarningAddOn;
while (performance.now() < addOnDeadline) {};
if (callback)
callback();
}
return promise;
}
function test()
{
InspectorTest.invokeAsyncWithTimeline(`(() => performActions(${TimelineModel.TimelineModel.Thresholds.IdleCallbackAddon}))`, finish);
function finish()
{
InspectorTest.printTimelineRecordsWithDetails("RequestIdleCallback");
InspectorTest.printTimelineRecordsWithDetails("CancelIdleCallback");
InspectorTest.printTimelineRecordsWithDetails("FireIdleCallback");
InspectorTest.completeTest();
}
}
if (!window.testRunner)
setTimeout(performActions, 2000);
</script>
</head>
<body onload="runTest()">
<p>
Tests Timeline events emitted when idle callback is scheduled and fired.
</p>
</body>
</html>
// Copyright 2017 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 Timeline events emitted when idle callback is scheduled and fired.\n`);
await TestRunner.loadModule('performance_test_runner');
await TestRunner.evaluateInPagePromise(`
function performActions(idleWarningAddOn)
{
var callback;
var promise = new Promise((fulfill) => callback = fulfill);
var requestId = window.requestIdleCallback(idleCallback);
window.cancelIdleCallback(requestId);
window.requestIdleCallback(idleCallback);
function idleCallback()
{
window.requestIdleCallback(slowIdleCallback);
}
function slowIdleCallback(deadline)
{
while (deadline.timeRemaining()) {};
var addOnDeadline = performance.now() + idleWarningAddOn;
while (performance.now() < addOnDeadline) {};
if (callback)
callback();
}
return promise;
}
`);
PerformanceTestRunner.invokeAsyncWithTimeline(
`(() => performActions(${TimelineModel.TimelineModel.Thresholds.IdleCallbackAddon}))`, finish);
function finish() {
PerformanceTestRunner.printTimelineRecordsWithDetails('RequestIdleCallback');
PerformanceTestRunner.printTimelineRecordsWithDetails('CancelIdleCallback');
PerformanceTestRunner.printTimelineRecordsWithDetails('FireIdleCallback');
TestRunner.completeTest();
}
})();
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