Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / ui-source-code.html
blob810ce1334863f4e7314839c995cbd5189ee16bdb
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
5 <script>
7 function test()
9 var MockProject = function() {}
10 MockProject.prototype.requestFileContent = function(uri, callback)
12 InspectorTest.addResult("Content is requested from SourceCodeProvider.");
13 setTimeout(callback.bind(null, "var x = 0;"), 0);
15 MockProject.prototype.isServiceProject = function() { return false; };
16 MockProject.prototype.type = function() { return WebInspector.projectTypes.Debugger; }
18 InspectorTest.runTestSuite([
19 function testUISourceCode(next)
21 var uiSourceCode = new WebInspector.UISourceCode(new MockProject(), "parentPath", "name", "originURL", "url", WebInspector.resourceTypes.Script);
22 function didRequestContent(callNumber, content)
24 InspectorTest.addResult("Callback " + callNumber + " is invoked.");
25 InspectorTest.assertEquals("text/javascript", WebInspector.SourcesView.uiSourceCodeHighlighterType(uiSourceCode));
26 InspectorTest.assertEquals("var x = 0;", content);
28 if (callNumber === 3) {
29 // Check that sourceCodeProvider.requestContent won't be called anymore.
30 uiSourceCode.requestContent(function(content)
32 InspectorTest.assertEquals("text/javascript", WebInspector.SourcesView.uiSourceCodeHighlighterType(uiSourceCode));
33 InspectorTest.assertEquals("var x = 0;", content);
34 next();
35 });
38 // Check that all callbacks will be invoked.
39 uiSourceCode.requestContent(didRequestContent.bind(null, 1));
40 uiSourceCode.requestContent(didRequestContent.bind(null, 2));
41 uiSourceCode.requestContent(didRequestContent.bind(null, 3));
43 ]);
46 </script>
48 </head>
50 <body onload="runTest()">
51 <p>Tests UISourceCode class.</p>
52 </body>
53 </html>