Add support for Page.getResourceTree

Unfortunately we don't yet have a way to walk into
imports, so this only is the first-level of the
source tree, but this is a huge step forward.

You can now click to set breakpoints, however
setting breakpoints crashes sky.

I had to fix Console.log to flush stdout
so that I could actually debug my timing-out test.

Also had to fix Chai to dump differences for deepEqual.

R=esprehn@chromium.org, abarth@chromium.org, esprhen@chromium.org

Review URL: https://codereview.chromium.org/732413004
This commit is contained in:
Eric Seidel
2014-11-18 15:53:13 -08:00
parent 09f4d5e9ff
commit 88fa228e45
2 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
Running 1 tests
ok 1 PageAgent.getResourceTree should dump the current resource tree
1 tests
1 pass
0 fail

View File

@@ -0,0 +1,43 @@
<html>
<import src="/sky/tests/resources/chai.sky" />
<import src="/sky/tests/resources/mocha.sky" />
<import src="/sky/framework/inspector/page-agent.sky" as="PageAgent" />
<img src='does_not_exist.jpg' />
<script>
describe('PageAgent.getResourceTree', function() {
it('should dump the current resource tree', function() {
var pageAgent = new PageAgent();
pageAgent.enable();
var resourceTree = pageAgent.getResourceTree();
assert.deepEqual(resourceTree, {
"frameTree": {
"frame": {
"id": "1",
"loaderId": "1",
"url": "http://127.0.0.1:8000/sky/tests/inspector/page-agent-get-resource-tree.sky",
"mimeType": "text/html",
"securityOrigin": "http://127.0.0.1:8000/sky/tests/inspector/page-agent-get-resource-tree.sky"
},
"resources": [{
"url": "http://127.0.0.1:8000/sky/tests/resources/chai.sky",
"type": "Document",
"mimeType": "text/html"
}, {
"url": "http://127.0.0.1:8000/sky/tests/resources/mocha.sky",
"type": "Document",
"mimeType": "text/html"
}, {
"url": "http://127.0.0.1:8000/sky/framework/inspector/page-agent.sky",
"type": "Document",
"mimeType": "text/html"
}, {
"url": "http://127.0.0.1:8000/sky/tests/inspector/does_not_exist.jpg",
"type": "Image",
"mimeType": "image/unknown"
}]
}
});
});
});
</script>
</html>