| 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 <script type="text/javascript"> | 4 <script type="text/javascript"> |
| 5 | 5 |
| 6 function initialize_ProgressBarTest() | 6 function initialize_ProgressBarTest() |
| 7 { | 7 { |
| 8 | 8 |
| 9 InspectorTest.MockProgressIndicator = function() | 9 InspectorTest.MockProgressIndicator = function() |
| 10 { | 10 { |
| 11 } | 11 } |
| 12 | 12 |
| 13 InspectorTest.MockProgressIndicator.prototype = { | 13 InspectorTest.MockProgressIndicator.prototype = { |
| 14 // Implementation of WebInspector.Progress interface. | 14 // Implementation of Common.Progress interface. |
| 15 isCanceled: function() | 15 isCanceled: function() |
| 16 { | 16 { |
| 17 return this._isCanceled; | 17 return this._isCanceled; |
| 18 }, | 18 }, |
| 19 | 19 |
| 20 done: function() | 20 done: function() |
| 21 { | 21 { |
| 22 InspectorTest.addResult("progress indicator: done"); | 22 InspectorTest.addResult("progress indicator: done"); |
| 23 }, | 23 }, |
| 24 | 24 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 } | 64 } |
| 65 | 65 |
| 66 var test = function() | 66 var test = function() |
| 67 { | 67 { |
| 68 InspectorTest.runTestSuite([ | 68 InspectorTest.runTestSuite([ |
| 69 function testOneSubProgress(next) | 69 function testOneSubProgress(next) |
| 70 { | 70 { |
| 71 var indicator = new InspectorTest.MockProgressIndicator(); | 71 var indicator = new InspectorTest.MockProgressIndicator(); |
| 72 var composite = new WebInspector.CompositeProgress(indicator); | 72 var composite = new Common.CompositeProgress(indicator); |
| 73 var subProgress = composite.createSubProgress(); | 73 var subProgress = composite.createSubProgress(); |
| 74 | 74 |
| 75 InspectorTest.addResult("Testing CompositeProgress with a single sub
progress:"); | 75 InspectorTest.addResult("Testing CompositeProgress with a single sub
progress:"); |
| 76 indicator.dump(); | 76 indicator.dump(); |
| 77 subProgress.setTitle("cuckooing"); | 77 subProgress.setTitle("cuckooing"); |
| 78 subProgress.setWorked(10); | 78 subProgress.setWorked(10); |
| 79 indicator.dump(); | 79 indicator.dump(); |
| 80 subProgress.setTotalWork(100); | 80 subProgress.setTotalWork(100); |
| 81 indicator.dump(); | 81 indicator.dump(); |
| 82 subProgress.setWorked(20, "meowing"); | 82 subProgress.setWorked(20, "meowing"); |
| 83 indicator.dump(); | 83 indicator.dump(); |
| 84 subProgress.done(); | 84 subProgress.done(); |
| 85 indicator.dump(); | 85 indicator.dump(); |
| 86 next(); | 86 next(); |
| 87 }, | 87 }, |
| 88 | 88 |
| 89 function testMultipleSubProgresses(next) | 89 function testMultipleSubProgresses(next) |
| 90 { | 90 { |
| 91 var indicator = new InspectorTest.MockProgressIndicator(); | 91 var indicator = new InspectorTest.MockProgressIndicator(); |
| 92 var composite = new WebInspector.CompositeProgress(indicator); | 92 var composite = new Common.CompositeProgress(indicator); |
| 93 var subProgress1 = composite.createSubProgress(); | 93 var subProgress1 = composite.createSubProgress(); |
| 94 var subProgress2 = composite.createSubProgress(3); | 94 var subProgress2 = composite.createSubProgress(3); |
| 95 | 95 |
| 96 InspectorTest.addResult("Testing CompositeProgress with multiple sub
progresses:"); | 96 InspectorTest.addResult("Testing CompositeProgress with multiple sub
progresses:"); |
| 97 indicator.dump(); | 97 indicator.dump(); |
| 98 | 98 |
| 99 subProgress1.setTitle("cuckooing"); | 99 subProgress1.setTitle("cuckooing"); |
| 100 subProgress1.setTotalWork(100); | 100 subProgress1.setTotalWork(100); |
| 101 subProgress1.setWorked(20); | 101 subProgress1.setWorked(20); |
| 102 indicator.dump(); | 102 indicator.dump(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 116 indicator.dump(); | 116 indicator.dump(); |
| 117 | 117 |
| 118 subProgress1.done(); | 118 subProgress1.done(); |
| 119 indicator.dump(); | 119 indicator.dump(); |
| 120 next(); | 120 next(); |
| 121 }, | 121 }, |
| 122 | 122 |
| 123 function testCancel(next) | 123 function testCancel(next) |
| 124 { | 124 { |
| 125 var indicator = new InspectorTest.MockProgressIndicator(); | 125 var indicator = new InspectorTest.MockProgressIndicator(); |
| 126 var composite = new WebInspector.CompositeProgress(indicator); | 126 var composite = new Common.CompositeProgress(indicator); |
| 127 var subProgress = composite.createSubProgress(); | 127 var subProgress = composite.createSubProgress(); |
| 128 | 128 |
| 129 InspectorTest.addResult("Testing isCanceled:"); | 129 InspectorTest.addResult("Testing isCanceled:"); |
| 130 InspectorTest.assertTrue(!subProgress.isCanceled(), "progress should
not be canceled"); | 130 InspectorTest.assertTrue(!subProgress.isCanceled(), "progress should
not be canceled"); |
| 131 indicator.cancel(); | 131 indicator.cancel(); |
| 132 InspectorTest.assertTrue(subProgress.isCanceled(), "progress should
be canceled"); | 132 InspectorTest.assertTrue(subProgress.isCanceled(), "progress should
be canceled"); |
| 133 next(); | 133 next(); |
| 134 }, | 134 }, |
| 135 | 135 |
| 136 function testNested(next) | 136 function testNested(next) |
| 137 { | 137 { |
| 138 var indicator = new InspectorTest.MockProgressIndicator(); | 138 var indicator = new InspectorTest.MockProgressIndicator(); |
| 139 var composite0 = new WebInspector.CompositeProgress(indicator); | 139 var composite0 = new Common.CompositeProgress(indicator); |
| 140 var subProgress01 = composite0.createSubProgress(); | 140 var subProgress01 = composite0.createSubProgress(); |
| 141 var composite1 = new WebInspector.CompositeProgress(subProgress01); | 141 var composite1 = new Common.CompositeProgress(subProgress01); |
| 142 var subProgress11 = composite1.createSubProgress(10); // Weight shou
ld have no effect. | 142 var subProgress11 = composite1.createSubProgress(10); // Weight shou
ld have no effect. |
| 143 | 143 |
| 144 InspectorTest.addResult("Testing nested subprogresses:"); | 144 InspectorTest.addResult("Testing nested subprogresses:"); |
| 145 indicator.dump(); | 145 indicator.dump(); |
| 146 | 146 |
| 147 subProgress11.setWorked(10); | 147 subProgress11.setWorked(10); |
| 148 indicator.dump(); | 148 indicator.dump(); |
| 149 | 149 |
| 150 subProgress11.setTotalWork(100); | 150 subProgress11.setTotalWork(100); |
| 151 indicator.dump(); | 151 indicator.dump(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 163 } | 163 } |
| 164 ]); | 164 ]); |
| 165 } | 165 } |
| 166 | 166 |
| 167 </script> | 167 </script> |
| 168 </head> | 168 </head> |
| 169 <body onload="runTest()"> | 169 <body onload="runTest()"> |
| 170 <p>Tests inspector's composite progress bar.</p> | 170 <p>Tests inspector's composite progress bar.</p> |
| 171 </body> | 171 </body> |
| 172 </html> | 172 </html> |
| OLD | NEW |