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

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

Issue 2747863007: DevTools: clean up tests to not depend on NetworkProject.addFile method (Closed)
Patch Set: address comments Created 3 years, 9 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/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 7fe44929c70d94e4401a8c62f982929a0c26b0f6..14071e606f6d2307e84962b9db60027744ab5b98 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
@@ -52,6 +52,20 @@ InspectorTest.evaluateInPage = function(code, callback)
InspectorTest.RuntimeAgent.evaluate(code, "console", false, mycallback);
}
+InspectorTest.addScriptUISourceCode = function(url, content, isContentScript, worldId) {
+ content += '\n//# sourceURL=' + url;
+ if (isContentScript)
+ content = `testRunner.evaluateScriptInIsolatedWorld(${worldId}, \`${content}\`)`;
+ InspectorTest.evaluateInPagePromise(content);
+ return InspectorTest.waitForUISourceCode(url);
+}
+
+InspectorTest.addScriptForFrame = function(url, content, frame) {
+ content += '\n//# sourceURL=' + url;
+ var executionContext = InspectorTest.runtimeModel.executionContexts().find(context => context.frameId === frame.id);
+ InspectorTest.RuntimeAgent.evaluate(content, "console", false, false, executionContext.id, function() { });
+}
+
InspectorTest.evaluateInPagePromise = function(code)
{
return new Promise(succ => InspectorTest.evaluateInPage(code, succ));
@@ -451,12 +465,6 @@ InspectorTest.waitForUISourceCodeRemoved = function(callback)
}
}
-InspectorTest._mockTargetId = 1;
-InspectorTest.createMockTarget = function(name, capabilities, dontAttachToMain)
-{
- return SDK.targetManager.createTarget('mock-target-' + InspectorTest._mockTargetId++, name, capabilities || SDK.Target.Capability.AllForTests, params => new SDK.StubConnection(params), dontAttachToMain ? null : InspectorTest.mainTarget);
-}
-
InspectorTest.assertGreaterOrEqual = function(a, b, message)
{
if (a < b)

Powered by Google App Engine
This is Rietveld 408576698