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> | 4 <script> |
5 | 5 |
6 function test() | 6 function test() |
7 { | 7 { |
8 function TestWidget(widgetName) | 8 var TestWidget = class extends WebInspector.Widget { |
9 { | 9 constructor(widgetName) |
10 WebInspector.Widget.call(this); | 10 { |
| 11 super(); |
| 12 this._widgetName = widgetName; |
| 13 this._processWillShowCount = 0; |
| 14 this._processWasHiddenCount = 0; |
| 15 InspectorTest.addResult(this._widgetName + "()"); |
| 16 } |
11 | 17 |
12 this._widgetName = widgetName; | 18 _processWillShow() |
13 this._processWillShowCount = 0; | |
14 this._processWasHiddenCount = 0; | |
15 InspectorTest.addResult(this._widgetName + "()"); | |
16 } | |
17 | |
18 TestWidget.prototype = { | |
19 _processWillShow: function() | |
20 { | 19 { |
21 InspectorTest.assertEquals(this._processWillShowCount, this._process
WasHiddenCount); | 20 InspectorTest.assertEquals(this._processWillShowCount, this._process
WasHiddenCount); |
22 WebInspector.Widget.prototype._processWillShow.call(this); | 21 super._processWillShow(); |
23 ++this._processWillShowCount; | 22 ++this._processWillShowCount; |
24 }, | 23 } |
25 | 24 |
26 _processWasHidden: function() | 25 _processWasHidden() |
27 { | 26 { |
28 WebInspector.Widget.prototype._processWasHidden.call(this); | 27 super._processWasHidden(); |
29 ++this._processWasHiddenCount; | 28 ++this._processWasHiddenCount; |
30 InspectorTest.assertEquals(this._processWillShowCount, this._process
WasHiddenCount); | 29 InspectorTest.assertEquals(this._processWillShowCount, this._process
WasHiddenCount); |
31 }, | 30 } |
32 | 31 |
33 show: function(parentElement) | 32 show(parentElement) |
34 { | 33 { |
35 InspectorTest.addResult(this._widgetName + ".show()"); | 34 InspectorTest.addResult(this._widgetName + ".show()"); |
36 WebInspector.Widget.prototype.show.call(this, parentElement); | 35 super.show(parentElement); |
37 }, | 36 } |
38 | 37 |
39 detach: function() | 38 detach() |
40 { | 39 { |
41 InspectorTest.addResult(this._widgetName + ".detach()"); | 40 InspectorTest.addResult(this._widgetName + ".detach()"); |
42 WebInspector.Widget.prototype.detach.call(this); | 41 super.detach(); |
43 }, | 42 } |
44 | 43 |
45 doResize: function() | 44 doResize() |
46 { | 45 { |
47 InspectorTest.addResult(this._widgetName + ".doResize()"); | 46 InspectorTest.addResult(this._widgetName + ".doResize()"); |
48 WebInspector.Widget.prototype.doResize.call(this); | 47 super.doResize(); |
49 }, | 48 } |
50 | 49 |
51 wasShown: function() | 50 wasShown() |
52 { | 51 { |
53 InspectorTest.addResult(" " + this._widgetName + ".wasShown()"); | 52 InspectorTest.addResult(" " + this._widgetName + ".wasShown()"); |
54 if (this.showOnWasShown) | 53 if (this.showOnWasShown) |
55 this.showOnWasShown.show(this.showRoot || this.element); | 54 this.showOnWasShown.show(this.showRoot || this.element); |
56 if (this.detachOnWasShown) | 55 if (this.detachOnWasShown) |
57 this.detachOnWasShown.detach(); | 56 this.detachOnWasShown.detach(); |
58 if (this.resizeOnWasShown) | 57 if (this.resizeOnWasShown) |
59 this.resizeOnWasShown.doResize(); | 58 this.resizeOnWasShown.doResize(); |
60 }, | 59 } |
61 | 60 |
62 willHide: function() | 61 willHide() |
63 { | 62 { |
64 InspectorTest.addResult(" " + this._widgetName + ".willHide()"); | 63 InspectorTest.addResult(" " + this._widgetName + ".willHide()"); |
65 if (this.showOnWillHide) | 64 if (this.showOnWillHide) |
66 this.showOnWillHide.show(this.element); | 65 this.showOnWillHide.show(this.element); |
67 if (this.detachOnWillHide) | 66 if (this.detachOnWillHide) |
68 this.detachOnWillHide.detach(); | 67 this.detachOnWillHide.detach(); |
69 }, | 68 } |
70 | 69 |
71 onResize: function() | 70 onResize() |
72 { | 71 { |
73 InspectorTest.addResult(" " + this._widgetName + ".onResize()"); | 72 InspectorTest.addResult(" " + this._widgetName + ".onResize()"); |
74 } | 73 } |
75 }; | 74 }; |
76 | 75 |
77 TestWidget.prototype.__proto__ = WebInspector.Widget.prototype; | |
78 | |
79 InspectorTest.runTestSuite([ | 76 InspectorTest.runTestSuite([ |
80 function testShowWidget(next) | 77 function testShowWidget(next) |
81 { | 78 { |
82 var widget = new TestWidget("Widget"); | 79 var widget = new TestWidget("Widget"); |
83 widget.show(WebInspector.inspectorView.element); | 80 widget.show(WebInspector.inspectorView.element); |
84 widget.detach(); | 81 widget.detach(); |
85 next(); | 82 next(); |
86 }, | 83 }, |
87 | 84 |
88 function testAppendViaDOM(next) | 85 function testAppendViaDOM(next) |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 </script> | 371 </script> |
375 </head> | 372 </head> |
376 | 373 |
377 <body onload="runTest()"> | 374 <body onload="runTest()"> |
378 <p> | 375 <p> |
379 This tests that events are properly propagated through Widget hierarchy. | 376 This tests that events are properly propagated through Widget hierarchy. |
380 </p> | 377 </p> |
381 | 378 |
382 </body> | 379 </body> |
383 </html> | 380 </html> |
OLD | NEW |