| Index: chrome/test/data/webui/settings/settings_page_browsertest.js
|
| diff --git a/chrome/test/data/webui/settings/settings_page_browsertest.js b/chrome/test/data/webui/settings/settings_page_browsertest.js
|
| index 7e60116464fcb0274da8d111d22c18e8c7aa30a9..621bdee132fbbe77527530fd6c16978f3e8c19b7 100644
|
| --- a/chrome/test/data/webui/settings/settings_page_browsertest.js
|
| +++ b/chrome/test/data/webui/settings/settings_page_browsertest.js
|
| @@ -58,26 +58,58 @@ SettingsPageBrowserTest.prototype = {
|
| },
|
|
|
| /**
|
| - * @param {!PolymerElement} page The PolymerElement for the page containing
|
| - * |section|.
|
| - * @param {string} section The settings page section, e.g. 'appearance'.
|
| - * @return {Node|undefined} The DOM node for the section.
|
| + * @param {!MainPageBehavior} page The page containing the sections to return.
|
| + * @return {!Array<!SettingsSectionElement>} The page's <settings-section>s.
|
| */
|
| - getSection: function(page, section) {
|
| - var sections = page.shadowRoot.querySelectorAll('settings-section');
|
| - assertTrue(!!sections);
|
| - for (var i = 0; i < sections.length; ++i) {
|
| - var s = sections[i];
|
| - if (s.section == section)
|
| - return s;
|
| - }
|
| - return undefined;
|
| + getSections: function(page) {
|
| + return Array.from(page.shadowRoot.querySelectorAll('settings-section'));
|
| + },
|
| +
|
| + /**
|
| + * @param {!MainPageBehavior} page The page containing |section|.
|
| + * @param {string} sectionId The settings page section, e.g. 'appearance'.
|
| + * @return {?SettingsSectionElement} The settings-section element, or null.
|
| + */
|
| + getSection: function(page, sectionId) {
|
| + return page.$$(`settings-section[section="${sectionId}"]`);
|
| + },
|
| +
|
| + /*
|
| + * Returns all stamped subpages of a section. This excludes the main
|
| + * animatable (the default initial view of the closed section).
|
| + * @param {!SettingsSectionElement} section
|
| + * @return {!Map<string, !SettingsSubpageElement>} Map of subpages by id.
|
| + */
|
| + getSectionSubpages: function(section) {
|
| + var subpages = new Map();
|
| + var pages = section.querySelector('* /deep/ settings-animated-pages');
|
| + if (!pages)
|
| + return subpages;
|
| +
|
| + pages.getContentChildren().forEach(function(element) {
|
| + if (element.tagName == 'SETTINGS-SUBPAGE')
|
| + subpages.set(element.id, element);
|
| + });
|
| + return subpages;
|
| + },
|
| +
|
| + /*
|
| + * Returns the main animatable of a section (the default initial view of the
|
| + * closed section).
|
| + * @param {!SettingsSectionElement} section
|
| + * @return {?NeonAnimatableElement>}
|
| + */
|
| + getSectionMainAnimatable: function(section) {
|
| + var pages = section.querySelector('* /deep/ settings-animated-pages');
|
| + if (!pages)
|
| + return null;
|
| + return pages.querySelector('#main');
|
| },
|
|
|
| /**
|
| * Verifies the section has a visible #main element and that any possible
|
| * sub-pages are hidden.
|
| - * @param {!Node} The DOM node for the section.
|
| + * @param {!SettingsSectionElement} section
|
| */
|
| verifySubpagesHidden: function(section) {
|
| // Check if there are sub-pages to verify.
|
|
|