Commit 52ff5026 authored by Andrey Kosyakov's avatar Andrey Kosyakov Committed by Commit Bot

DevTools: migrate coverage tests to the new tests framework

Change-Id: I561218917c5491c4326eec34897d15af124add70
Reviewed-on: https://chromium-review.googlesource.com/780762Reviewed-by: default avatarWill Chen <chenwilliam@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518393}
parent e9bd34c6
......@@ -798,8 +798,8 @@ crbug.com/778391 http/tests/devtools/elements/styles-3/styles-disable-inherited.
crbug.com/778391 virtual/mojo-loading/http/tests/devtools/elements/styles-3/styles-add-new-rule.js [ Pass Failure ]
crbug.com/778391 virtual/mojo-loading/http/tests/devtools/elements/styles-3/styles-disable-inherited.js [ Pass Failure ]
crbug.com/773353 [ Mac ] http/tests/devtools/coverage/coverage-view.html [ Pass Failure ]
crbug.com/773353 [ Mac ] virtual/mojo-loading/http/tests/devtools/coverage/coverage-view.html [ Pass Failure ]
crbug.com/773353 [ Mac ] http/tests/devtools/coverage/coverage-view.js [ Pass Failure ]
crbug.com/773353 [ Mac ] virtual/mojo-loading/http/tests/devtools/coverage/coverage-view.js [ Pass Failure ]
crbug.com/767269 [ Win ] inspector-protocol/layout-fonts/cjk-ideograph-fallback-by-lang.js [ Pass Failure ]
......
Tests the coverage list view after finishing recording in the Coverage view.
Initial
.../devtools/coverage/resources/coverage.js JS used: 350 unused: 218 total: 568
.../devtools/coverage/resources/coverage.js JS used: 354 unused: 214 total: 568
.../devtools/coverage/resources/highlight-in-source.css CSS used: 67 unused: 142 total: 209
After second session
.../devtools/coverage/resources/coverage.js JS used: 350 unused: 218 total: 568
.../devtools/coverage/resources/coverage.js JS used: 354 unused: 214 total: 568
.../devtools/coverage/resources/highlight-in-source.css CSS used: 67 unused: 142 total: 209
After clear
.../devtools/coverage/resources/highlight-in-source.css CSS used: 67 unused: 142 total: 209
......
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../../inspector/elements-test.js"></script>
<script src="../resources/coverage-test.js"></script>
<script src="resources/coverage.js"></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 the coverage list view after finishing recording in the Coverage view.\n`);
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.loadHTML(`
<p class="class">
</p>
`);
await TestRunner.addStylesheetTag('resources/highlight-in-source.css');
<link rel="stylesheet" type="text/css" href="resources/highlight-in-source.css">
<script>
async function test() {
CoverageTestRunner.startCoverage();
await TestRunner.addScriptTag('resources/coverage.js');
await TestRunner.evaluateInPagePromise('performActions()');
await CoverageTestRunner.stopCoverage();
TestRunner.addResult('Initial');
......@@ -28,15 +31,4 @@ async function test() {
CoverageTestRunner.dumpCoverageListView();
TestRunner.completeTest();
}
</script>
</head>
<body onload="runTest()">
<p class="class">
Tests the coverage list view after finishing recording in the Coverage view.
</p>
</body>
</html>
\ No newline at end of file
})();
Tests the coverage list view after finishing recording in the Coverage view.
.../devtools/coverage/resources/coverage.js JS (coarse) used: 407 unused: 161 total: 568
.../devtools/coverage/resources/coverage.js JS (coarse) used: 411 unused: 157 total: 568
.../devtools/coverage/resources/highlight-in-source.css CSS used: 67 unused: 142 total: 209
Reloading Page
Page reloaded.
......
Tests the filter is properly applied to coverage list view.
Filter: devtools
.../devtools/coverage/resources/coverage.js JS used: 350 unused: 218 total: 568
.../devtools/coverage/resources/coverage.js JS used: 354 unused: 214 total: 568
.../devtools/coverage/resources/highlight-in-source.css CSS used: 67 unused: 142 total: 209
Filter: CES/COV
.../devtools/coverage/resources/coverage.js JS used: 350 unused: 218 total: 568
.../devtools/coverage/resources/coverage.js JS used: 354 unused: 214 total: 568
Filter: no pasaran
Filter:
.../devtools/coverage/resources/coverage.js JS used: 350 unused: 218 total: 568
.../devtools/coverage/resources/coverage.js JS used: 354 unused: 214 total: 568
.../devtools/coverage/resources/highlight-in-source.css CSS used: 67 unused: 142 total: 209
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../../inspector/elements-test.js"></script>
<script src="../resources/coverage-test.js"></script>
<script src="resources/coverage.js"></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.
<link rel="stylesheet" type="text/css" href="resources/highlight-in-source.css">
(async function() {
TestRunner.addResult(`Tests the filter is properly applied to coverage list view.\n`);
await TestRunner.loadModule('coverage_test_runner');
<script>
async function test() {
CoverageTestRunner.startCoverage();
await TestRunner.navigatePromise(TestRunner.url('resources/basic-coverage.html'));
await TestRunner.evaluateInPagePromise('performActions()');
await CoverageTestRunner.stopCoverage();
......@@ -29,15 +27,4 @@ async function test() {
coverageView._filterInput._onChangeCallback();
TestRunner.addResult(`Filter: ${text}`);
}
}
</script>
</head>
<body onload="runTest()">
<p class="class">
Tests the filter is properly applied to coverage list view.
</p>
</body>
</html>
\ No newline at end of file
})();
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../../inspector/elements-test.js"></script>
<script src="../resources/coverage-test.js"></script>
<script src="resources/coverage.js"></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.
<link rel="stylesheet" type="text/css" href="resources/highlight-in-source.css">
(async function() {
TestRunner.addResult(`Tests the coverage list view after finishing recording in the Coverage view.\n`);
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.navigatePromise(TestRunner.url('resources/basic-coverage.html'));
<script>
async function test() {
await TestRunner.evaluateInPagePromise('performActions()');
CoverageTestRunner.startCoverage();
await CoverageTestRunner.pollCoverage();
CoverageTestRunner.dumpCoverageListView();
TestRunner.addResult('Reloading Page');
await InspectorTest.reloadPagePromise();
await TestRunner.reloadPagePromise();
await TestRunner.evaluateInPagePromise('performActions()');
await CoverageTestRunner.stopCoverage();
CoverageTestRunner.dumpCoverageListView();
TestRunner.completeTest();
}
</script>
</head>
<body onload="runTest()">
<p class="class">
Tests the coverage list view after finishing recording in the Coverage view.
</p>
</body>
</html>
\ No newline at end of file
})();
......@@ -4,7 +4,6 @@
(async function() {
TestRunner.addResult(`Tests the gutter decorations in target source code after ScriptFormatterEditorAction\n`);
await TestRunner.loadModule('sources_test_runner');
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.loadHTML(`
<p id="id">PASS</p>
......
......@@ -4,7 +4,6 @@
(async function() {
TestRunner.addResult(`Tests the coverage highlight in sources after the recording finishes.\n`);
await TestRunner.loadModule('sources_test_runner');
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.loadHTML(`
<p id="id">PASS</p>
......
......@@ -2,67 +2,48 @@ Tests the coverage highlight in sources after the recording finishes.
0: <html>
1: <head>
2: <script src="../../inspector/inspector-test.js"></script>
3: <script src="../../inspector/debugger-test.js"></script>
4: <script src="../resources/coverage-test.js"></script>
5:
6: <script>
7: + function used1() {
8: + window.a += 4;
9: + }
10:
11: - function unused1() {
12: - window.a += 1;
13: - }
14: </script>
2: <style>
3: .used {
4: color: black;
5: }
6:
7: .notUsed {
8: color: red;
9: }
10: </style>
11: <style>
12: #not-used {
13: color: red;
14: }
15:
16: <script>
17: - function unused2() {
18: - window.a += 0.5;
19: - }
20:
21: + function used2() {
22: + window.a += 4;
23: + }
24: </script>
25:
26: <style>
27: + .used {
28: + color: black;
29: + }
16: #also-used {
17: color: black;
18: }
19: </style>
20: </head>
21: <body>
22: <script>
23: + function used1() {
24: + window.a += 4;
25: + }
26:
27: - function unused1() {
28: - window.a += 1;
29: - }
30:
31: - .notUsed {
32: - color: red;
31: - function unused2() {
32: - window.a += 0.5;
33: - }
34: </style>
35:
36: <style>
37: - #not-used {
38: - color: red;
39: - }
40:
41: + #also-used {
42: + color: black;
43: + }
44: </style>
34:
35: + function used2() {
36: + window.a += 4;
37: + }
38:
39: + function performActions() {
40: + used1();
41: + used2();
42: + }
43: </script>
44: </body>
45:
46: <script>
47: + function performActions() {
48: + used1();
49: + used2();
50: + }
51:
52: - async function test() {
53: - CoverageTestRunner.startCoverage();
54: - await TestRunner.evaluateInPagePromise('performActions()');
55: - await CoverageTestRunner.stopCoverage();
56: - await CoverageTestRunner.dumpDecorations('gutter-html.html');
57: - TestRunner.completeTest();
58: - }
59: </script>
60: </head>
61: <body onload="runTest()">
62: <p class="used" id="also-used">Tests the coverage highlight in sources after the recording finishes.</p>
63: </body>
64: </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 the coverage highlight in sources after the recording finishes.\n`);
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.navigatePromise(TestRunner.url('resources/document.html'));
CoverageTestRunner.startCoverage();
await TestRunner.evaluateInPagePromise('performActions()');
await CoverageTestRunner.stopCoverage();
await CoverageTestRunner.dumpDecorations('document.html');
TestRunner.completeTest();
})();
......@@ -4,7 +4,6 @@
(async function() {
TestRunner.addResult(`Tests the coverage highlight in sources after the recording finishes.\n`);
await TestRunner.loadModule('sources_test_runner');
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.addScriptTag('resources/coverage.js');
......
Tests the coverage list view after finishing recording in the Coverage view.
.../devtools/coverage/resources/coverage.js JS used: 385 unused: 183 total: 568
.../devtools/coverage/resources/coverage.js JS used: 389 unused: 179 total: 568
.../devtools/coverage/resources/highlight-in-source.css CSS used: 90 unused: 119 total: 209
.../devtools/coverage/resources/subframe.html JS used: 73 unused: 1 total: 74
0: + body {
1: + background-color: lightblue;
2: + }
......
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../../inspector/debugger-test.js"></script>
<script src="../resources/coverage-test.js"></script>
<script src="resources/coverage.js"></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.
<link rel="stylesheet" type="text/css" href="resources/highlight-in-source.css">
(async function() {
TestRunner.addResult(`Tests the coverage list view after finishing recording in the Coverage view.\n`);
await TestRunner.loadModule('coverage_test_runner');
<script>
async function test() {
CoverageTestRunner.startCoverage();
await TestRunner.loadHTML(`
<iframe src="resources/subframe.html"></iframe>
<p class="class">
</p>
`);
await TestRunner.addStylesheetTag('resources/highlight-in-source.css');
await TestRunner.addScriptTag('resources/coverage.js');
await TestRunner.evaluateInPagePromise('performActions(); frames[0].performActionsInFrame()');
await CoverageTestRunner.stopCoverage();
......@@ -18,7 +22,7 @@ async function test() {
for (var child of dataGrid.rootNode().children) {
var data = child._coverageInfo;
var url = TestRunner.formatters.formatAsURL(data.url());
if (url.endsWith('-test.js') || url.endsWith('.html'))
if (url.startsWith('test://'))
continue;
var type = Coverage.CoverageListView._typeToString(data.type());
TestRunner.addResult(`${url} ${type} used: ${data.usedSize()} unused: ${data.unusedSize()} total: ${data.size()}`);
......@@ -28,16 +32,4 @@ async function test() {
await CoverageTestRunner.dumpDecorations('coverage.js');
TestRunner.completeTest();
}
</script>
</head>
<body onload="runTest()">
<iframe src="resources/subframe.html"></iframe>
<p class="class">
Tests the coverage list view after finishing recording in the Coverage view.
</p>
</body>
</html>
\ No newline at end of file
})();
<html>
<head>
<link rel="stylesheet" type="text/css" href="highlight-in-source.css">
</head>
<body>
<script src="coverage.js"></script>
<p class="class"></p>
</body>
</html>
<html>
<head>
<script src="../../inspector/inspector-test.js"></script>
<script src="../../inspector/debugger-test.js"></script>
<script src="../resources/coverage-test.js"></script>
<script>
function used1() {
window.a += 4;
}
function unused1() {
window.a += 1;
}
</script>
<script>
function unused2() {
window.a += 0.5;
}
function used2() {
window.a += 4;
}
</script>
<style>
.used {
color: black;
......@@ -33,7 +9,6 @@ function used2() {
color: red;
}
</style>
<style>
#not-used {
color: red;
......@@ -43,23 +18,28 @@ function used2() {
color: black;
}
</style>
</head>
<body>
<script>
function used1() {
window.a += 4;
}
function unused1() {
window.a += 1;
}
function unused2() {
window.a += 0.5;
}
function used2() {
window.a += 4;
}
function performActions() {
used1();
used2();
}
async function test() {
CoverageTestRunner.startCoverage();
await TestRunner.evaluateInPagePromise('performActions()');
await CoverageTestRunner.stopCoverage();
await CoverageTestRunner.dumpDecorations('gutter-html.html');
TestRunner.completeTest();
}
</script>
</head>
<body onload="runTest()">
<p class="used" id="also-used">Tests the coverage highlight in sources after the recording finishes.</p>
</body>
</html>
\ No newline at end of file
......@@ -4,7 +4,6 @@
(async function() {
TestRunner.addResult(`Tests the CSS highlight in sources after the Pretty print formatting.\n`);
await TestRunner.loadModule('sources_test_runner');
await TestRunner.loadModule('coverage_test_runner');
await TestRunner.loadHTML(`
<p id="id">PASS</p>
......
......@@ -13,20 +13,29 @@ CoverageTestRunner.startCoverage = function() {
coverageView._startRecording();
};
/**
* @return {!Promise}
*/
CoverageTestRunner.stopCoverage = function() {
var coverageView = self.runtime.sharedInstance(Coverage.CoverageView);
return coverageView._stopRecording();
};
/**
* @return {!Promise}
*/
CoverageTestRunner.pollCoverage = function() {
var coverageView = self.runtime.sharedInstance(Coverage.CoverageView);
return coverageView._poll();
};
/**
* @return {!Promise<!SourceFrame.SourceFrame>}
*/
CoverageTestRunner.sourceDecorated = async function(source) {
await UI.inspectorView.showPanel('sources');
var decoratePromise = TestRunner.addSnifferPromise(Coverage.CoverageView.LineDecorator.prototype, '_innerDecorate');
var sourceFrame = await new Promise(fulfill => SourcesTestRunner.showScriptSource(source, fulfill));
var sourceFrame = await SourcesTestRunner.showScriptSourcePromise(source);
await decoratePromise;
return sourceFrame;
};
......@@ -36,6 +45,9 @@ CoverageTestRunner.dumpDecorations = async function(source) {
CoverageTestRunner.dumpDecorationsInSourceFrame(sourceFrame);
};
/**
* @return {?DataGrid.DataGridNode}
*/
CoverageTestRunner.findCoverageNodeForURL = function(url) {
var coverageListView = self.runtime.sharedInstance(Coverage.CoverageView)._listView;
var rootNode = coverageListView._dataGrid.rootNode();
......@@ -80,7 +92,7 @@ CoverageTestRunner.dumpCoverageListView = function() {
var data = child._coverageInfo;
var url = TestRunner.formatters.formatAsURL(data.url());
if (url.endsWith('-test.js') || url.endsWith('.html'))
if (url.startsWith('test://'))
continue;
var type = Coverage.CoverageListView._typeToString(data.type());
......
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