| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <title>Test search in sources.</title> | 3 <title>Test search in sources.</title> |
| 4 <script src="../inspector-test.js"></script> | 4 <script src="../inspector-test.js"></script> |
| 5 <script src="../isolated-filesystem-test.js"></script> | 5 <script src="../isolated-filesystem-test.js"></script> |
| 6 <script src="../debugger-test.js"></script> | 6 <script src="../debugger-test.js"></script> |
| 7 <script src="./search-test.js"></script> | 7 <script src="./search-test.js"></script> |
| 8 <script> | 8 <script> |
| 9 function test() | 9 function test() |
| 10 { | 10 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 InspectorTest.completeTest(); | 38 InspectorTest.completeTest(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 function onAllResourcesLoaded() | 41 function onAllResourcesLoaded() |
| 42 { | 42 { |
| 43 for (var resourceName in resources) | 43 for (var resourceName in resources) |
| 44 fs.root.addFile(resourceName, resources[resourceName]); | 44 fs.root.addFile(resourceName, resources[resourceName]); |
| 45 fs.reportCreated(fileSystemCreated); | 45 fs.reportCreated(fileSystemCreated); |
| 46 } | 46 } |
| 47 | 47 |
| 48 function fileSystemCreated() | 48 async function fileSystemCreated() |
| 49 { | 49 { |
| 50 UI.viewManager.showView("sources.search"); | 50 UI.viewManager.showView("sources.search"); |
| 51 | 51 |
| 52 var uiSourceCodes = fileSystemUISourceCodes(); | 52 var uiSourceCodes = fileSystemUISourceCodes(); |
| 53 for (var i = 0; i < uiSourceCodes.length; ++i) { | 53 for (var i = 0; i < uiSourceCodes.length; ++i) { |
| 54 if (uiSourceCodes[i].name() === "search.js") { | 54 if (uiSourceCodes[i].name() === "search.js") { |
| 55 jsFileSystemUISourceCode = uiSourceCodes[i]; | 55 jsFileSystemUISourceCode = uiSourceCodes[i]; |
| 56 break; | 56 break; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 addNetworkUISourceCode("http://localhost/search.html", resources["search
.html"]); | 60 await InspectorTest.addScriptUISourceCode("http://localhost/search.html"
, resources["search.html"]); |
| 61 jsNetworkUISourceCode = addNetworkUISourceCode("http://localhost/search.
js", resources["search.js"]); | 61 jsNetworkUISourceCode = await InspectorTest.addScriptUISourceCode("http:
//localhost/search.js", resources["search.js"]); |
| 62 InspectorTest.runTestSuite(testSuite); | 62 InspectorTest.runTestSuite(testSuite); |
| 63 } | 63 } |
| 64 | 64 |
| 65 function loadResource(name) | 65 function loadResource(name) |
| 66 { | 66 { |
| 67 var urlPrefix = InspectorTest.mainTarget.inspectedURL().substr(0, Inspec
torTest.mainTarget.inspectedURL().lastIndexOf("/") + 1); | 67 var urlPrefix = InspectorTest.mainTarget.inspectedURL().substr(0, Inspec
torTest.mainTarget.inspectedURL().lastIndexOf("/") + 1); |
| 68 var url = urlPrefix + "resources/" + name; | 68 var url = urlPrefix + "resources/" + name; |
| 69 return Runtime.loadResourcePromise(url).then(function(text) { | 69 return Runtime.loadResourcePromise(url).then(function(text) { |
| 70 resources[name] = text; | 70 resources[name] = text; |
| 71 }); | 71 }); |
| 72 } | 72 } |
| 73 | 73 |
| 74 function addNetworkUISourceCode(url, content) | |
| 75 { | |
| 76 var contentProvider = Common.StaticContentProvider.fromString(url, Commo
n.resourceTypes.Script, content); | |
| 77 var networkProject = Bindings.NetworkProject.forTarget(SDK.targetManager
.mainTarget()); | |
| 78 var uiSourceCode = networkProject.addFile(contentProvider, InspectorTest
.mainFrame(), false); | |
| 79 return uiSourceCode; | |
| 80 } | |
| 81 | |
| 82 InspectorFrontendHost.searchInPath = function(requestId, path, query) | 74 InspectorFrontendHost.searchInPath = function(requestId, path, query) |
| 83 { | 75 { |
| 84 setTimeout(reply); | 76 setTimeout(reply); |
| 85 | 77 |
| 86 function reply() | 78 function reply() |
| 87 { | 79 { |
| 88 var paths = []; | 80 var paths = []; |
| 89 for (var i = 0; i < names.length; ++i) | 81 for (var i = 0; i < names.length; ++i) |
| 90 paths.push("/var/www/" + names[i]); | 82 paths.push("/var/www/" + names[i]); |
| 91 Workspace.isolatedFileSystemManager._onSearchCompleted({data: {reque
stId: requestId, fileSystemPath: path, files: paths}}); | 83 Workspace.isolatedFileSystemManager._onSearchCompleted({data: {reque
stId: requestId, fileSystemPath: path, files: paths}}); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 } | 103 } |
| 112 ]; | 104 ]; |
| 113 } | 105 } |
| 114 | 106 |
| 115 </script> | 107 </script> |
| 116 </head> | 108 </head> |
| 117 <body onload="runTest()"> | 109 <body onload="runTest()"> |
| 118 <p>Tests that ScriptSearchScope sorts network and dirty results correctly.</p> | 110 <p>Tests that ScriptSearchScope sorts network and dirty results correctly.</p> |
| 119 </body> | 111 </body> |
| 120 </html> | 112 </html> |
| OLD | NEW |