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 36a8fde7cdb05ad7f14a6c7cca0c314f97c92868..3b92d67abe02c74f42fb1a01de69f3a78a4b428b 100644 |
--- a/chrome/test/data/webui/settings/settings_page_browsertest.js |
+++ b/chrome/test/data/webui/settings/settings_page_browsertest.js |
@@ -75,4 +75,38 @@ SettingsPageBrowserTest.prototype = { |
} |
return undefined; |
}, |
+ |
+ /** |
+ * Verifies the section has a visible #main element and that any possible |
+ * sub-pages are hidden. |
+ * @param {!Node} The DOM node for the section. |
+ */ |
+ verifySubpagesHidden: function(section) { |
+ // Check if there are sub-pages to verify. |
+ var pages = section.querySelector('* /deep/ settings-animated-pages'); |
+ if (!pages) |
+ return; |
+ |
+ var children = pages.getContentChildren(); |
+ var stampedChildren = children.filter(function(element) { |
+ return element.tagName != 'TEMPLATE'; |
+ }); |
+ |
+ // The section's main child should be stamped and visible. |
+ var main = stampedChildren.filter(function(element) { |
+ return element.id == 'main'; |
+ }); |
+ assertEquals(main.length, 1, '#main not found for section ' + |
+ section.section); |
+ assertGT(main[0].offsetHeight, 0); |
+ |
+ // Any other stamped subpages should not be visible. |
+ var subpages = stampedChildren.filter(function(element) { |
+ return element.id != 'main'; |
+ }); |
+ for (var subpage of subpages) { |
+ assertEquals(subpage.offsetHeight, 0, 'Expected subpage #' + subpage.id + |
+ ' in ' + section.section + ' not to be visible.'); |
+ } |
+ }, |
}; |