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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/console/console-revoke-error.html

Issue 2751193003: [DevTools] Move ConsoleModel to it's own module (Closed)
Patch Set: 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
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script> 4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script> 5 <script>
6 6
7 var p = []; 7 var p = [];
8 8
9 function createPromises() 9 function createPromises()
10 { 10 {
11 for (var i = 0; i < 3; ++i) 11 for (var i = 0; i < 3; ++i)
12 p.push(Promise.reject(new Error("Handled error"))); 12 p.push(Promise.reject(new Error("Handled error")));
13 } 13 }
14 14
15 function handleSomeRejections() 15 function handleSomeRejections()
16 { 16 {
17 p[0].catch(function() {}); 17 p[0].catch(function() {});
18 p[2].catch(function() {}); 18 p[2].catch(function() {});
19 } 19 }
20 20
21 function test() 21 function test()
22 { 22 {
23 var messageAddedListener = InspectorTest.wrapListener(messageAdded); 23 var messageAddedListener = InspectorTest.wrapListener(messageAdded);
24 InspectorTest.consoleModel.addEventListener(SDK.ConsoleModel.Events.MessageA dded, messageAddedListener); 24 InspectorTest.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events .MessageAdded, messageAddedListener);
25 25
26 InspectorTest.addResult("Creating promise"); 26 InspectorTest.addResult("Creating promise");
27 InspectorTest.evaluateInPageWithTimeout("createPromises()"); 27 InspectorTest.evaluateInPageWithTimeout("createPromises()");
28 28
29 var messageNumber = 0; 29 var messageNumber = 0;
30 function messageAdded(event) 30 function messageAdded(event)
31 { 31 {
32 InspectorTest.addResult("Message added: " + event.data.level + " " + eve nt.data.type); 32 InspectorTest.addResult("Message added: " + event.data.level + " " + eve nt.data.type);
33 if (++messageNumber < 3) 33 if (++messageNumber < 3)
34 return; 34 return;
35 messageNumber = 0; 35 messageNumber = 0;
36 36
37 InspectorTest.consoleModel.removeEventListener(SDK.ConsoleModel.Events.M essageAdded, messageAddedListener); 37 InspectorTest.consoleModel.removeEventListener(ConsoleModel.ConsoleModel .Events.MessageAdded, messageAddedListener);
38 InspectorTest.addResult(""); 38 InspectorTest.addResult("");
39 39
40 // Process array as a batch. 40 // Process array as a batch.
41 InspectorTest.consoleModel.addEventListener(SDK.ConsoleModel.Events.Mess ageUpdated, InspectorTest.wrapListener(messageUpdated)); 41 InspectorTest.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Ev ents.MessageUpdated, InspectorTest.wrapListener(messageUpdated));
42 InspectorTest.dumpConsoleCounters(); 42 InspectorTest.dumpConsoleCounters();
43 InspectorTest.addResult(""); 43 InspectorTest.addResult("");
44 InspectorTest.addResult("Handling promise"); 44 InspectorTest.addResult("Handling promise");
45 InspectorTest.evaluateInPageWithTimeout("handleSomeRejections()"); 45 InspectorTest.evaluateInPageWithTimeout("handleSomeRejections()");
46 } 46 }
47 47
48 function messageUpdated() 48 function messageUpdated()
49 { 49 {
50 if (++messageNumber < 2) 50 if (++messageNumber < 2)
51 return; 51 return;
52 InspectorTest.dumpConsoleCounters(); 52 InspectorTest.dumpConsoleCounters();
53 InspectorTest.completeTest(); 53 InspectorTest.completeTest();
54 } 54 }
55 } 55 }
56 56
57 </script> 57 </script>
58 </head> 58 </head>
59 59
60 <body onload="runTest()"> 60 <body onload="runTest()">
61 <p>Tests that console revokes lazily handled promise rejections.</p> 61 <p>Tests that console revokes lazily handled promise rejections.</p>
62 62
63 </body> 63 </body>
64 </html> 64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698