| 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 console.warn('VPDBG: 127'); | 127 |
| 128 var mockDropEvent = createMouseEvent('drop'); | 128 var mockDropEvent = createMouseEvent('drop'); |
| 129 console.warn('VPDBG: 129'); | |
| 130 mockDropEvent.dataTransfer.setData('url', NEW_PAGE); | 129 mockDropEvent.dataTransfer.setData('url', NEW_PAGE); |
| 131 console.warn('VPDBG: 131'); | |
| 132 | 130 |
| 133 this.mockHandler.expects(once()).addStartupPage([NEW_PAGE, 0]); | 131 this.mockHandler.expects(once()).addStartupPage([NEW_PAGE, 0]); |
| 134 console.warn('VPDBG: 134'); | |
| 135 | 132 |
| 136 this.getList().items[0].dispatchEvent(mockDropEvent); | 133 this.getList().items[0].dispatchEvent(mockDropEvent); |
| 137 console.warn('VPDBG: 137'); | |
| 138 | 134 |
| 139 expectTrue(mockDropEvent.defaultPrevented); | 135 expectTrue(mockDropEvent.defaultPrevented); |
| 140 console.warn('VPDBG: 140'); | |
| 141 }); | 136 }); |
| 142 | 137 |
| 143 TEST_F('StartupPageListWebUITest', 'testDropToReorder', function() { | 138 TEST_F('StartupPageListWebUITest', 'testDropToReorder', function() { |
| 144 // TODO(dbeam): mock4js doesn't handle complex arguments well. Fix this. | 139 // TODO(dbeam): mock4js doesn't handle complex arguments well. Fix this. |
| 145 console.warn('VPDBG: 145'); | |
| 146 this.mockHandler.expects(once()).dragDropStartupPage([0, [1].join()]); | 140 this.mockHandler.expects(once()).dragDropStartupPage([0, [1].join()]); |
| 147 console.warn('VPDBG: 147'); | |
| 148 | 141 |
| 149 this.getList().selectionModel.selectedIndex = 1; | 142 this.getList().selectionModel.selectedIndex = 1; |
| 150 console.warn('VPDBG: 150'); | |
| 151 expectEquals(1, this.getList().selectionModel.selectedIndexes.length); | 143 expectEquals(1, this.getList().selectionModel.selectedIndexes.length); |
| 152 console.warn('VPDBG: 152'); | |
| 153 | 144 |
| 154 this.getList().items[0].dispatchEvent(createMouseEvent('drop')); | 145 this.getList().items[0].dispatchEvent(createMouseEvent('drop')); |
| 155 console.warn('VPDBG: 155'); | |
| 156 }); | 146 }); |
| 157 | 147 |
| 158 }()); | 148 }()); |
| OLD | NEW |