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

Side by Side Diff: chrome/test/data/webui/md_history/md_history_browsertest.js

Issue 2404763002: Refactor overall test suite, use replaceApp in HistoryListTest (Closed)
Patch Set: Undo namespacing change Created 4 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 /** 5 /**
6 * @fileoverview Test suite for the Material Design history page. 6 * @fileoverview Test suite for the Material Design history page.
7 */ 7 */
8 8
9 var ROOT_PATH = '../../../../../'; 9 var ROOT_PATH = '../../../../../';
10 10
(...skipping 10 matching lines...) Expand all
21 browsePreload: 'chrome://history', 21 browsePreload: 'chrome://history',
22 22
23 commandLineSwitches: [{switchName: 'enable-features', 23 commandLineSwitches: [{switchName: 'enable-features',
24 switchValue: 'MaterialDesignHistory'}], 24 switchValue: 'MaterialDesignHistory'}],
25 25
26 /** @override */ 26 /** @override */
27 runAccessibilityChecks: false, 27 runAccessibilityChecks: false,
28 28
29 extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([ 29 extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([
30 'test_util.js', 30 'test_util.js',
31 'browser_service_test.js',
32 'history_drawer_test.js',
33 'history_grouped_list_test.js',
34 'history_item_test.js',
35 'history_list_test.js',
36 'history_metrics_test.js',
37 'history_overflow_menu_test.js',
38 'history_routing_test.js',
39 'history_supervised_user_test.js',
40 'history_synced_tabs_test.js',
41 'history_toolbar_test.js',
42 ]), 31 ]),
43 32
44 /** @override */ 33 /** @override */
45 setUp: function() { 34 setUp: function() {
46 PolymerTest.prototype.setUp.call(this); 35 PolymerTest.prototype.setUp.call(this);
47 36
48 suiteSetup(function() { 37 suiteSetup(function() {
49 // Wait for the top-level app element to be upgraded. 38 // Wait for the top-level app element to be upgraded.
50 return waitForAppUpgrade() 39 return waitForAppUpgrade()
51 .then(function() { 40 .then(function() {
52 // <iron-list>#_maxPages controls the default number of "pages" of 41 // <iron-list>#_maxPages controls the default number of "pages" of
53 // "physical" (i.e. DOM) elements to render. Some of these tests 42 // "physical" (i.e. DOM) elements to render. Some of these tests
54 // rely on rendering up to 3 "pages" of items, which was previously 43 // rely on rendering up to 3 "pages" of items, which was previously
55 // the default, changeed to 2 for performance reasons. TODO(dbeam): 44 // the default, changeed to 2 for performance reasons. TODO(dbeam):
56 // maybe trim down the number of items created in the tests? Or 45 // maybe trim down the number of items created in the tests? Or
57 // don't touch <iron-list>'s physical items as much? 46 // don't touch <iron-list>'s physical items as much?
58 Array.from(document.querySelectorAll('* /deep/ iron-list')).forEach( 47 Array.from(document.querySelectorAll('* /deep/ iron-list')).forEach(
59 function(ironList) { ironList._maxPages = 3; }); 48 function(ironList) { ironList._maxPages = 3; });
60 }) 49 })
61 .then(function() { return md_history.ensureLazyLoaded(); }) 50 .then(function() { return md_history.ensureLazyLoaded(); })
62 .then(function() { 51 .then(function() {
63 $('history-app').queryState_.queryingDisabled = true; 52 $('history-app').queryState_.queryingDisabled = true;
64 }); 53 });
65 }); 54 });
66 }, 55 },
67 }; 56 };
68 57
69 TEST_F('MaterialHistoryBrowserTest', 'BrowserServiceTest', function() { 58 function MaterialHistoryBrowserServiceTest() {}
59
60 MaterialHistoryBrowserServiceTest.prototype = {
61 __proto__: MaterialHistoryBrowserTest.prototype,
62
63 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
64 'browser_service_test.js',
65 ]),
66 };
67
68 TEST_F('MaterialHistoryBrowserServiceTest', 'All', function() {
70 md_history.browser_service_test.registerTests(); 69 md_history.browser_service_test.registerTests();
71 mocha.run(); 70 mocha.run();
72 }); 71 });
73 72
74 TEST_F('MaterialHistoryBrowserTest', 'DrawerTest', function() { 73 function MaterialHistoryDrawerTest() {}
74
75 MaterialHistoryDrawerTest.prototype = {
76 __proto__: MaterialHistoryBrowserTest.prototype,
77
78 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
79 'history_drawer_test.js',
80 ]),
81 };
82
83 TEST_F('MaterialHistoryDrawerTest', 'All', function() {
75 md_history.history_drawer_test.registerTests(); 84 md_history.history_drawer_test.registerTests();
76 mocha.run(); 85 mocha.run();
77 }); 86 });
78 87
79 TEST_F('MaterialHistoryBrowserTest', 'HistoryGroupedListTest', function() { 88 function MaterialHistoryGroupedListTest() {}
89
90 MaterialHistoryGroupedListTest.prototype = {
91 __proto__: MaterialHistoryBrowserTest.prototype,
92
93 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
94 'history_grouped_list_test.js',
95 ]),
96 };
97
98 TEST_F('MaterialHistoryGroupedListTest', 'All', function() {
80 md_history.history_grouped_list_test.registerTests(); 99 md_history.history_grouped_list_test.registerTests();
81 mocha.run(); 100 mocha.run();
82 }); 101 });
83 102
84 TEST_F('MaterialHistoryBrowserTest', 'HistoryItemTest', function() { 103 function MaterialHistoryItemTest() {}
104
105 MaterialHistoryItemTest.prototype = {
106 __proto__: MaterialHistoryBrowserTest.prototype,
107
108 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
109 'history_item_test.js',
110 ]),
111 };
112
113 TEST_F('MaterialHistoryItemTest', 'All', function() {
85 md_history.history_item_test.registerTests(); 114 md_history.history_item_test.registerTests();
86 mocha.run(); 115 mocha.run();
87 }); 116 });
88 117
89 TEST_F('MaterialHistoryBrowserTest', 'HistoryListTest', function() { 118 function MaterialHistoryListTest() {}
119
120 MaterialHistoryListTest.prototype = {
121 __proto__: MaterialHistoryBrowserTest.prototype,
122
123 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
124 'history_list_test.js',
125 ]),
126 };
127
128 TEST_F('MaterialHistoryListTest', 'All', function() {
90 md_history.history_list_test.registerTests(); 129 md_history.history_list_test.registerTests();
91 mocha.run(); 130 mocha.run();
92 }); 131 });
93 132
94 TEST_F('MaterialHistoryBrowserTest', 'Metrics', function() { 133 function MaterialHistoryMetricsTest() {}
134
135 MaterialHistoryMetricsTest.prototype = {
136 __proto__: MaterialHistoryBrowserTest.prototype,
137
138 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
139 'history_metrics_test.js',
140 ]),
141 };
142
143 TEST_F('MaterialHistoryMetricsTest', 'All', function() {
95 md_history.history_metrics_test.registerTests(); 144 md_history.history_metrics_test.registerTests();
96 mocha.run(); 145 mocha.run();
97 }); 146 });
98 147
99 TEST_F('MaterialHistoryBrowserTest', 'HistoryToolbarTest', function() { 148 function MaterialHistoryOverflowMenuTest() {}
100 md_history.history_toolbar_test.registerTests();
101 mocha.run();
102 });
103 149
104 TEST_F('MaterialHistoryBrowserTest', 'HistoryToolbarFocusTest', function() { 150 MaterialHistoryOverflowMenuTest.prototype = {
105 md_history.history_toolbar_focus_test.registerTests(); 151 __proto__: MaterialHistoryBrowserTest.prototype,
106 mocha.run();
107 });
108 152
109 TEST_F('MaterialHistoryBrowserTest', 'HistoryOverflowMenuTest', function() { 153 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
154 'history_overflow_menu_test.js',
155 ]),
156 };
157
158 TEST_F('MaterialHistoryOverflowMenuTest', 'All', function() {
110 md_history.history_overflow_menu_test.registerTests(); 159 md_history.history_overflow_menu_test.registerTests();
111 mocha.run(); 160 mocha.run();
112 }); 161 });
113 162
114 TEST_F('MaterialHistoryBrowserTest', 'RoutingTest', function() { 163 function MaterialHistoryRoutingTest() {}
164
165 MaterialHistoryRoutingTest.prototype = {
166 __proto__: MaterialHistoryBrowserTest.prototype,
167
168 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
169 'history_routing_test.js',
170 ]),
171 };
172
173 TEST_F('MaterialHistoryRoutingTest', 'All', function() {
115 md_history.history_routing_test.registerTests(); 174 md_history.history_routing_test.registerTests();
116 mocha.run(); 175 mocha.run();
117 }); 176 });
118 177
119 // Fails on Mac, http://crbug.com/640862 178 function MaterialHistoryRoutingWithQueryParamTest() {}
120 TEST_F('MaterialHistoryBrowserTest', 'DISABLED_SyncedTabsTest', function() {
121 md_history.history_synced_tabs_test.registerTests();
122 mocha.run();
123 });
124 179
125 function MaterialHistoryDeletionDisabledTest() {} 180 MaterialHistoryRoutingWithQueryParamTest.prototype = {
126 181 __proto__: MaterialHistoryRoutingTest.prototype,
127 MaterialHistoryDeletionDisabledTest.prototype = {
128 __proto__: MaterialHistoryBrowserTest.prototype,
129
130 typedefCppFixture: 'HistoryUIBrowserTest',
131
132 testGenPreamble: function() {
133 GEN(' SetDeleteAllowed(false);');
134 }
135 };
136
137 TEST_F('MaterialHistoryDeletionDisabledTest', 'HistorySupervisedUserTest',
138 function() {
139 md_history.history_supervised_user_test.registerTests();
140 mocha.run();
141 });
142
143 function MaterialHistoryWithQueryParamTest() {}
144
145 MaterialHistoryWithQueryParamTest.prototype = {
146 __proto__: MaterialHistoryBrowserTest.prototype,
147 182
148 browsePreload: 'chrome://history?q=query', 183 browsePreload: 'chrome://history?q=query',
149 184
150 /** @override */ 185 /** @override */
151 setUp: function() { 186 setUp: function() {
152 PolymerTest.prototype.setUp.call(this); 187 PolymerTest.prototype.setUp.call(this);
153 // This message handler needs to be registered before the test since the 188 // This message handler needs to be registered before the test since the
154 // query can happen immediately after the element is upgraded. However, 189 // query can happen immediately after the element is upgraded. However,
155 // since there may be a delay as well, the test might check the global var 190 // since there may be a delay as well, the test might check the global var
156 // too early as well. In this case the test will have overtaken the 191 // too early as well. In this case the test will have overtaken the
157 // callback. 192 // callback.
158 registerMessageCallback('queryHistory', this, function (info) { 193 registerMessageCallback('queryHistory', this, function (info) {
159 window.historyQueryInfo = info; 194 window.historyQueryInfo = info;
160 }); 195 });
161 196
162 suiteSetup(function() { 197 suiteSetup(function() {
163 // Wait for the top-level app element to be upgraded. 198 // Wait for the top-level app element to be upgraded.
164 return waitForAppUpgrade().then(function() { 199 return waitForAppUpgrade().then(function() {
165 md_history.ensureLazyLoaded(); 200 md_history.ensureLazyLoaded();
166 }); 201 });
167 }); 202 });
168 }, 203 },
169 }; 204 };
170 205
171 TEST_F('MaterialHistoryWithQueryParamTest', 'RoutingTestWithQueryParam', 206 TEST_F('MaterialHistoryRoutingWithQueryParamTest', 'All', function() {
172 function() {
173 md_history.history_routing_test_with_query_param.registerTests(); 207 md_history.history_routing_test_with_query_param.registerTests();
174 mocha.run(); 208 mocha.run();
175 }); 209 });
210
211 function MaterialHistorySyncedTabsTest() {}
212
213 MaterialHistorySyncedTabsTest.prototype = {
214 __proto__: MaterialHistoryBrowserTest.prototype,
215
216 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
217 'history_synced_tabs_test.js',
218 ]),
219 };
220
221 // Fails on Mac, http://crbug.com/640862
222 TEST_F('MaterialHistorySyncedTabsTest', 'DISABLED_All', function() {
223 md_history.history_synced_tabs_test.registerTests();
Dan Beam 2016/11/03 18:07:51 i think a good next step might be to auto-register
tsergeant 2016/11/03 22:34:32 Yup! I originally did this to HistoryListTest in t
224 mocha.run();
225 });
226
227 function MaterialHistorySupervisedUserTest() {}
228
229 MaterialHistorySupervisedUserTest.prototype = {
230 __proto__: MaterialHistoryBrowserTest.prototype,
231
232 typedefCppFixture: 'HistoryUIBrowserTest',
233
234 testGenPreamble: function() {
235 GEN(' SetDeleteAllowed(false);');
236 },
237
238 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
239 'history_supervised_user_test.js',
240 ]),
241 };
242
243 TEST_F('MaterialHistorySupervisedUserTest', 'All', function() {
244 md_history.history_supervised_user_test.registerTests();
245 mocha.run();
246 });
247
248 function MaterialHistoryToolbarTest() {}
249
250 MaterialHistoryToolbarTest.prototype = {
251 __proto__: MaterialHistoryBrowserTest.prototype,
252
253 extraLibraries: MaterialHistoryBrowserTest.prototype.extraLibraries.concat([
254 'history_toolbar_test.js',
255 ]),
256 };
257
258 TEST_F('MaterialHistoryToolbarTest', 'Basic', function() {
259 md_history.history_toolbar_test.registerTests();
260 mocha.run();
261 });
262
263 TEST_F('MaterialHistoryToolbarTest', 'Focus', function() {
264 md_history.history_toolbar_focus_test.registerTests();
265 mocha.run();
266 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698