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

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

Issue 2533073003: [DevTools] Remove workspace-test.js part1. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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 96a582af261888e6c936b1b087eedb61c1a569ca..518f686550c3770b24a824cd6143f1a4e859e245 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
@@ -401,6 +401,51 @@ InspectorTest.dumpNavigatorViewInMode = function(view, mode)
InspectorTest.dumpNavigatorView(view);
}
+InspectorTest.waitForUISourceCode = function(callback, url, projectType)
+{
+ function matches(uiSourceCode)
+ {
+ if (projectType && uiSourceCode.project().type() !== projectType)
+ return false;
+ if (!projectType && uiSourceCode.project().type() === Workspace.projectTypes.Service)
+ return false;
+ if (url && !uiSourceCode.url().endsWith(url))
+ return false;
+ return true;
+ }
+
+ for (var uiSourceCode of Workspace.workspace.uiSourceCodes()) {
+ if (url && matches(uiSourceCode)) {
+ callback(uiSourceCode);
+ return;
+ }
+ }
+
+ Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdded, uiSourceCodeAdded);
+ function uiSourceCodeAdded(event)
+ {
+ if (!matches(event.data))
+ return;
+ Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISourceCodeAdded, uiSourceCodeAdded);
+ callback(event.data);
+ }
+}
+
+InspectorTest.waitForUISourceCodeRemoved = function(callback)
+{
+ Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemoved, uiSourceCodeRemoved);
+ function uiSourceCodeRemoved(event)
+ {
+ Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISourceCodeRemoved, uiSourceCodeRemoved);
+ callback(event.data);
+ }
+}
+
+InspectorTest.createMockTarget = function(name, capabilities)
+{
lushnikov 2016/11/29 00:27:21 capabilities = capabilities || Object.values(SDK.T
dgozman 2016/11/29 00:33:43 I like the constant more :-)
+ return SDK.targetManager.createTarget(name, capabilities || SDK.Target.Capability.AllForTests, params => new SDK.StubConnection(params), null);
+}
+
InspectorTest.assertGreaterOrEqual = function(a, b, message)
{
if (a < b)

Powered by Google App Engine
This is Rietveld 408576698