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

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

Issue 1466433002: Add Settings bluetooth page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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
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 18 matching lines...) Expand all
29 /** @override */ 29 /** @override */
30 runAccessibilityChecks: false, 30 runAccessibilityChecks: false,
31 31
32 /** 32 /**
33 * @param {string} type The settings page type, e.g. 'advanced' or 'basic'. 33 * @param {string} type The settings page type, e.g. 'advanced' or 'basic'.
34 * @return {Node} The DOM node for the page. 34 * @return {Node} The DOM node for the page.
35 */ 35 */
36 getPage: function(type) { 36 getPage: function(type) {
37 var settings = document.querySelector('cr-settings'); 37 var settings = document.querySelector('cr-settings');
38 assertTrue(!!settings); 38 assertTrue(!!settings);
39 var settingsUi = settings.shadowRoot.querySelector('settings-ui'); 39 var settingsUi = settings.$$('settings-ui');
40 assertTrue(!!settingsUi); 40 assertTrue(!!settingsUi);
41 var settingsMain = settingsUi.shadowRoot.querySelector('settings-main'); 41 var settingsMain = settingsUi.$$('settings-main');
42 assertTrue(!!settingsMain); 42 assertTrue(!!settingsMain);
43 var pages = settingsMain.$.pageContainer; 43 var pages = settingsMain.$.pageContainer;
44 assertTrue(!!pages); 44 assertTrue(!!pages);
45 var pageType = 'settings-' + type + '-page'; 45 var pageType = 'settings-' + type + '-page';
46 var page = pages.querySelector(pageType); 46 var page = pages.querySelector(pageType);
47 assertTrue(!!page); 47 assertTrue(!!page);
48 return page; 48 return page;
49 }, 49 },
50 50
51 /** 51 /**
52 * @param {Node} page The DOM node for the settings page containing |section|. 52 * @param {Node} page The DOM node for the settings page containing |section|.
53 * @param {string} section The settings page section, e.g. 'appearance'. 53 * @param {string} section The settings page section, e.g. 'appearance'.
54 * @return {Node} The DOM node for the section. 54 * @return {Node} The DOM node for the section.
55 */ 55 */
56 getSection: function(page, section) { 56 getSection: function(page, section) {
57 var sections = page.shadowRoot.querySelectorAll('settings-section'); 57 var sections = page.shadowRoot.querySelectorAll('settings-section');
michaelpg 2015/11/20 15:08:18 $$
stevenjb 2015/11/20 17:47:41 "Convenience method to run querySelector on this l
michaelpg 2015/11/24 15:55:49 Sorry, got a bit overzealous in reducing wordiness
58 assertTrue(!!sections); 58 assertTrue(!!sections);
59 var len = sections.length; 59 var len = sections.length;
60 assertGT(len, 0); 60 assertGT(len, 0);
61 for (var i = 0; i < len; ++i) { 61 for (var i = 0; i < len; ++i) {
62 var s = sections[i]; 62 var s = sections[i];
63 if (s.section == section) 63 if (s.section == section)
64 return s; 64 return s;
65 } 65 }
66 assertNotReached('Section not found: ' + section + ' in ' + page); 66 assertNotReached('Section not found: ' + section + ' in ' + page);
67 return undefined; 67 return undefined;
68 }, 68 },
69 }; 69 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698