Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 Common utilities for extension ui tests. */ | 5 /** @fileoverview Common utilities for extension ui tests. */ |
| 6 cr.define('extension_test_util', function() { | 6 cr.define('extension_test_util', function() { |
| 7 /** | 7 /** |
| 8 * A mock to test that clicking on an element calls a specific method. | 8 * A mock to test that clicking on an element calls a specific method. |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 incognitoAccess: {isEnabled: true, isActive: false}, | 117 incognitoAccess: {isEnabled: true, isActive: false}, |
| 118 location: 'FROM_STORE', | 118 location: 'FROM_STORE', |
| 119 name: 'Wonderful Extension', | 119 name: 'Wonderful Extension', |
| 120 state: 'ENABLED', | 120 state: 'ENABLED', |
| 121 type: 'EXTENSION', | 121 type: 'EXTENSION', |
| 122 version: '2.0', | 122 version: '2.0', |
| 123 views: [{url: baseUrl + 'foo.html'}, {url: baseUrl + 'bar.html'}], | 123 views: [{url: baseUrl + 'foo.html'}, {url: baseUrl + 'bar.html'}], |
| 124 }, opt_properties); | 124 }, opt_properties); |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | |
| 128 * Tests that any iron-element child of an HTML element has a corresponding | |
|
michaelpg
2016/05/05 17:06:27
iron-icon
Devlin
2016/05/05 20:28:32
whoops, done.
| |
| 129 * non-empty svg element. | |
| 130 * @param {HTMLElement} e The element to check the iron icons in. | |
| 131 */ | |
| 132 function testIronIcons(e) { | |
| 133 e.querySelectorAll('* /deep/ iron-icon').forEach(function(icon) { | |
|
michaelpg
2016/05/05 17:06:27
out of curiosity, what happens when e == document.
Devlin
2016/05/05 20:28:32
Discussed offline, will experiment in a followup c
| |
| 134 var svg = icon.$$('svg'); | |
| 135 expectTrue(!!svg && svg.innerHTML != '', | |
| 136 'icon "' + icon.icon + '" is not present'); | |
| 137 }); | |
| 138 } | |
| 139 | |
| 127 return { | 140 return { |
| 128 ClickMock: ClickMock, | 141 ClickMock: ClickMock, |
| 129 MockItemDelegate: MockItemDelegate, | 142 MockItemDelegate: MockItemDelegate, |
| 130 isVisible: isVisible, | 143 isVisible: isVisible, |
| 131 testVisible: testVisible, | 144 testVisible: testVisible, |
| 132 createExtensionInfo: createExtensionInfo, | 145 createExtensionInfo: createExtensionInfo, |
| 146 testIronIcons: testIronIcons, | |
| 133 }; | 147 }; |
| 134 }); | 148 }); |
| OLD | NEW |