Skip to content

Commit 7bbea08

Browse files
dgozmanCommit bot
authored andcommitted
[inspector] Refactor protocol-test.js
This refactoring makes it easier to write advanced tests and gives full control over what's happening to the test code. It also forces description for every test. BUG=none Review-Url: https://codereview.chromium.org/2891213002 Cr-Commit-Position: refs/heads/master@{#45412}
1 parent 47702c5 commit 7bbea08

178 files changed

Lines changed: 818 additions & 675 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/inspector/console/destroy-context-during-log-expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Tests that destroying context from inside of console.log does not crash
12
{
23
type : string
34
value : First inspector activity after attaching inspector

test/inspector/console/destroy-context-during-log.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
let {session, contextGroup, Protocol} = InspectorTest.start('Tests that destroying context from inside of console.log does not crash');
6+
57
const expression = `
68
Object.defineProperty(Object.prototype, 'RemoteObject', {
79
configurable: true,

test/inspector/console/let-const-with-api-expected.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Tests how let and const interact with command line api
12
first "let a = 1;" result: wasThrown = false
23
second "let a = 1;" result: wasThrown = true
34
exception message: Uncaught SyntaxError: Identifier 'a' has already been declared
@@ -16,4 +17,4 @@ function debug(function) { [Command Line API] }
1617
function undebug(function) { [Command Line API] }
1718
function monitor(function) { [Command Line API] }
1819
function unmonitor(function) { [Command Line API] }
19-
function table(data, [columns]) { [Command Line API] }
20+
function table(data, [columns]) { [Command Line API] }

test/inspector/console/let-const-with-api.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
let {session, contextGroup, Protocol} = InspectorTest.start('Tests how let and const interact with command line api');
6+
57
Protocol.Runtime.evaluate({ expression: "let a = 42;" }).then(step2);
68

79
function step2(response)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Tests that "console.profileEnd()" does not cause crash. (webkit:105759)
22
SUCCESS: found 2 profile headers
3-
SUCCESS: titled profile found
3+
SUCCESS: titled profile found

test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
InspectorTest.log("Tests that \"console.profileEnd()\" does not cause crash. (webkit:105759)");
5+
let {session, contextGroup, Protocol} = InspectorTest.start("Tests that \"console.profileEnd()\" does not cause crash. (webkit:105759)");
66

7-
InspectorTest.addScript(`
7+
contextGroup.addScript(`
88
function collectProfiles()
99
{
1010
console.profile();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.
22
SUCCESS: retrieved '42' profile
3-
SUCCESS: found 'collectProfiles' function in the profile
3+
SUCCESS: found 'collectProfiles' function in the profile

test/inspector/cpu-profiler/console-profile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
InspectorTest.log("Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.");
5+
let {session, contextGroup, Protocol} = InspectorTest.start("Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.");
66

7-
InspectorTest.addScript(`
7+
contextGroup.addScript(`
88
function collectProfiles()
99
{
1010
console.profile("outer");

test/inspector/cpu-profiler/coverage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var f = (function outer() {
5050
f()()();
5151
`;
5252

53-
InspectorTest.log("Test collecting code coverage data with Profiler.collectCoverage.");
53+
let {session, contextGroup, Protocol} = InspectorTest.start("Test collecting code coverage data with Profiler.collectCoverage.");
5454

5555
function ClearAndGC() {
5656
return Protocol.Runtime.evaluate({ expression: "fib = g = f = h = is_optimized = null;" })

test/inspector/cpu-profiler/enable-disable-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ PASS: console initiated profile started
55
PASS: didStartConsoleProfile
66
PASS: didDisableProfiler
77
PASS: no front-end initiated profiles found
8-
PASS: didStopConsoleProfile
8+
PASS: didStopConsoleProfile

0 commit comments

Comments
 (0)