Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/search/sources-search-scope-many-projects.html

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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="../workspace-test.js"></script> 6 <script src="../workspace-test.js"></script>
7 <script src="../debugger-test.js"></script> 7 <script src="../debugger-test.js"></script>
8 <script src="./search-test.js"></script> 8 <script src="./search-test.js"></script>
9 <script> 9 <script>
10 function test() 10 function test()
11 { 11 {
12 var scope = new WebInspector.SourcesSearchScope(); 12 var scope = new Sources.SourcesSearchScope();
13 var fs = new InspectorTest.TestFileSystem("file:///var/www"); 13 var fs = new InspectorTest.TestFileSystem("file:///var/www");
14 var names = ["search.html", "search.js", "search.css"]; 14 var names = ["search.html", "search.js", "search.css"];
15 var resources = {}; 15 var resources = {};
16 var jsFileSystemUISourceCode; 16 var jsFileSystemUISourceCode;
17 var jsNetworkUISourceCode; 17 var jsNetworkUISourceCode;
18 18
19 var promises = []; 19 var promises = [];
20 for (var name of names) 20 for (var name of names)
21 promises.push(loadResource(name)); 21 promises.push(loadResource(name));
22 22
23 Promise.all(promises) 23 Promise.all(promises)
24 .then(onAllResourcesLoaded) 24 .then(onAllResourcesLoaded)
25 .catch(onResourceError); 25 .catch(onResourceError);
26 26
27 function onResourceError(error) 27 function onResourceError(error)
28 { 28 {
29 InspectorTest.addResult("ERROR while loading resources: " + error.messag e); 29 InspectorTest.addResult("ERROR while loading resources: " + error.messag e);
30 InspectorTest.completeTest(); 30 InspectorTest.completeTest();
31 } 31 }
32 32
33 function onAllResourcesLoaded() 33 function onAllResourcesLoaded()
34 { 34 {
35 for (var resourceName in resources) 35 for (var resourceName in resources)
36 fs.root.addFile(resourceName, resources[resourceName]); 36 fs.root.addFile(resourceName, resources[resourceName]);
37 fs.reportCreated(fileSystemCreated); 37 fs.reportCreated(fileSystemCreated);
38 } 38 }
39 39
40 function fileSystemCreated() 40 function fileSystemCreated()
41 { 41 {
42 WebInspector.viewManager.showView("sources.search"); 42 UI.viewManager.showView("sources.search");
43 43
44 var uiSourceCodes = InspectorTest.fileSystemUISourceCodes(); 44 var uiSourceCodes = InspectorTest.fileSystemUISourceCodes();
45 for (var i = 0; i < uiSourceCodes.length; ++i) { 45 for (var i = 0; i < uiSourceCodes.length; ++i) {
46 if (uiSourceCodes[i].name() === "search.js") { 46 if (uiSourceCodes[i].name() === "search.js") {
47 jsFileSystemUISourceCode = uiSourceCodes[i]; 47 jsFileSystemUISourceCode = uiSourceCodes[i];
48 break; 48 break;
49 } 49 }
50 } 50 }
51 51
52 addNetworkUISourceCode("http://localhost/search.html", resources["search .html"]); 52 addNetworkUISourceCode("http://localhost/search.html", resources["search .html"]);
53 jsNetworkUISourceCode = addNetworkUISourceCode("http://localhost/search. js", resources["search.js"]); 53 jsNetworkUISourceCode = addNetworkUISourceCode("http://localhost/search. js", resources["search.js"]);
54 InspectorTest.runTestSuite(testSuite); 54 InspectorTest.runTestSuite(testSuite);
55 } 55 }
56 56
57 function loadResource(name) 57 function loadResource(name)
58 { 58 {
59 var urlPrefix = InspectorTest.mainTarget.inspectedURL().substr(0, Inspec torTest.mainTarget.inspectedURL().lastIndexOf("/") + 1); 59 var urlPrefix = InspectorTest.mainTarget.inspectedURL().substr(0, Inspec torTest.mainTarget.inspectedURL().lastIndexOf("/") + 1);
60 var url = urlPrefix + "resources/" + name; 60 var url = urlPrefix + "resources/" + name;
61 return Runtime.loadResourcePromise(url).then(function(text) { 61 return Runtime.loadResourcePromise(url).then(function(text) {
62 resources[name] = text; 62 resources[name] = text;
63 }); 63 });
64 } 64 }
65 65
66 function addNetworkUISourceCode(url, content) 66 function addNetworkUISourceCode(url, content)
67 { 67 {
68 var contentProvider = WebInspector.StaticContentProvider.fromString(url, WebInspector.resourceTypes.Script, content); 68 var contentProvider = Common.StaticContentProvider.fromString(url, Commo n.resourceTypes.Script, content);
69 var networkProject = WebInspector.NetworkProject.forTarget(WebInspector. targetManager.mainTarget()); 69 var networkProject = Bindings.NetworkProject.forTarget(SDK.targetManager .mainTarget());
70 var uiSourceCode = networkProject.addFile(contentProvider, InspectorTest .mainFrame(), false); 70 var uiSourceCode = networkProject.addFile(contentProvider, InspectorTest .mainFrame(), false);
71 return uiSourceCode; 71 return uiSourceCode;
72 } 72 }
73 73
74 InspectorFrontendHost.searchInPath = function(requestId, path, query) 74 InspectorFrontendHost.searchInPath = function(requestId, path, query)
75 { 75 {
76 setTimeout(reply); 76 setTimeout(reply);
77 77
78 function reply() 78 function reply()
79 { 79 {
80 var paths = []; 80 var paths = [];
81 for (var i = 0; i < names.length; ++i) 81 for (var i = 0; i < names.length; ++i)
82 paths.push("/var/www/" + names[i]); 82 paths.push("/var/www/" + names[i]);
83 WebInspector.isolatedFileSystemManager._onSearchCompleted({data: {re questId: requestId, fileSystemPath: path, files: paths}}); 83 Workspace.isolatedFileSystemManager._onSearchCompleted({data: {reque stId: requestId, fileSystemPath: path, files: paths}});
84 } 84 }
85 } 85 }
86 86
87 var testSuite = [ 87 var testSuite = [
88 function testSearch(next) 88 function testSearch(next)
89 { 89 {
90 var query = "searchTest" + "UniqueString"; 90 var query = "searchTest" + "UniqueString";
91 var searchConfig = new WebInspector.SearchConfig(query, true, false) ; 91 var searchConfig = new Workspace.SearchConfig(query, true, false);
92 InspectorTest.runSearchAndDumpResults(scope, searchConfig, false, ne xt); 92 InspectorTest.runSearchAndDumpResults(scope, searchConfig, false, ne xt);
93 }, 93 },
94 94
95 function testDirtyFiles(next) 95 function testDirtyFiles(next)
96 { 96 {
97 jsFileSystemUISourceCode.setWorkingCopy("FOO " + "searchTest" + "Uni queString" + " BAR"); 97 jsFileSystemUISourceCode.setWorkingCopy("FOO " + "searchTest" + "Uni queString" + " BAR");
98 jsNetworkUISourceCode.setWorkingCopy("FOO " + "searchTest" + "Unique String" + " BAR"); 98 jsNetworkUISourceCode.setWorkingCopy("FOO " + "searchTest" + "Unique String" + " BAR");
99 99
100 var query = "searchTest" + "UniqueString"; 100 var query = "searchTest" + "UniqueString";
101 var searchConfig = new WebInspector.SearchConfig(query, true, false) ; 101 var searchConfig = new Workspace.SearchConfig(query, true, false);
102 InspectorTest.runSearchAndDumpResults(scope, searchConfig, false, ne xt); 102 InspectorTest.runSearchAndDumpResults(scope, searchConfig, false, ne xt);
103 } 103 }
104 ]; 104 ];
105 } 105 }
106 106
107 </script> 107 </script>
108 </head> 108 </head>
109 <body onload="runTest()"> 109 <body onload="runTest()">
110 <p>Tests that ScriptSearchScope sorts network and dirty results correctly.</p> 110 <p>Tests that ScriptSearchScope sorts network and dirty results correctly.</p>
111 </body> 111 </body>
112 </html> 112 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698