OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Fixture for startup pages WebUI tests. | 6 * Fixture for startup pages WebUI tests. |
7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 function StartupPageListWebUITest() {} | 10 function StartupPageListWebUITest() {} |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 * @return {!Event} A fake mouse event. | 117 * @return {!Event} A fake mouse event. |
118 */ | 118 */ |
119 function createMouseEvent(type) { | 119 function createMouseEvent(type) { |
120 var event = new MouseEvent(type, {bubbles: true, cancelable: true}); | 120 var event = new MouseEvent(type, {bubbles: true, cancelable: true}); |
121 MockDataTransfer.install(event); | 121 MockDataTransfer.install(event); |
122 return event; | 122 return event; |
123 } | 123 } |
124 | 124 |
125 TEST_F('StartupPageListWebUITest', 'testDropFromOutsideSource', function() { | 125 TEST_F('StartupPageListWebUITest', 'testDropFromOutsideSource', function() { |
126 /** @const */ var NEW_PAGE = 'http://google.com'; | 126 /** @const */ var NEW_PAGE = 'http://google.com'; |
127 | 127 console.warn('VPDBG: 127'); |
128 var mockDropEvent = createMouseEvent('drop'); | 128 var mockDropEvent = createMouseEvent('drop'); |
| 129 console.warn('VPDBG: 129'); |
129 mockDropEvent.dataTransfer.setData('url', NEW_PAGE); | 130 mockDropEvent.dataTransfer.setData('url', NEW_PAGE); |
| 131 console.warn('VPDBG: 131'); |
130 | 132 |
131 this.mockHandler.expects(once()).addStartupPage([NEW_PAGE, 0]); | 133 this.mockHandler.expects(once()).addStartupPage([NEW_PAGE, 0]); |
| 134 console.warn('VPDBG: 134'); |
132 | 135 |
133 this.getList().items[0].dispatchEvent(mockDropEvent); | 136 this.getList().items[0].dispatchEvent(mockDropEvent); |
| 137 console.warn('VPDBG: 137'); |
134 | 138 |
135 expectTrue(mockDropEvent.defaultPrevented); | 139 expectTrue(mockDropEvent.defaultPrevented); |
| 140 console.warn('VPDBG: 140'); |
136 }); | 141 }); |
137 | 142 |
138 TEST_F('StartupPageListWebUITest', 'testDropToReorder', function() { | 143 TEST_F('StartupPageListWebUITest', 'testDropToReorder', function() { |
139 // TODO(dbeam): mock4js doesn't handle complex arguments well. Fix this. | 144 // TODO(dbeam): mock4js doesn't handle complex arguments well. Fix this. |
| 145 console.warn('VPDBG: 145'); |
140 this.mockHandler.expects(once()).dragDropStartupPage([0, [1].join()]); | 146 this.mockHandler.expects(once()).dragDropStartupPage([0, [1].join()]); |
| 147 console.warn('VPDBG: 147'); |
141 | 148 |
142 this.getList().selectionModel.selectedIndex = 1; | 149 this.getList().selectionModel.selectedIndex = 1; |
| 150 console.warn('VPDBG: 150'); |
143 expectEquals(1, this.getList().selectionModel.selectedIndexes.length); | 151 expectEquals(1, this.getList().selectionModel.selectedIndexes.length); |
| 152 console.warn('VPDBG: 152'); |
144 | 153 |
145 this.getList().items[0].dispatchEvent(createMouseEvent('drop')); | 154 this.getList().items[0].dispatchEvent(createMouseEvent('drop')); |
| 155 console.warn('VPDBG: 155'); |
146 }); | 156 }); |
147 | 157 |
148 }()); | 158 }()); |
OLD | NEW |