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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /** @fileoverview Prototype for Settings page tests. */
6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../';
9
10 // Polymer BrowserTest fixture.
11 GEN_INCLUDE(
12 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']);
13
14 /**
15 * @constructor
16 * @extends {PolymerTest}
17 */
18 function SettingsPageBrowserTest() {}
19
20 SettingsPageBrowserTest.prototype = {
21 __proto__: PolymerTest.prototype,
22
23 /** @override */
24 browsePreload: 'chrome://md-settings/',
25
26 /** @override */
27 extraLibraries: PolymerTest.getLibraries(ROOT_PATH),
28
29 /** @override */
30 runAccessibilityChecks: false,
31
32 /**
33 * @param {string} type The settings page type, e.g. 'advanced' or 'basic'.
34 * @return {Node} The DOM node for the page.
35 */
36 getPage: function(type) {
37 var settings = document.querySelector('cr-settings');
38 assertTrue(!!settings);
39 var settingsUi = settings.shadowRoot.querySelector('settings-ui');
40 assertTrue(!!settingsUi);
41 var settingsMain = settingsUi.shadowRoot.querySelector('settings-main');
42 assertTrue(!!settingsMain);
43 var pages = settingsMain.$.pageContainer;
44 assertTrue(!!pages);
45 var pageType = 'settings-' + type + '-page';
46 var page = pages.querySelector(pageType);
47 assertTrue(!!page);
48 return page;
49 },
50
51 /**
52 * @param {Node} page The DOM node for the settings page containing |section|.
53 * @param {string} section The settings page section, e.g. 'appearance'.
54 * @return {Node} The DOM node for the section.
55 */
56 getSection: function(page, section) {
57 var sections = page.shadowRoot.querySelectorAll('settings-section');
58 assertTrue(!!sections);
59 var len = sections.length;
60 assertGT(len, 0);
61 for (var i = 0; i < len; ++i) {
62 var s = sections[i];
63 if (s.section == section)
64 return s;
65 }
66 assertNotReached('Section not found: ' + section + ' in ' + page);
67 return undefined;
68 },
69 };
OLDNEW
« 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