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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/uisourcecode-revisions.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 <script src="../http/tests/inspector/inspector-test.js"></script> 3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script src="../http/tests/inspector/sources-test.js"></script> 4 <script src="../http/tests/inspector/sources-test.js"></script>
5 <script> 5 <script>
6 function test() 6 function test()
7 { 7 {
8 var mockProjectId = 0; 8 var mockProjectId = 0;
9 function createMockProject() 9 function createMockProject()
10 { 10 {
11 var workspace = new WebInspector.Workspace(); 11 var workspace = new Workspace.Workspace();
12 var project = new WebInspector.ContentProviderBasedProject(workspace, "m ockProject:" + (++mockProjectId)); 12 var project = new Bindings.ContentProviderBasedProject(workspace, "mockP roject:" + (++mockProjectId));
13 project.requestFileContent = function(uri, callback) 13 project.requestFileContent = function(uri, callback)
14 { 14 {
15 callback("<script content>"); 15 callback("<script content>");
16 } 16 }
17 project.setFileContent = function(uri, newContent, callback) 17 project.setFileContent = function(uri, newContent, callback)
18 { 18 {
19 } 19 }
20 return project; 20 return project;
21 } 21 }
22 22
23 function dumpUISourceCodeWithRevisions(uiSourceCode) 23 function dumpUISourceCodeWithRevisions(uiSourceCode)
24 { 24 {
25 var content = uiSourceCode._content; 25 var content = uiSourceCode._content;
26 var revisionsString = ""; 26 var revisionsString = "";
27 for (var i = 0; i < uiSourceCode.history.length; ++i) { 27 for (var i = 0; i < uiSourceCode.history.length; ++i) {
28 var revision = uiSourceCode.history[i]; 28 var revision = uiSourceCode.history[i];
29 if (i !== 0) 29 if (i !== 0)
30 revisionsString += ", "; 30 revisionsString += ", ";
31 revisionsString += "'" + revision.content + "'"; 31 revisionsString += "'" + revision.content + "'";
32 } 32 }
33 InspectorTest.addResult("UISourceCode content: " + content); 33 InspectorTest.addResult("UISourceCode content: " + content);
34 InspectorTest.addResult(" revisions: " + revisionsString); 34 InspectorTest.addResult(" revisions: " + revisionsString);
35 } 35 }
36 36
37 InspectorTest.runTestSuite([ 37 InspectorTest.runTestSuite([
38 function testAddRevisionsRevertToOriginal(next) 38 function testAddRevisionsRevertToOriginal(next)
39 { 39 {
40 var uiSourceCode = new WebInspector.UISourceCode(createMockProject() , "url", WebInspector.resourceTypes.Script); 40 var uiSourceCode = new Workspace.UISourceCode(createMockProject(), " url", Common.resourceTypes.Script);
41 uiSourceCode.setWorkingCopy("content1"); 41 uiSourceCode.setWorkingCopy("content1");
42 uiSourceCode.setWorkingCopy("content2"); 42 uiSourceCode.setWorkingCopy("content2");
43 uiSourceCode.commitWorkingCopy(function() { }); 43 uiSourceCode.commitWorkingCopy(function() { });
44 44
45 InspectorTest.addResult("First revision added."); 45 InspectorTest.addResult("First revision added.");
46 dumpUISourceCodeWithRevisions(uiSourceCode); 46 dumpUISourceCodeWithRevisions(uiSourceCode);
47 uiSourceCode.setWorkingCopy("content3"); 47 uiSourceCode.setWorkingCopy("content3");
48 uiSourceCode.setWorkingCopy("content4"); 48 uiSourceCode.setWorkingCopy("content4");
49 uiSourceCode.commitWorkingCopy(function() { }); 49 uiSourceCode.commitWorkingCopy(function() { });
50 50
51 InspectorTest.addResult("Second revision added."); 51 InspectorTest.addResult("Second revision added.");
52 dumpUISourceCodeWithRevisions(uiSourceCode); 52 dumpUISourceCodeWithRevisions(uiSourceCode);
53 uiSourceCode.revertToOriginal().then(onReverted); 53 uiSourceCode.revertToOriginal().then(onReverted);
54 54
55 function onReverted() 55 function onReverted()
56 { 56 {
57 InspectorTest.addResult("Reverted to original."); 57 InspectorTest.addResult("Reverted to original.");
58 dumpUISourceCodeWithRevisions(uiSourceCode); 58 dumpUISourceCodeWithRevisions(uiSourceCode);
59 next(); 59 next();
60 } 60 }
61 }, 61 },
62 62
63 function testAddRevisionsRevertAndClearHistory(next) 63 function testAddRevisionsRevertAndClearHistory(next)
64 { 64 {
65 var uiSourceCode = new WebInspector.UISourceCode(createMockProject() , "url2", WebInspector.resourceTypes.Script); 65 var uiSourceCode = new Workspace.UISourceCode(createMockProject(), " url2", Common.resourceTypes.Script);
66 66
67 uiSourceCode.setWorkingCopy("content1"); 67 uiSourceCode.setWorkingCopy("content1");
68 uiSourceCode.setWorkingCopy("content2"); 68 uiSourceCode.setWorkingCopy("content2");
69 uiSourceCode.commitWorkingCopy(function() { }); 69 uiSourceCode.commitWorkingCopy(function() { });
70 70
71 InspectorTest.addResult("First revision added."); 71 InspectorTest.addResult("First revision added.");
72 dumpUISourceCodeWithRevisions(uiSourceCode); 72 dumpUISourceCodeWithRevisions(uiSourceCode);
73 uiSourceCode.setWorkingCopy("content3"); 73 uiSourceCode.setWorkingCopy("content3");
74 uiSourceCode.setWorkingCopy("content4"); 74 uiSourceCode.setWorkingCopy("content4");
75 uiSourceCode.commitWorkingCopy(function() { }); 75 uiSourceCode.commitWorkingCopy(function() { });
76 76
77 InspectorTest.addResult("Second revision added."); 77 InspectorTest.addResult("Second revision added.");
78 dumpUISourceCodeWithRevisions(uiSourceCode); 78 dumpUISourceCodeWithRevisions(uiSourceCode);
79 uiSourceCode.revertAndClearHistory(revertedAndClearedHistory); 79 uiSourceCode.revertAndClearHistory(revertedAndClearedHistory);
80 80
81 function revertedAndClearedHistory() 81 function revertedAndClearedHistory()
82 { 82 {
83 InspectorTest.addResult("Reverted and cleared history."); 83 InspectorTest.addResult("Reverted and cleared history.");
84 dumpUISourceCodeWithRevisions(uiSourceCode); 84 dumpUISourceCodeWithRevisions(uiSourceCode);
85 next(); 85 next();
86 } 86 }
87 }, 87 },
88 88
89 function testAddRevisionsRevertToPrevious(next) 89 function testAddRevisionsRevertToPrevious(next)
90 { 90 {
91 var uiSourceCode = new WebInspector.UISourceCode(createMockProject() , "url3", WebInspector.resourceTypes.Script); 91 var uiSourceCode = new Workspace.UISourceCode(createMockProject(), " url3", Common.resourceTypes.Script);
92 92
93 uiSourceCode.setWorkingCopy("content1"); 93 uiSourceCode.setWorkingCopy("content1");
94 uiSourceCode.setWorkingCopy("content2"); 94 uiSourceCode.setWorkingCopy("content2");
95 uiSourceCode.commitWorkingCopy(function() { }); 95 uiSourceCode.commitWorkingCopy(function() { });
96 96
97 InspectorTest.addResult("First revision added."); 97 InspectorTest.addResult("First revision added.");
98 dumpUISourceCodeWithRevisions(uiSourceCode); 98 dumpUISourceCodeWithRevisions(uiSourceCode);
99 uiSourceCode.setWorkingCopy("content3"); 99 uiSourceCode.setWorkingCopy("content3");
100 uiSourceCode.setWorkingCopy("content4"); 100 uiSourceCode.setWorkingCopy("content4");
101 uiSourceCode.commitWorkingCopy(function() { }); 101 uiSourceCode.commitWorkingCopy(function() { });
102 102
103 InspectorTest.addResult("Second revision added."); 103 InspectorTest.addResult("Second revision added.");
104 dumpUISourceCodeWithRevisions(uiSourceCode); 104 dumpUISourceCodeWithRevisions(uiSourceCode);
105 uiSourceCode.history[0].revertToThis().then(onReverted); 105 uiSourceCode.history[0].revertToThis().then(onReverted);
106 106
107 function onReverted() 107 function onReverted()
108 { 108 {
109 InspectorTest.addResult("Reverted to previous revision."); 109 InspectorTest.addResult("Reverted to previous revision.");
110 dumpUISourceCodeWithRevisions(uiSourceCode); 110 dumpUISourceCodeWithRevisions(uiSourceCode);
111 next(); 111 next();
112 } 112 }
113 }, 113 },
114 114
115 function testRequestContentAddRevisionsRevertToOriginal(next) 115 function testRequestContentAddRevisionsRevertToOriginal(next)
116 { 116 {
117 var uiSourceCode = new WebInspector.UISourceCode(createMockProject() , "url4", WebInspector.resourceTypes.Script); 117 var uiSourceCode = new Workspace.UISourceCode(createMockProject(), " url4", Common.resourceTypes.Script);
118 uiSourceCode.requestContent().then(contentReceived); 118 uiSourceCode.requestContent().then(contentReceived);
119 119
120 function contentReceived() 120 function contentReceived()
121 { 121 {
122 InspectorTest.addResult("Content requested."); 122 InspectorTest.addResult("Content requested.");
123 dumpUISourceCodeWithRevisions(uiSourceCode); 123 dumpUISourceCodeWithRevisions(uiSourceCode);
124 uiSourceCode.setWorkingCopy("content1"); 124 uiSourceCode.setWorkingCopy("content1");
125 uiSourceCode.setWorkingCopy("content2"); 125 uiSourceCode.setWorkingCopy("content2");
126 uiSourceCode.commitWorkingCopy(function() { }); 126 uiSourceCode.commitWorkingCopy(function() { });
127 127
(...skipping 11 matching lines...) Expand all
139 { 139 {
140 InspectorTest.addResult("Reverted to original."); 140 InspectorTest.addResult("Reverted to original.");
141 dumpUISourceCodeWithRevisions(uiSourceCode); 141 dumpUISourceCodeWithRevisions(uiSourceCode);
142 next(); 142 next();
143 } 143 }
144 } 144 }
145 }, 145 },
146 146
147 function testRequestContentAddRevisionsRevertAndClearHistory(next) 147 function testRequestContentAddRevisionsRevertAndClearHistory(next)
148 { 148 {
149 var uiSourceCode = new WebInspector.UISourceCode(createMockProject() , "url5", WebInspector.resourceTypes.Script); 149 var uiSourceCode = new Workspace.UISourceCode(createMockProject(), " url5", Common.resourceTypes.Script);
150 uiSourceCode.requestContent().then(contentReceived); 150 uiSourceCode.requestContent().then(contentReceived);
151 151
152 function contentReceived() 152 function contentReceived()
153 { 153 {
154 InspectorTest.addResult("Content requested."); 154 InspectorTest.addResult("Content requested.");
155 dumpUISourceCodeWithRevisions(uiSourceCode); 155 dumpUISourceCodeWithRevisions(uiSourceCode);
156 uiSourceCode.setWorkingCopy("content1"); 156 uiSourceCode.setWorkingCopy("content1");
157 uiSourceCode.setWorkingCopy("content2"); 157 uiSourceCode.setWorkingCopy("content2");
158 uiSourceCode.commitWorkingCopy(function() { }); 158 uiSourceCode.commitWorkingCopy(function() { });
159 159
(...skipping 11 matching lines...) Expand all
171 { 171 {
172 InspectorTest.addResult("Reverted and cleared history."); 172 InspectorTest.addResult("Reverted and cleared history.");
173 dumpUISourceCodeWithRevisions(uiSourceCode); 173 dumpUISourceCodeWithRevisions(uiSourceCode);
174 next(); 174 next();
175 } 175 }
176 } 176 }
177 }, 177 },
178 178
179 function testRequestContentAddRevisionsRevertToPrevious(next) 179 function testRequestContentAddRevisionsRevertToPrevious(next)
180 { 180 {
181 var uiSourceCode = new WebInspector.UISourceCode(createMockProject() , "url6", WebInspector.resourceTypes.Script); 181 var uiSourceCode = new Workspace.UISourceCode(createMockProject(), " url6", Common.resourceTypes.Script);
182 uiSourceCode.requestContent().then(contentReceived); 182 uiSourceCode.requestContent().then(contentReceived);
183 183
184 function contentReceived() 184 function contentReceived()
185 { 185 {
186 InspectorTest.addResult("Content requested."); 186 InspectorTest.addResult("Content requested.");
187 dumpUISourceCodeWithRevisions(uiSourceCode); 187 dumpUISourceCodeWithRevisions(uiSourceCode);
188 uiSourceCode.setWorkingCopy("content1"); 188 uiSourceCode.setWorkingCopy("content1");
189 uiSourceCode.setWorkingCopy("content2"); 189 uiSourceCode.setWorkingCopy("content2");
190 uiSourceCode.commitWorkingCopy(function() { }); 190 uiSourceCode.commitWorkingCopy(function() { });
191 191
(...skipping 17 matching lines...) Expand all
209 }, 209 },
210 ]); 210 ]);
211 } 211 }
212 </script> 212 </script>
213 </head> 213 </head>
214 <body onload="runTest()"> 214 <body onload="runTest()">
215 <p>Tests revision support in UISourceCode.</p> 215 <p>Tests revision support in UISourceCode.</p>
216 <a href="https://bugs.webkit.org/show_bug.cgi?id=97669">Bug 97669</a> 216 <a href="https://bugs.webkit.org/show_bug.cgi?id=97669">Bug 97669</a>
217 </body> 217 </body>
218 </html> 218 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698