| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 | 4 |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var MockProject = function() {} | 9 var MockProject = function() {} |
| 10 MockProject.prototype.requestFileContent = function(uri, callback) | 10 MockProject.prototype.requestFileContent = function(uri, callback) |
| 11 { | 11 { |
| 12 InspectorTest.addResult("Content is requested from SourceCodeProvider.")
; | 12 InspectorTest.addResult("Content is requested from SourceCodeProvider.")
; |
| 13 setTimeout(callback.bind(null, "var x = 0;"), 0); | 13 setTimeout(callback.bind(null, "var x = 0;"), 0); |
| 14 } | 14 } |
| 15 MockProject.prototype.isServiceProject = function() { return false; }; | 15 MockProject.prototype.isServiceProject = function() { return false; }; |
| 16 MockProject.prototype.type = function() { return WebInspector.projectTypes.D
ebugger; } | 16 MockProject.prototype.type = function() { return WebInspector.projectTypes.D
ebugger; } |
| 17 MockProject.prototype.url = function() { return "mock://debugger-ui/"; } | 17 MockProject.prototype.url = function() { return "mock://debugger-ui/"; } |
| 18 | 18 |
| 19 InspectorTest.runTestSuite([ | 19 InspectorTest.runTestSuite([ |
| 20 function testUISourceCode(next) | 20 function testUISourceCode(next) |
| 21 { | 21 { |
| 22 var uiSourceCode = new WebInspector.UISourceCode(new MockProject(),
"parentPath", "name", "originURL", WebInspector.resourceTypes.Script); | 22 var uiSourceCode = new WebInspector.UISourceCode(new MockProject(),
"originURL", WebInspector.resourceTypes.Script); |
| 23 function didRequestContent(callNumber, content) | 23 function didRequestContent(callNumber, content) |
| 24 { | 24 { |
| 25 InspectorTest.addResult("Callback " + callNumber + " is invoked.
"); | 25 InspectorTest.addResult("Callback " + callNumber + " is invoked.
"); |
| 26 InspectorTest.assertEquals("text/javascript", WebInspector.Netwo
rkProject.uiSourceCodeMimeType(uiSourceCode)); | 26 InspectorTest.assertEquals("text/javascript", WebInspector.Netwo
rkProject.uiSourceCodeMimeType(uiSourceCode)); |
| 27 InspectorTest.assertEquals("var x = 0;", content); | 27 InspectorTest.assertEquals("var x = 0;", content); |
| 28 | 28 |
| 29 if (callNumber === 3) { | 29 if (callNumber === 3) { |
| 30 // Check that sourceCodeProvider.requestContent won't be cal
led anymore. | 30 // Check that sourceCodeProvider.requestContent won't be cal
led anymore. |
| 31 uiSourceCode.requestContent(function(content) | 31 uiSourceCode.requestContent(function(content) |
| 32 { | 32 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 </script> | 47 </script> |
| 48 | 48 |
| 49 </head> | 49 </head> |
| 50 | 50 |
| 51 <body onload="runTest()"> | 51 <body onload="runTest()"> |
| 52 <p>Tests UISourceCode class.</p> | 52 <p>Tests UISourceCode class.</p> |
| 53 </body> | 53 </body> |
| 54 </html> | 54 </html> |
| OLD | NEW |