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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/input-event-warning.html

Issue 2474073005: DevTools: add the logging aspect into the PerformanceMonitor (Closed)
Patch Set: test fixed Created 4 years, 1 month 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> 4 <script>
5 5
6 function eventListenerSuicidal(event) 6 function eventListenerSuicidal(event)
7 { 7 {
8 event.target.removeEventListener("wheel", eventListenerSuicidal); 8 event.target.removeEventListener("wheel", eventListenerSuicidal);
9 } 9 }
10 10
(...skipping 24 matching lines...) Expand all
35 new MouseEvent("mousemove", { cancelable: true, clientX: 100, clinetY: 1 00, movementX: 0, movementY: 0 }), 35 new MouseEvent("mousemove", { cancelable: true, clientX: 100, clinetY: 1 00, movementX: 0, movementY: 0 }),
36 new TouchEvent("touchstart", touchEventInit), 36 new TouchEvent("touchstart", touchEventInit),
37 new TouchEvent("touchmove", touchEventInit), 37 new TouchEvent("touchmove", touchEventInit),
38 ]; 38 ];
39 39
40 var eventTypes = ["wheel", "mousemove", "touchstart", "touchmove"]; 40 var eventTypes = ["wheel", "mousemove", "touchstart", "touchmove"];
41 for (var type of eventTypes) { 41 for (var type of eventTypes) {
42 target.addEventListener(type, eventListener1); 42 target.addEventListener(type, eventListener1);
43 target.addEventListener(type, eventListener2); 43 target.addEventListener(type, eventListener2);
44 } 44 }
45 var deadline = performance.now() + 100; 45 var deadline = performance.now() + 110;
46 while (performance.now() < deadline) {}; 46 while (performance.now() < deadline) {};
47 if (window.testRunner) 47 if (window.testRunner)
48 window.testRunner.setDumpConsoleMessages(false); 48 window.testRunner.setDumpConsoleMessages(false);
49 for (var event of events) 49 for (var event of events)
50 target.dispatchEvent(event); 50 target.dispatchEvent(event);
51 51
52 // Make sure we don't emit warnings twice, make another pass. 52 // Make sure we don't emit warnings twice, make another pass.
53 for (var event of events) 53 for (var event of events)
54 target.dispatchEvent(event); 54 target.dispatchEvent(event);
55 55
56 // Make sure we don't crash. 56 // Make sure we don't crash.
57 target = document.createElement("div"); 57 target = document.createElement("div");
58 document.body.appendChild(target); 58 document.body.appendChild(target);
59 target.addEventListener("wheel", eventListenerSuicidal); 59 target.addEventListener("wheel", eventListenerSuicidal);
60 target.dispatchEvent(wheelEvent); 60 target.dispatchEvent(wheelEvent);
61 } 61 }
62 62
63 function test() 63 function test()
64 { 64 {
65 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, InspectorTest.safeWrap(onConsoleMessage)); 65 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, InspectorTest.safeWrap(onConsoleMessage));
66 step1(); 66 step1();
67 67
68 function step1() 68 function step1()
69 { 69 {
70 InspectorTest.mainTarget.pageAgent().setBlockedEventsWarningThreshold(30 ); 70 InspectorTest.mainTarget.logAgent().setReportViolationsEnabled(false);
71 InspectorTest.evaluateInPage("dispatchEvents()", step2); 71 InspectorTest.evaluateInPage("dispatchEvents()", step2);
72 } 72 }
73 73
74 function step2() 74 function step2()
75 { 75 {
76 InspectorTest.mainTarget.pageAgent().setBlockedEventsWarningThreshold(0. 000001); 76 InspectorTest.mainTarget.logAgent().setReportViolationsEnabled(true);
77 InspectorTest.addResult("There should be no warnings above this line"); 77 InspectorTest.addResult("There should be no warnings above this line");
78 InspectorTest.evaluateInPage("dispatchEvents()", () => InspectorTest.com pleteTest()); 78 InspectorTest.evaluateInPage("dispatchEvents()", () => InspectorTest.com pleteTest());
79 } 79 }
80 80
81 function onConsoleMessage(event) 81 function onConsoleMessage(event)
82 { 82 {
83 var message = event.data; 83 var message = event.data;
84 var text = message.messageText; 84 var text = message.messageText;
85 InspectorTest.addResult(text.replace(/ \d+ ms/, " <number> ms")); 85 InspectorTest.addResult(text.replace(/ \d+ ms/, " <number> ms"));
86 } 86 }
87 } 87 }
88 </script> 88 </script>
89 </head> 89 </head>
90 <body onload="runTest()"> 90 <body onload="runTest()">
91 <p>Tests that console warnings are issued for a blocked event listener and that 91 <p>Tests that console warnings are issued for a blocked event listener and that
92 there is no crash when an offending listener is removed by the handler.</p> 92 there is no crash when an offending listener is removed by the handler.</p>
93 </div> 93 </div>
94 </body> 94 </body>
95 </html> 95 </html>
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/page_handler.cc ('k') | third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698