Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: chrome/test/data/webui/settings/settings_page_browsertest.js

Issue 1457543004: Add Mocha based tests for Settings pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/webui/settings/main_page_browsertest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..2b8e53d2afbd2ca0e7258940699d20d58446fe5a
--- /dev/null
+++ b/chrome/test/data/webui/settings/settings_page_browsertest.js
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Prototype for Settings page tests. */
+
+/** @const {string} Path to root from chrome/test/data/webui/settings/. */
+var ROOT_PATH = '../../../../../';
+
+// Polymer BrowserTest fixture.
+GEN_INCLUDE(
+ [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']);
+
+/**
+ * @constructor
+ * @extends {PolymerTest}
+*/
+function SettingsPageBrowserTest() {}
+
+SettingsPageBrowserTest.prototype = {
+ __proto__: PolymerTest.prototype,
+
+ /** @override */
+ browsePreload: 'chrome://md-settings/',
+
+ /** @override */
+ extraLibraries: PolymerTest.getLibraries(ROOT_PATH),
+
+ /** @override */
+ runAccessibilityChecks: false,
+
+ /**
+ * @param {string} type The settings page type, e.g. 'advanced' or 'basic'.
+ * @return {Node} The DOM node for the page.
+ */
+ getPage: function(type) {
+ var settings = document.querySelector('cr-settings');
+ assertTrue(!!settings);
+ var settingsUi = settings.shadowRoot.querySelector('settings-ui');
+ assertTrue(!!settingsUi);
+ var settingsMain = settingsUi.shadowRoot.querySelector('settings-main');
+ assertTrue(!!settingsMain);
+ var pages = settingsMain.$.pageContainer;
+ assertTrue(!!pages);
+ var pageType = 'settings-' + type + '-page';
+ var page = pages.querySelector(pageType);
+ assertTrue(!!page);
+ return page;
+ },
+
+ /**
+ * @param {Node} page The DOM node for the settings page containing |section|.
+ * @param {string} section The settings page section, e.g. 'appearance'.
+ * @return {Node} The DOM node for the section.
+ */
+ getSection: function(page, section) {
+ var sections = page.shadowRoot.querySelectorAll('settings-section');
+ assertTrue(!!sections);
+ var len = sections.length;
+ assertGT(len, 0);
+ for (var i = 0; i < len; ++i) {
+ var s = sections[i];
+ if (s.section == section)
+ return s;
+ }
+ assertNotReached('Section not found: ' + section + ' in ' + page);
+ return undefined;
+ },
+};
« no previous file with comments | « chrome/test/data/webui/settings/main_page_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698