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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js

Issue 2968523003: [DevTools] Migrate inspector-protocol/debugger tests to new harness (Closed)
Patch Set: all tests 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/resources/inspector-protocol-test.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js b/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js
index ca431062fb82e66fbdbae98a91461ff5e2801162..f2c60bad465fd7a8e64cc8dd0e562c59b61c500d 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js
@@ -312,7 +312,7 @@ TestRunner.Session = class {
var eventName = match[3];
eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1);
if (match[1] === 'once')
- return () => this._waitForEvent(`${agentName}.${eventName}`);
+ return eventMatcher => this._waitForEvent(`${agentName}.${eventName}`, eventMatcher);
if (match[1] === 'off')
return listener => this._removeEventHandler(`${agentName}.${eventName}`, listener);
return listener => this._addEventHandler(`${agentName}.${eventName}`, listener);
@@ -335,9 +335,11 @@ TestRunner.Session = class {
this._eventHandlers.set(eventName, handlers);
}
- _waitForEvent(eventName) {
+ _waitForEvent(eventName, eventMatcher) {
return new Promise(callback => {
var handler = result => {
+ if (eventMatcher && !eventMatcher(result))
+ return;
this._removeEventHandler(eventName, handler);
callback(result);
};

Powered by Google App Engine
This is Rietveld 408576698