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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/page/javascriptDialogEvents.js

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: unified Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector-protocol/page/javascriptDialogEvents.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/javascriptDialogEvents.js b/third_party/WebKit/LayoutTests/inspector-protocol/page/javascriptDialogEvents.js
new file mode 100644
index 0000000000000000000000000000000000000000..d256dbff16ea0cf9b31df4a51ec8b23dc24addb4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/javascriptDialogEvents.js
@@ -0,0 +1,35 @@
+(async function() {
chenwilliam 2017/06/19 19:09:20 I know we talked about this but it seems confusing
dgozman 2017/06/19 21:49:22 Well, this was a rename (although git didn't get i
+ let {page, session, Protocol} = await InspectorTest.startBlank('');
+
+ await session.evaluate(`
+ testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
+
+ // JavaScript onbeforeunload dialogs require a user gesture.
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(5, 5);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+
+ function onBeforeUnload()
+ {
+ window.removeEventListener('beforeunload', onBeforeUnload);
+ return 'beforeunload in javascriptDialogEvents';
+ }
+ window.onbeforeunload = onBeforeUnload;
+ `);
+
+ Protocol.Page.onJavascriptDialogOpening(event => {
+ InspectorTest.log('Opening dialog: type=' + event.params.type + '; message=' + event.params.message);
+ });
+ Protocol.Page.onJavascriptDialogClosed(event => {
+ InspectorTest.log('Closed dialog: result=' + event.params.result);
+ });
+
+ Protocol.Page.enable();
+ Protocol.Page.navigate({url: 'http://nosuchurl' });
+ await session.evaluate('alert("alert")');
+ await session.evaluate('confirm("confirm")');
+ await session.evaluate('prompt("prompt")');
+ InspectorTest.completeTest();
+})();

Powered by Google App Engine
This is Rietveld 408576698