| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** @fileoverview Suite of tests for protocol_handlers. */ | 5 /** @fileoverview Suite of tests for protocol_handlers. */ |
| 6 suite('ProtocolHandlers', function() { | 6 suite('ProtocolHandlers', function() { |
| 7 /** | 7 /** |
| 8 * A dummy protocol handler element created before each test. | 8 * A dummy protocol handler element created before each test. |
| 9 * @type {ProtocolHandlers} | 9 * @type {ProtocolHandlers} |
| 10 */ | 10 */ |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 * @param {string} button id of the button to test. | 109 * @param {string} button id of the button to test. |
| 110 * @param {string} handler name of browserProxy handler to react. | 110 * @param {string} handler name of browserProxy handler to react. |
| 111 * @return {!Promise} | 111 * @return {!Promise} |
| 112 */ | 112 */ |
| 113 function testButtonFlow(button, browserProxyHandler) { | 113 function testButtonFlow(button, browserProxyHandler) { |
| 114 var menuButtons, functionButton, dialog; | 114 var menuButtons, functionButton, dialog; |
| 115 | 115 |
| 116 return initPage() | 116 return initPage() |
| 117 .then(function() { | 117 .then(function() { |
| 118 // Initiating the elements | 118 // Initiating the elements |
| 119 menuButtons = testElement.root.querySelectorAll('paper-icon-button'); | 119 menuButtons = |
| 120 testElement.root.querySelectorAll('button.icon-more-vert'); |
| 120 functionButton = testElement.$[button]; | 121 functionButton = testElement.$[button]; |
| 121 dialog = testElement.$$('dialog[is=cr-action-menu]'); | 122 dialog = testElement.$$('dialog[is=cr-action-menu]'); |
| 122 assertEquals(3, menuButtons.length); | 123 assertEquals(3, menuButtons.length); |
| 123 | 124 |
| 124 // Test the button for the first protocol handler | 125 // Test the button for the first protocol handler |
| 125 MockInteractions.tap(menuButtons[0]); | 126 MockInteractions.tap(menuButtons[0]); |
| 126 assertTrue(dialog.open); | 127 assertTrue(dialog.open); |
| 127 | 128 |
| 128 MockInteractions.tap(functionButton); | 129 MockInteractions.tap(functionButton); |
| 129 | 130 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 155 test('remove button works', function() { | 156 test('remove button works', function() { |
| 156 browserProxy.setProtocolHandlers(protocols); | 157 browserProxy.setProtocolHandlers(protocols); |
| 157 return testButtonFlow('removeButton', 'removeProtocolHandler'); | 158 return testButtonFlow('removeButton', 'removeProtocolHandler'); |
| 158 }); | 159 }); |
| 159 | 160 |
| 160 test('default button works', function() { | 161 test('default button works', function() { |
| 161 browserProxy.setProtocolHandlers(protocols); | 162 browserProxy.setProtocolHandlers(protocols); |
| 162 return testButtonFlow('defaultButton', 'setProtocolDefault'); | 163 return testButtonFlow('defaultButton', 'setProtocolDefault'); |
| 163 }); | 164 }); |
| 164 }); | 165 }); |
| OLD | NEW |