Commit b7153161 authored by dgozman's avatar dgozman Committed by Commit bot

[DevTools] Remove workspace-test.js part4.

Migrated navigator tests and compiler-script-mapping away from mock workspace.

BUG=none

Review-Url: https://codereview.chromium.org/2536733004
Cr-Commit-Position: refs/heads/master@{#435043}
parent 05d8c5e2
......@@ -114,33 +114,29 @@ cat.jpeg resolves to http://a/b/c/cat.jpeg===http://a/b/c/cat.jpeg passes: true
resolves to http://example.com/path.css?query===http://example.com/path.css?query passes: true
Running: testCompilerScriptMapping
UISourceCodeAdded: [debugger] debugger:///VM1 compiled.js
UISourceCodeAdded: [network] compiled.js
UISourceCodeAdded: [service] compiled.js
UISourceCodeRemoved: [service] compiled.js
UISourceCodeAdded: [contentscripts] http://localhost:8000/inspector/resources/source1.js
UISourceCodeAdded: [contentscripts] http://localhost:8000/inspector/resources/source2.js
afterScriptAdded
Running: testCompilerScriptMappingWhenResourceWasLoadedAfterSource
UISourceCodeAdded: [debugger] debugger:///VM2 compiled.js
UISourceCodeAdded: [service] compiled.js
UISourceCodeAdded: [network] compiled.js
UISourceCodeRemoved: [service] compiled.js
UISourceCodeAdded: [contentscripts] http://localhost:8000/inspector/resources/source1.js
UISourceCodeAdded: [contentscripts] http://localhost:8000/inspector/resources/source2.js
Adding compiled.js
compiled.js UISourceCode arrived
compiled.js script found
source1.js UISourceCode arrived
source2.js UISourceCode arrived
Location checks passed. Requesting content
Content1 arrived.
Content2 arrived.
Running: testInlinedSourceMap
UISourceCodeAdded: [debugger] debugger:///VM3 compiled.js
UISourceCodeAdded: [service] http://example.com/compiled.js
UISourceCodeRemoved: [service] http://example.com/compiled.js
UISourceCodeAdded: [contentscripts] http://example.com/source.js
Adding compiled.js
compiled.js UISourceCode arrived
compiled.js script found
source3.js UISourceCode arrived
Location checks passed. Requesting content
<source content> === <source content>
Running: testSourceMapCouldNotBeLoaded
UISourceCodeAdded: [debugger] debugger:///VM4 compiled.js
UISourceCodeAdded: [service] compiled.js
compiled.js
Adding compiled.js
compiled.js UISourceCode arrived
compiled.js script found
source-map.json_ UISourceCode arrived
debugger:///VM
Running: testSourceRoot
/example.js === /example.js
......
......@@ -3,48 +3,41 @@ Tests that scripts panel UI elements work as intended.
Running: testInitialLoad
Navigator:
mock-target-1
top
(no domain)
bar.js
baz.js
foo.js
foobar.js
top
(no domain)
bar.js
baz.js
foo.js
foobar.js
Running: testReset
Navigator:
mock-target-2
top
(no domain)
bar.js
baz.js
foo.js
top
(no domain)
bar.js
baz.js
foo.js
Revealing in navigator.
Navigator:
mock-target-2
top
(no domain)
bar.js
baz.js
foo.js
top
(no domain)
bar.js
baz.js
foo.js
Navigator:
mock-target-2
Navigator:
mock-target-2
top
(no domain)
bar.js
top
(no domain)
bar.js
Running: testDebuggerUISourceCodeAddedAndRemoved
Navigator:
mock-target-3
top
(no domain)
foo.js
top
(no domain)
foo.js
Navigator:
mock-target-3
top
(no domain)
foo.js
source.js
top
(no domain)
foo.js
source.js
......@@ -2,7 +2,6 @@
<head>
<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>
<script src="../../../http/tests/inspector/workspace-test.js"></script>
<script>
function test()
{
......@@ -14,10 +13,7 @@ function test()
function createNavigatorView()
{
var workspace = Workspace.workspace;
Workspace.workspace = InspectorTest.testWorkspace;
var navigatorView = new Sources.SourcesNavigatorView();
Workspace.workspace = workspace;
navigatorView.show(UI.inspectorView.element);
return navigatorView;
}
......@@ -33,37 +29,23 @@ function test()
return contentProvider;
}
function createMockWorkspace()
function addNetworkFile(url)
{
InspectorTest.createWorkspaceWithTarget(true);
InspectorTest.testDebuggerProject = new Bindings.ContentProviderBasedProject(InspectorTest.testWorkspace, "", Workspace.projectTypes.Debugger, "");
return InspectorTest.testWorkspace;
}
function addNetworkFile(workspace, url)
{
return InspectorTest.testNetworkProject.addFile(createContentProvider(url), InspectorTest.mainFrame());
}
function addDebuggerFile(workspace, url)
{
var uiSourceCode = InspectorTest.testDebuggerProject.createUISourceCode(url, Common.resourceTypes.Script);
InspectorTest.testDebuggerProject.addUISourceCodeWithProvider(uiSourceCode, createContentProvider(url));
return uiSourceCode;
var networkProject = Bindings.NetworkProject.forTarget(InspectorTest.mainTarget);
return networkProject.addFile(createContentProvider(url), InspectorTest.mainFrame());
}
InspectorTest.runTestSuite([
function testInitialLoad(next)
{
var workspace = createMockWorkspace();
addNetworkFile(workspace, "foobar.js");
Bindings.NetworkProject.forTarget(InspectorTest.mainTarget)._reset();
addNetworkFile("foobar.js");
var sourcesNavigatorView = createNavigatorView();
addNetworkFile(workspace, "foo.js");
addNetworkFile(workspace, "bar.js");
var uiSourceCode = addNetworkFile(workspace, "baz.js");
addNetworkFile("foo.js");
addNetworkFile("bar.js");
var uiSourceCode = addNetworkFile("baz.js");
sourcesNavigatorView.revealUISourceCode(uiSourceCode);
dumpNavigator(sourcesNavigatorView);
......@@ -72,21 +54,21 @@ function test()
function testReset(next)
{
var workspace = createMockWorkspace();
Bindings.NetworkProject.forTarget(InspectorTest.mainTarget)._reset();
var sourcesNavigatorView = createNavigatorView();
var uiSourceCode = addNetworkFile(workspace, "foo.js");
addNetworkFile(workspace, "bar.js");
addNetworkFile(workspace, "baz.js");
var uiSourceCode = addNetworkFile("foo.js");
addNetworkFile("bar.js");
addNetworkFile("baz.js");
dumpNavigator(sourcesNavigatorView);
InspectorTest.addResult("Revealing in navigator.");
sourcesNavigatorView.revealUISourceCode(uiSourceCode);
dumpNavigator(sourcesNavigatorView);
InspectorTest.testNetworkProject._reset();
Bindings.NetworkProject.forTarget(InspectorTest.mainTarget)._reset();
dumpNavigator(sourcesNavigatorView);
uiSourceCode = addNetworkFile(workspace, "bar.js");
uiSourceCode = addNetworkFile("bar.js");
sourcesNavigatorView.revealUISourceCode(uiSourceCode);
dumpNavigator(sourcesNavigatorView);
......@@ -95,20 +77,25 @@ function test()
function testDebuggerUISourceCodeAddedAndRemoved(next)
{
var workspace = createMockWorkspace();
Bindings.NetworkProject.forTarget(InspectorTest.mainTarget)._reset();
var sourcesNavigatorView = createNavigatorView();
var uiSourceCode = addNetworkFile(workspace, "foo.js");
var debuggerUISourceCode = addDebuggerFile(workspace, "compiled.js");
sourcesNavigatorView.revealUISourceCode(uiSourceCode);
sourcesNavigatorView.revealUISourceCode(debuggerUISourceCode);
dumpNavigator(sourcesNavigatorView);
var uiSourceCode = addNetworkFile("foo.js");
InspectorTest.waitForUISourceCode(onUISourceCode);
InspectorTest.evaluateInPage("function foo() {}");
// Plug compiler source mapping.
addNetworkFile(workspace, "source.js");
function onUISourceCode(debuggerUISourceCode)
{
sourcesNavigatorView.revealUISourceCode(uiSourceCode);
sourcesNavigatorView.revealUISourceCode(debuggerUISourceCode);
dumpNavigator(sourcesNavigatorView);
dumpNavigator(sourcesNavigatorView);
next();
// Plug compiler source mapping.
addNetworkFile("source.js");
dumpNavigator(sourcesNavigatorView);
next();
}
}
]);
};
......
......@@ -2,7 +2,6 @@
<head>
<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>
<script src="../../../http/tests/inspector/workspace-test.js"></script>
<script>
function test()
......@@ -10,20 +9,25 @@ function test()
function createNavigatorView(constructor)
{
var navigatorView = new constructor();
navigatorView._resetWorkspace(InspectorTest.testWorkspace);
navigatorView.show(UI.inspectorView.element);
return navigatorView;
}
InspectorTest.createWorkspaceWithTarget(true);
sourcesNavigatorView = createNavigatorView(Sources.SourcesNavigatorView);
contentScriptsNavigatorView = createNavigatorView(Sources.ContentScriptsNavigatorView);
Bindings.NetworkProject.forTarget(InspectorTest.mainTarget)._reset();
var target2 = InspectorTest.createMockTarget("mock-target-1");
SDK.ResourceTreeModel.fromTarget(target2)._cachedResourcesProcessed = true;
SDK.ResourceTreeModel.fromTarget(target2)._frameAttached("42", 0);
var frame = SDK.ResourceTreeModel.fromTarget(target2).mainFrame;
var uiSourceCodes = [];
function addUISourceCode(url, isContentScript)
{
var contentProvider = Common.StaticContentProvider.fromString(url, Common.resourceTypes.Script, "");
var uiSourceCode = InspectorTest.testNetworkProject.addFile(contentProvider, InspectorTest.mainFrame(), isContentScript);
var uiSourceCode = Bindings.NetworkProject.forTarget(target2).addFile(contentProvider, frame, isContentScript);
uiSourceCodes.push(uiSourceCode);
}
......
......@@ -2,42 +2,35 @@
<head>
<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>
<script src="../../../http/tests/inspector/workspace-test.js"></script>
<script>
function test()
{
var target = InspectorTest.createWorkspaceWithTarget(true);
target.resourceTreeModel._frameAttached(239, target.resourceTreeModel.mainFrame.id);
var mainFrame = target.resourceTreeModel.mainFrame;
target.resourceTreeModel._frameNavigated({id: 239, parentId: mainFrame.id, url:"iframeurl.html", name: "childframe"});
var networkProject1 = InspectorTest.testNetworkProject;
var subframe = target.resourceTreeModel.frameForId(239);
SDK.targetManager = InspectorTest.testTargetManager;
target2 = InspectorTest.createMockTarget(100);
var networkProject2 = InspectorTest.testNetworkProject;
var networkProject1 = Bindings.NetworkProject.forTarget(InspectorTest.mainTarget);
networkProject1._reset();
var target2 = InspectorTest.createMockTarget("mock-target-100");
SDK.ResourceTreeModel.fromTarget(target2)._cachedResourcesProcessed = true;
SDK.ResourceTreeModel.fromTarget(target2)._frameAttached("42", 0);
var networkProject2 = Bindings.NetworkProject.forTarget(target2);
var subframe = InspectorTest.mainFrame().childFrames[0];
var sourcesNavigatorView = new Sources.SourcesNavigatorView();
sourcesNavigatorView._resetWorkspace(InspectorTest.testWorkspace);
sourcesNavigatorView.show(UI.inspectorView.element);
var contentScriptsNavigatorView = new Sources.ContentScriptsNavigatorView();
contentScriptsNavigatorView._resetWorkspace(InspectorTest.testWorkspace);
contentScriptsNavigatorView.show(UI.inspectorView.element);
var uiSourceCodes = [];
function addUISourceCode(url, isContentScript, frame)
{
var contentProvider = Common.StaticContentProvider.fromString(url, Common.resourceTypes.Script, "");
var uiSourceCode = networkProject1.addFile(contentProvider, frame || mainFrame);
var uiSourceCode = networkProject1.addFile(contentProvider, frame || InspectorTest.mainFrame());
uiSourceCodes.push(uiSourceCode);
}
function addUISourceCode2(url, isContentScript)
{
var contentProvider = Common.StaticContentProvider.fromString(url, Common.resourceTypes.Script, "");
var uiSourceCode = networkProject2.addFile(contentProvider, target2.resourceTreeModel.mainFrame);
var uiSourceCode = networkProject2.addFile(contentProvider, SDK.ResourceTreeModel.fromTarget(target2).mainFrame);
uiSourceCodes.push(uiSourceCode);
}
......@@ -126,7 +119,7 @@ function test()
InspectorTest.addResult("\n\n================================================");
InspectorTest.addResult("Removing all resources:");
InspectorTest.testNetworkProject._reset(target);
networkProject2._reset();
InspectorTest.dumpNavigatorViewInAllModes(sourcesNavigatorView);
InspectorTest.dumpNavigatorViewInAllModes(contentScriptsNavigatorView);
......@@ -135,10 +128,11 @@ function test()
</script>
</head>
<body onload="runTest()">
<body>
<p>
Tests scripts panel file selectors.
</p>
<iframe src="resources/post-message-listener.html" name="childframe" onload="runTest()"></iframe>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment