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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js

Issue 2849583006: [DevTools] Disable contexts in console selector on pause (Closed)
Patch Set: tests Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-context-selector.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
index bee51ac19b3a880a891adbb9bef9b7380e974e15..3f06fbf7460a19b31805a6c78a95db6c45c34ba9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
@@ -469,6 +469,57 @@ InspectorTest.waitForUISourceCodeRemoved = function(callback)
}
}
+InspectorTest.waitForTarget = function(filter) {
+ filter = filter || (target => true);
+ for (var target of SDK.targetManager.targets()) {
+ if (filter(target))
+ return Promise.resolve(target);
+ }
+ var fulfill;
+ var promise = new Promise(callback => fulfill = callback);
+ var observer = {
+ targetAdded: function(target) {
+ if (filter(target)) {
+ SDK.targetManager.unobserveTargets(observer);
+ fulfill(target);
+ }
+ },
+ targetRemoved: function() {
+ },
+ };
+ SDK.targetManager.observeTargets(observer);
+ return promise;
+}
+
+InspectorTest.waitForExecutionContext = function(runtimeModel) {
+ if (runtimeModel.executionContexts().length)
+ return Promise.resolve(runtimeModel.executionContexts()[0]);
+ var fulfill;
+ var promise = new Promise(callback => fulfill = callback);
+ function onContext(event) {
+ runtimeModel.removeEventListener(SDK.RuntimeModel.Events.ExecutionContextCreated, onContext);
+ fulfill(event.data);
+ }
+ runtimeModel.addEventListener(SDK.RuntimeModel.Events.ExecutionContextCreated, onContext);
+ return promise;
+}
+
+InspectorTest.waitForExecutionContextDestroyed = function(context) {
+ var runtimeModel = context.runtimeModel;
+ if (runtimeModel.executionContexts().indexOf(context) === -1)
+ return Promise.resolve();
+ var fulfill;
+ var promise = new Promise(callback => fulfill = callback);
+ function onContext(event) {
+ if (event.data === context) {
+ runtimeModel.removeEventListener(SDK.RuntimeModel.Events.ExecutionContextDestroyed, onContext);
+ fulfill();
+ }
+ }
+ runtimeModel.addEventListener(SDK.RuntimeModel.Events.ExecutionContextDestroyed, onContext);
+ return promise;
+}
+
InspectorTest.assertGreaterOrEqual = function(a, b, message)
{
if (a < b)
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-context-selector.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698