Chromium Code Reviews| Index: chrome/test/data/webui/settings/site_list_tests.js |
| diff --git a/chrome/test/data/webui/settings/site_list_tests.js b/chrome/test/data/webui/settings/site_list_tests.js |
| index 8e48d95f14934c86802513753ca3cc8ef1a1beac..3a2af25a1fb8bdee3b3718a7e651ed59502cd45c 100644 |
| --- a/chrome/test/data/webui/settings/site_list_tests.js |
| +++ b/chrome/test/data/webui/settings/site_list_tests.js |
| @@ -268,15 +268,22 @@ cr.define('site_list', function() { |
| }); |
| /** |
| + * Fetch the non-hidden menu items from the list. |
| + * @param {!HTMLElement} parentElement |
| + */ |
| + function getMenuItems(listContainer) { |
| + return listContainer.children[0].querySelectorAll( |
| + 'paper-menu-button paper-item:not([hidden])'); |
| + } |
| + |
| + /** |
| * Asserts the menu looks as expected. |
| * @param {Array<string>} items The items expected to show in the menu. |
| * @param {!HTMLElement} parentElement The parent node to start looking |
| * in. |
| */ |
| function assertMenu(items, parentElement) { |
| - var listItem = parentElement.$.listContainer.children[0]; |
| - var menuItems = listItem.querySelectorAll( |
| - 'paper-menu-button paper-item:not([hidden])'); |
| + var menuItems = getMenuItems(parentElement.$.listContainer); |
| assertEquals(items.length, menuItems.length); |
| for (var i = 0; i < items.length; i++) |
| assertEquals(items[i], menuItems[i].textContent.trim()); |
| @@ -641,6 +648,22 @@ cr.define('site_list', function() { |
| // No further checks needed. If this fails, it will hang the test. |
| }); |
| }); |
| + |
| + test('Select menu item', function() { |
| + // Test for error: |
| + // "Cannot read property 'origin' of undefined" |
| + // which occurs if the menu hasn't been fully setup prior to selecting a |
| + // menu item. |
|
tommycli
2016/08/11 21:53:10
I think the comment needs an update.
dschuyler
2016/08/11 22:40:14
Done.
|
| + setupCategory(settings.ContentSettingsTypes.GEOLOCATION, |
| + settings.PermissionValues.ALLOW, prefs); |
| + return browserProxy.whenCalled('getExceptionList').then(function( |
| + contentType) { |
| + Polymer.dom.flush(); |
| + var menuItems = getMenuItems(testElement.$.listContainer); |
| + assertTrue(!!menuItems); |
| + MockInteractions.tap(menuItems[0]); |
|
tommycli
2016/08/11 21:53:10
After the tap, return browserProxy.whenCalled('res
dschuyler
2016/08/11 22:40:14
Done.
|
| + }); |
| + }); |
| }); |
| } |
| return { |