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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/ui-source-code.html

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline Created 4 years, 11 months 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 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)
(...skipping 10 matching lines...) Expand all
21 { 21 {
22 var uiSourceCode = new WebInspector.UISourceCode(new MockProject(), "url", WebInspector.resourceTypes.Script); 22 var uiSourceCode = new WebInspector.UISourceCode(new MockProject(), "url", 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().then(function(content)
32 { 32 {
33 InspectorTest.assertEquals("text/javascript", WebInspect or.NetworkProject.uiSourceCodeMimeType(uiSourceCode)); 33 InspectorTest.assertEquals("text/javascript", WebInspect or.NetworkProject.uiSourceCodeMimeType(uiSourceCode));
34 InspectorTest.assertEquals("var x = 0;", content); 34 InspectorTest.assertEquals("var x = 0;", content);
35 next(); 35 next();
36 }); 36 });
37 } 37 }
38 } 38 }
39 // Check that all callbacks will be invoked. 39 // Check that all callbacks will be invoked.
40 uiSourceCode.requestContent(didRequestContent.bind(null, 1)); 40 uiSourceCode.requestContent().then(didRequestContent.bind(null, 1));
41 uiSourceCode.requestContent(didRequestContent.bind(null, 2)); 41 uiSourceCode.requestContent().then(didRequestContent.bind(null, 2));
42 uiSourceCode.requestContent(didRequestContent.bind(null, 3)); 42 uiSourceCode.requestContent().then(didRequestContent.bind(null, 3));
43 } 43 }
44 ]); 44 ]);
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698