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..7e176e4bda32fa484d02107734958eab0472cef2 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,25 @@ 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". |
| + 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]); |
| + return Promise.race([ |
|
tommycli
2016/08/11 22:46:24
Since we control the test data, we know which of t
dschuyler
2016/08/11 22:56:39
Done.
|
| + browserProxy.whenCalled('resetCategoryPermissionForOrigin'), |
| + browserProxy.whenCalled('setCategoryPermissionForOrigin'), |
| + ]).then(function(contentType) { |
|
tommycli
2016/08/11 22:46:24
no need for 'then'
dschuyler
2016/08/11 22:56:39
Done.
|
| + // Nothing to do here. |
| + }); |
| + }); |
| + }); |
| }); |
| } |
| return { |