Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: test/inspector/runtime/runtime-restore.js

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: rebased Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.v8
4
5 InspectorTest.log('Checks that Runtime agent correctly restore its state.');
6
7 InspectorTest.addScript(`
8 var formatter = {
9 header: function(x)
10 {
11 return ["span", {}, "Header formatted ", x.name];
12 },
13
14 hasBody: function(x)
15 {
16 return true;
17 },
18
19 body: function(x)
20 {
21 return ["span", {}, "Body formatted ", x.name]
22 }
23 };
24
25 devtoolsFormatters = [ formatter ];
26
27 //# sourceURL=test.js`)
28
29 InspectorTest.runTestSuite([
30 function testExecutionContextsNotificationsOnRestore(next) {
31 Protocol.Runtime.onExecutionContextsCleared(InspectorTest.logMessage);
32 Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage);
33 Protocol.Runtime.onExecutionContextDestroyed(InspectorTest.logMessage);
34 Protocol.Runtime.enable()
35 .then(reconnect)
36 .then(Protocol.Runtime.disable)
37 .then(() => {
38 Protocol.Runtime.onExecutionContextsCleared(null);
39 Protocol.Runtime.onExecutionContextCreated(null);
40 Protocol.Runtime.onExecutionContextDestroyed(null);
41 next()
42 });
43 },
44
45 function testConsoleAPICalledAfterRestore(next) {
46 Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage);
47 Protocol.Runtime.enable()
48 .then(reconnect)
49 .then(() => Protocol.Runtime.evaluate({ expression: 'console.log(42);' }))
50 .then(Protocol.Runtime.disable)
51 .then(() => {
52 Protocol.Runtime.onConsoleAPICalled(null);
53 next();
54 });
55 },
56
57 function testSetCustomObjectFormatterEnabled(next) {
58 Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage);
59 // cleanup console message storage
60 reconnect();
61 Protocol.Runtime.enable()
62 .then(() => Protocol.Runtime.setCustomObjectFormatterEnabled({ enabled: tr ue }))
63 .then(reconnect)
64 .then(() => Protocol.Runtime.evaluate({ expression: 'console.log({ name: 4 2 })'}))
65 .then(InspectorTest.logMessage)
66 .then(Protocol.Runtime.disable)
67 .then(() => {
68 Protocol.Runtime.onConsoleAPICalled(null);
69 next();
70 });
71 },
72 ]);
73
74 function reconnect() {
75 InspectorTest.logMessage('will reconnect..');
76 utils.reconnect();
77 }
OLDNEW
« no previous file with comments | « test/inspector/runtime/run-script-async.js ('k') | test/inspector/runtime/runtime-restore-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698