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

Side by Side Diff: chrome/test/data/webui/settings/settings_page_browsertest.js

Issue 1523403004: Minor cleanup of CrSettingsBrowserTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** @fileoverview Prototype for Settings page tests. */ 5 /** @fileoverview Prototype for Settings page tests. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
(...skipping 13 matching lines...) Expand all
24 browsePreload: 'chrome://md-settings/', 24 browsePreload: 'chrome://md-settings/',
25 25
26 /** @override */ 26 /** @override */
27 extraLibraries: PolymerTest.getLibraries(ROOT_PATH), 27 extraLibraries: PolymerTest.getLibraries(ROOT_PATH),
28 28
29 /** @override */ 29 /** @override */
30 runAccessibilityChecks: false, 30 runAccessibilityChecks: false,
31 31
32 /** @override */ 32 /** @override */
33 setUp: function() { 33 setUp: function() {
34 PolymerTest.prototype.setUp.call(this);
34 suiteSetup(function() { 35 suiteSetup(function() {
35 return CrSettingsPrefs.initialized; 36 return CrSettingsPrefs.initialized;
36 }); 37 });
37 }, 38 },
38 39
39 /** 40 /**
40 * @param {string} type The settings page type, e.g. 'advanced' or 'basic'. 41 * @param {string} type The settings page type, e.g. 'advanced' or 'basic'.
41 * @return {Node} The DOM node for the page. 42 * @return {!PolymerElement} The PolymerElement for the page.
42 */ 43 */
43 getPage: function(type) { 44 getPage: function(type) {
44 var settings = document.querySelector('cr-settings'); 45 var settings = document.querySelector('cr-settings');
45 assertTrue(!!settings); 46 assertTrue(!!settings);
46 var settingsUi = settings.shadowRoot.querySelector('settings-ui'); 47 var settingsUi = settings.$$('settings-ui');
47 assertTrue(!!settingsUi); 48 assertTrue(!!settingsUi);
48 var settingsMain = settingsUi.shadowRoot.querySelector('settings-main'); 49 var settingsMain = settingsUi.$$('settings-main');
49 assertTrue(!!settingsMain); 50 assertTrue(!!settingsMain);
50 var pages = settingsMain.$.pageContainer; 51 var pages = settingsMain.$.pageContainer;
51 assertTrue(!!pages); 52 assertTrue(!!pages);
52 var pageType = 'settings-' + type + '-page'; 53 var pageType = 'settings-' + type + '-page';
53 var page = pages.querySelector(pageType); 54 var page = pages.querySelector(pageType);
54 assertTrue(!!page); 55 assertTrue(!!page);
55 return page; 56 return page;
56 }, 57 },
57 58
58 /** 59 /**
59 * @param {Node} page The DOM node for the settings page containing |section|. 60 * @param {!PolymerElement} page The PolymerElement for the page containing
61 * |section|.
60 * @param {string} section The settings page section, e.g. 'appearance'. 62 * @param {string} section The settings page section, e.g. 'appearance'.
61 * @return {Node|undefined} The DOM node for the section. 63 * @return {Node|undefined} The DOM node for the section.
62 */ 64 */
63 getSection: function(page, section) { 65 getSection: function(page, section) {
64 var sections = page.shadowRoot.querySelectorAll('settings-section'); 66 var sections = page.shadowRoot.querySelectorAll('settings-section');
65 assertTrue(!!sections); 67 assertTrue(!!sections);
66 for (var i = 0; i < sections.length; ++i) { 68 for (var i = 0; i < sections.length; ++i) {
67 var s = sections[i]; 69 var s = sections[i];
68 if (s.section == section) 70 if (s.section == section)
69 return s; 71 return s;
70 } 72 }
71 return undefined; 73 return undefined;
72 }, 74 },
73 }; 75 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698