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

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

Issue 2655043005: MD Settings: Bluetooth: Move device list to subpage (Closed)
Patch Set: Fix clang, ES6 Created 3 years, 10 months 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/fake_bluetooth.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
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 /** 5 /**
6 * @fileoverview Suite of tests to ensure that settings subpages exist and 6 * @fileoverview Suite of tests to ensure that settings subpages exist and
7 * load without errors. Also outputs approximate load times for each subpage. 7 * load without errors. Also outputs approximate load times for each subpage.
8 */ 8 */
9 9
10 GEN_INCLUDE(['settings_page_browsertest.js']); 10 GEN_INCLUDE(['settings_page_browsertest.js']);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 /** 60 /**
61 * Ensures the subpage is initially hidden, then sets it to visible and 61 * Ensures the subpage is initially hidden, then sets it to visible and
62 * times the result, outputting a (rough) approximation of load time for the 62 * times the result, outputting a (rough) approximation of load time for the
63 * subpage. 63 * subpage.
64 * @param {Node} page 64 * @param {Node} page
65 * @param {string} subpage 65 * @param {string} subpage
66 */ 66 */
67 testSubPage: function(page, subPage) { 67 testSubPage: function(page, subPage) {
68 Polymer.dom.flush(); 68 Polymer.dom.flush();
69 expectFalse(!!this.getSection(page, subPage)); 69 assertFalse(!!this.getSection(page, subPage));
70 var startTime = window.performance.now(); 70 var startTime = window.performance.now();
71 page.set('pageVisibility.' + subPage, true); 71 page.set('pageVisibility.' + subPage, true);
72 Polymer.dom.flush(); 72 Polymer.dom.flush();
73 var dtime = window.performance.now() - startTime; 73 var dtime = window.performance.now() - startTime;
74 console.log('Page: ' + subPage + ' Load time: ' + dtime.toFixed(0) + ' ms'); 74 console.log('Page: ' + subPage + ' Load time: ' + dtime.toFixed(0) + ' ms');
75 expectTrue(!!this.getSection(page, subPage)); 75 assertTrue(!!this.getSection(page, subPage));
76 // Hide the page so that it doesn't interfere with other subPages. 76 // Hide the page so that it doesn't interfere with other subPages.
77 page.set('pageVisibility.' + subPage, false); 77 page.set('pageVisibility.' + subPage, false);
78 Polymer.dom.flush(); 78 Polymer.dom.flush();
79 }, 79 },
80 80
81 testSubPages: function() { 81 testSubPages: function() {
82 var page = this.getPage(this.pageId); 82 var page = this.getPage(this.pageId);
83 this.subPages.forEach(function(subPage) { 83 this.subPages.forEach(function(subPage) {
84 test(subPage, this.testSubPage.bind(this, page, subPage)); 84 test(subPage, this.testSubPage.bind(this, page, subPage));
85 }.bind(this)); 85 }.bind(this));
86 }, 86 },
87 }; 87 };
88 88
89 /** @constructor @extends {SettingsSubPageBrowserTest} */ 89 /** @constructor @extends {SettingsSubPageBrowserTest} */
90 function SettingsBasicSubPageBrowserTest() { 90 function SettingsBasicSubPageBrowserTest() {
91 SettingsSubPageBrowserTest.call(this, 'basic'); 91 SettingsSubPageBrowserTest.call(this, 'basic');
92 92
93 /** @override */ 93 /** @override */
94 this.subPages = [ 94 this.subPages = [
95 'people', 95 'people',
96 'appearance', 96 'appearance',
97 'onStartup', 97 'onStartup',
98 'search', 98 'search',
99 ]; 99 ];
100 if (cr.isChromeOS) 100 if (cr.isChromeOS)
101 this.subPages.push('device', 'internet'); 101 this.subPages.push('internet', 'bluetooth', 'device');
102 else 102 else
103 this.subPages.push('defaultBrowser'); 103 this.subPages.push('defaultBrowser');
104 } 104 }
105 105
106 SettingsBasicSubPageBrowserTest.prototype = { 106 SettingsBasicSubPageBrowserTest.prototype = {
107 __proto__: SettingsSubPageBrowserTest.prototype, 107 __proto__: SettingsSubPageBrowserTest.prototype,
108 }; 108 };
109 109
110 TEST_F('SettingsBasicSubPageBrowserTest', 'SubPages', function() { 110 TEST_F('SettingsBasicSubPageBrowserTest', 'SubPages', function() {
111 suite('Basic', this.testSubPages.bind(this)); 111 suite('Basic', this.testSubPages.bind(this));
112 mocha.run(); 112 mocha.run();
113 }); 113 });
114 114
115 /** @constructor @extends {SettingsSubPageBrowserTest} */ 115 /** @constructor @extends {SettingsSubPageBrowserTest} */
116 function SettingsAdvancedSubPageBrowserTest() { 116 function SettingsAdvancedSubPageBrowserTest() {
117 // "Advanced" sections live in the settings-basic-page. 117 // "Advanced" sections live in the settings-basic-page.
118 SettingsSubPageBrowserTest.call(this, 'basic'); 118 SettingsSubPageBrowserTest.call(this, 'basic');
119 119
120 /** @override */ 120 /** @override */
121 this.subPages = [ 121 this.subPages = [
122 'privacy', 122 'privacy',
123 'passwordsAndForms', 123 'passwordsAndForms',
124 'languages', 124 'languages',
125 'downloads', 125 'downloads',
126 'printing', 126 'printing',
127 'a11y', 127 'a11y',
128 'reset', 128 'reset',
129 ]; 129 ];
130 if (cr.isChromeOS) 130 if (cr.isChromeOS)
131 this.subPages.push('dateTime', 'bluetooth'); 131 this.subPages.push('dateTime');
132 else 132 else
133 this.subPages.push('system'); 133 this.subPages.push('system');
134 }; 134 };
135 135
136 SettingsAdvancedSubPageBrowserTest.prototype = { 136 SettingsAdvancedSubPageBrowserTest.prototype = {
137 __proto__: SettingsSubPageBrowserTest.prototype, 137 __proto__: SettingsSubPageBrowserTest.prototype,
138 138
139 /** @override */ 139 /** @override */
140 setUp: function() { 140 setUp: function() {
141 this.toggleAdvanced(); 141 this.toggleAdvanced();
142 SettingsSubPageBrowserTest.prototype.setUp.call(this); 142 SettingsSubPageBrowserTest.prototype.setUp.call(this);
143 }, 143 },
144 }; 144 };
145 145
146 TEST_F('SettingsAdvancedSubPageBrowserTest', 'SubPages', function() { 146 TEST_F('SettingsAdvancedSubPageBrowserTest', 'SubPages', function() {
147 suite('Advanced', this.testSubPages.bind(this)); 147 suite('Advanced', this.testSubPages.bind(this));
148 mocha.run(); 148 mocha.run();
149 }); 149 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/fake_bluetooth.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698