Skip to content

Commit

Permalink
DevTools: automatically migrate http/tests/devtools/profiler tests
Browse files Browse the repository at this point in the history
This converts a batch of tests from the old test framework (html file)
into the new test framework (js file).

Most of it was done through an automated transformation script, with
a small amount of manual clean-up.

Bug: 667560
Change-Id: Ied5c71d936f4043fabd757b67c708633ddf182df
Reviewed-on: https://chromium-review.googlesource.com/734124
Commit-Queue: Will Chen <chenwilliam@chromium.org>
Reviewed-by: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511302}
  • Loading branch information
wwwillchen authored and Commit Bot committed Oct 24, 2017
1 parent 91965df commit 39fe771
Show file tree
Hide file tree
Showing 50 changed files with 524 additions and 743 deletions.
8 changes: 4 additions & 4 deletions third_party/WebKit/LayoutTests/ASANExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ crbug.com/438499 [ Linux ] fast/workers/simultaneous-errors.html [ Timeout ]
crbug.com/438499 [ Linux ] fast/workers/worker-multi-startup.html [ Timeout ]
crbug.com/438499 [ Linux ] http/tests/websocket/workers/worker-simple.html [ Timeout ]
crbug.com/438499 [ Linux ] http/tests/workers/text-encoding.html [ Timeout ]
crbug.com/438499 [ Linux ] http/tests/devtools/profiler/heap-snapshot-loader.html [ Timeout ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-loader.html [ Timeout ]
crbug.com/438499 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-show-all.html [ Timeout ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-show-all.html [ Timeout ]
crbug.com/438499 [ Linux ] http/tests/devtools/profiler/heap-snapshot-loader.js [ Timeout ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-loader.js [ Timeout ]
crbug.com/438499 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-show-all.js [ Timeout ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-show-all.js [ Timeout ]
crbug.com/438499 [ Linux ] virtual/threaded/animations/unanimated-style.html [ Timeout ]

# Flakily timeout on Linux ASAN bots.
Expand Down
8 changes: 4 additions & 4 deletions third_party/WebKit/LayoutTests/SlowTests
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ crbug.com/357427 http/tests/workers/terminate-during-sync-operation-filesystem.h
crbug.com/357427 virtual/mojo-loading/http/tests/workers/terminate-during-sync-operation-filesystem.html [ Slow ]
crbug.com/402379 [ Debug ] storage/indexeddb/cursor-continue-validity.html [ Slow ]
crbug.com/402379 [ Debug ] storage/indexeddb/mozilla/indexes.html [ Slow ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.html [ Slow ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.html [ Slow ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-sorting.html [ Slow ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-sorting.html [ Slow ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.js [ Slow ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.js [ Slow ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-sorting.js [ Slow ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-sorting.js [ Slow ]
crbug.com/440452 virtual/display_list_2d_canvas/fast/canvas/canvas-partial-invalidation-zoomed.html [ Slow ]
crbug.com/480769 http/tests/devtools/service-workers/service-workers-redundant.html [ Slow ]
crbug.com/480769 virtual/mojo-loading/http/tests/devtools/service-workers/service-workers-redundant.html [ Slow ]
Expand Down
12 changes: 6 additions & 6 deletions third_party/WebKit/LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -1151,10 +1151,10 @@ crbug.com/528062 [ Win ] virtual/mojo-loading/http/tests/security/xssAuditor/chu
# Part of a larger issue referenced in the bug. This specific issue will be fixed shortly.
crbug.com/408159 accessibility/is-ignored-change-sends-notification.html [ Timeout ]

crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.html [ Pass ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.html [ Pass ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-sorting.html [ Pass ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-sorting.html [ Pass ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.js [ Pass ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-expansion-preserved-when-sorting.js [ Pass ]
crbug.com/504706 [ Linux ] http/tests/devtools/profiler/heap-snapshot-containment-sorting.js [ Pass ]
crbug.com/667560 [ Linux ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-containment-sorting.js [ Pass ]

# When drawing subpixel smoothed glyphs, CoreGraphics will fake bold the glyphs.
# In this configuration, the pixel smoothed glyphs will be created from subpixel smoothed glyphs.
Expand Down Expand Up @@ -3539,8 +3539,8 @@ crbug.com/669329 virtual/threaded/http/tests/devtools/tracing/timeline-js/timeli
crbug.com/667560 virtual/mojo-loading/http/tests/devtools/tracing/timeline-js/timeline-runtime-stats.html [ Pass Failure Crash ]

# Tests timing out on WebKit Linux Trusty MSAN
crbug.com/760543 [ Linux Release ] http/tests/devtools/profiler/heap-snapshot-inspect-dom-wrapper.html [ Pass Timeout ]
crbug.com/760543 [ Linux Release ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-inspect-dom-wrapper.html [ Pass Timeout ]
crbug.com/760543 [ Linux Release ] http/tests/devtools/profiler/heap-snapshot-inspect-dom-wrapper.js [ Pass Timeout ]
crbug.com/760543 [ Linux Release ] virtual/mojo-loading/http/tests/devtools/profiler/heap-snapshot-inspect-dom-wrapper.js [ Pass Timeout ]
crbug.com/760543 [ Linux Release ] http/tests/devtools/tracing/console-timeline.html [ Pass Timeout ]
crbug.com/760543 [ Linux Release ] virtual/mojo-loading/http/tests/devtools/tracing/console-timeline.html [ Pass Timeout ]
crbug.com/760543 [ Linux Release ] http/tests/devtools/tracing/timeline-layout/timeline-layout-with-invalidations.html [ Pass Timeout ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script>
// 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(`Test that if a profiler is working all the agents are disabled.\n`);

async function test() {
var messages = [];
function collectMessages(message) {
messages.push(message);
Expand All @@ -26,15 +27,4 @@
TestRunner.addResult(message);
}
TestRunner.completeTest();
}

</script>
</head>

<body onload="runTest()">
<p>
Test that if a profiler is working all the agents are disabled.
</p>

</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script>
// 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(`Test that ProfilerAgent start/stop doesn't crash.\n`);

function test() {
TestRunner.ProfilerAgent.start().then(onStart);

function onStart() {
Expand All @@ -15,15 +16,4 @@
TestRunner.addResult('ProfilerAgent stopped.');
TestRunner.completeTest();
}
}

</script>
</head>

<body onload="runTest()">
<p>
Test that ProfilerAgent start/stop doesn't crash.
</p>

</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../resources/profiler-test.js"></script>
<script>
// 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 that search works for large bottom-up view of CPU profile.\n`);
await TestRunner.loadModule('profiler_test_runner');

function test() {
var nodesCount = 1000;
function buildTree(startId, count) {
// Build a call tree of a chain form: foo1 -> foo2 -> foo3 -> ...
Expand Down Expand Up @@ -61,13 +62,4 @@
TestRunner.addResult(`${node.callUID}: ${node.functionName} ${node.self} ${node.total}`);
}
ProfilerTestRunner.completeProfilerTest();
}

</script>
</head>
<body onload="runTest()">
<p>
Tests that search works for large bottom-up view of CPU profile.
</p>
</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../resources/profiler-test.js"></script>
<script>
// 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 bottom-up view self and total time calculation in CPU profiler.\n`);
await TestRunner.loadModule('profiler_test_runner');

function test() {
var profileAndExpectations = {
'title': 'profile1',
'target': function() {
Expand Down Expand Up @@ -80,13 +81,4 @@
node = node.traverseNextNode(true, null, true);
}
ProfilerTestRunner.completeProfilerTest();
}

</script>
</head>
<body onload="runTest()">
<p>
Tests bottom-up view self and total time calculation in CPU profiler.
</p>
</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../resources/profiler-test.js"></script>
<script>
// 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 self and total time calculation in CPU profiler.\n`);
await TestRunner.loadModule('profiler_test_runner');

function test() {
// Profile for 1070ms, 2140 samples.
var profileAndExpectations = {
'head': {
Expand Down Expand Up @@ -115,13 +116,4 @@
else
TestRunner.addResult('FAIL: incorrect node times\n' + JSON.stringify(profileAndExpectations, null, 4));
TestRunner.completeTest();
}

</script>
</head>
<body onload="runTest()">
<p>
Tests self and total time calculation in CPU profiler.
</p>
</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Tests Overview pane calculation in FlameChart for different width = 2^n with n in range 4 - 0.
Also tests loading of a legacy nodes format, where nodes were represented as a tree.
Also tests loading of a legacy nodes format, where nodes were represented as a tree.

log: 14,14,1,1,1,1,1,1,1,1,1,1,1,11,15,1
log: 14,1,1,1,1,1,11,15
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../resources/profiler-test.js"></script>
<script>
// 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 Overview pane calculation in FlameChart for different width = 2^n with n in range 4 - 0.
Also tests loading of a legacy nodes format, where nodes were represented as a tree.\n`);
await TestRunner.loadModule('profiler_test_runner');
TestRunner.printDevToolsConsole();

function test() {
var profileAndExpectations = {
_profile: {
'head': {
Expand Down Expand Up @@ -859,15 +863,4 @@
console.log(Object.values(overviewPane._calculateDrawData(2)));
console.log(Object.values(overviewPane._calculateDrawData(1)));
TestRunner.completeTest();
}

</script>
</head>
<body onload="runTest()">
<p>
Tests Overview pane calculation in FlameChart for different width = 2^n with n in range 4 - 0.<br/>
Also tests loading of a legacy nodes format, where nodes were represented as a tree.

</p>
</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Tests filtering of native nodes.
Also tests loading of a legacy nodes format, where nodes were represented as a tree.
Also tests loading of a legacy nodes format, where nodes were represented as a tree.

(root) id:1 total:134330 self:100000 depth:-1
C id:7 total:23000 self:22000 depth:0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../resources/profiler-test.js"></script>
<script>
// 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 filtering of native nodes.
Also tests loading of a legacy nodes format, where nodes were represented as a tree.\n`);
await TestRunner.loadModule('profiler_test_runner');

function test() {
var profile = {
'head': {
'callFrame': {'functionName': '(root)', 'scriptId': '0', 'url': '', 'lineNumber': 0},
Expand Down Expand Up @@ -84,14 +86,4 @@
}
TestRunner.addResult(model.samples.join(', '));
TestRunner.completeTest();
}

</script>
</head>
<body onload="runTest()">
<p>
Tests filtering of native nodes.<br/>
Also tests loading of a legacy nodes format, where nodes were represented as a tree.
</p>
</body>
</html>
})();
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../resources/profiler-test.js"></script>
<script>
// 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.

function pageFunction() {
console.profile("p1");
console.profileEnd("p1");
console.profile("p1");
console.profileEnd("p1");
console.profile("p2");
console.profileEnd("p2");
}
(async function() {
TestRunner.addResult(`Tests that CPU profile removal from a group works. Bug 110466\n`);
await TestRunner.loadModule('profiler_test_runner');
await TestRunner.showPanel('js_profiler');

await TestRunner.evaluateInPagePromise(`
function pageFunction() {
console.profile("p1");
console.profileEnd("p1");
console.profile("p1");
console.profileEnd("p1");
console.profile("p2");
console.profileEnd("p2");
}
`);

function test() {
ProfilerTestRunner.startProfilerTest(function() {
function viewLoaded() {
var profiles = UI.panels.js_profiler;
Expand All @@ -31,15 +35,4 @@
ProfilerTestRunner.showProfileWhenAdded('p2');
ProfilerTestRunner.waitUntilProfileViewIsShown('p2', setTimeout.bind(null, viewLoaded, 0));
});
}

</script>
</head>
<body onload="runTest()">
<p>
Tests that CPU profile removal from a group works.

<a href="https://bugs.webkit.org/show_bug.cgi?id=110466">Bug 110466</a>
</p>
</body>
</html>
})();
Loading

0 comments on commit 39fe771

Please sign in to comment.