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

Side by Side Diff: chrome/test/data/webui/polymer_browser_test_base.js

Issue 2949313002: Polymer: Stop including test related components to production binary. (Closed)
Patch Set: Rebase Created 3 years, 6 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/BUILD.gn ('k') | ui/webui/resources/polymer_resources.grdp » ('j') | 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 Framework for running JavaScript tests of Polymer elements. 6 * @fileoverview Framework for running JavaScript tests of Polymer elements.
7 */ 7 */
8 8
9 /** 9 /**
10 * Test fixture for Polymer element testing. 10 * Test fixture for Polymer element testing.
(...skipping 22 matching lines...) Expand all
33 /** 33 /**
34 * Files that need not be compiled. Should be overridden to use correct 34 * Files that need not be compiled. Should be overridden to use correct
35 * relative paths with PolymerTest.getLibraries. 35 * relative paths with PolymerTest.getLibraries.
36 * @override 36 * @override
37 */ 37 */
38 extraLibraries: [ 38 extraLibraries: [
39 'ui/webui/resources/js/cr.js', 39 'ui/webui/resources/js/cr.js',
40 'ui/webui/resources/js/promise_resolver.js', 40 'ui/webui/resources/js/promise_resolver.js',
41 'third_party/mocha/mocha.js', 41 'third_party/mocha/mocha.js',
42 'chrome/test/data/webui/mocha_adapter.js', 42 'chrome/test/data/webui/mocha_adapter.js',
43 'third_party/polymer/v1_0/components-chromium/iron-test-helpers/' +
44 'mock-interactions.js',
43 ], 45 ],
44 46
45 /** @override */ 47 /** @override */
46 setUp: function() { 48 setUp: function() {
47 testing.Test.prototype.setUp.call(this); 49 testing.Test.prototype.setUp.call(this);
48 50
49 // List of imported URLs for debugging purposes. 51 // List of imported URLs for debugging purposes.
50 PolymerTest.importUrls_ = []; 52 PolymerTest.importUrls_ = [];
51 PolymerTest.scriptUrls_ = []; 53 PolymerTest.scriptUrls_ = [];
52 54
(...skipping 16 matching lines...) Expand all
69 msg += ' ' + PolymerTest.importUrls_[i] + '\n'; 71 msg += ' ' + PolymerTest.importUrls_[i] + '\n';
70 for (var i = 0; i < PolymerTest.scriptUrls_.length; i++) 72 for (var i = 0; i < PolymerTest.scriptUrls_.length; i++)
71 msg += ' ' + PolymerTest.scriptUrls_[i] + '\n'; 73 msg += ' ' + PolymerTest.scriptUrls_[i] + '\n';
72 console.error(msg); 74 console.error(msg);
73 75
74 // Mocha will handle the error. 76 // Mocha will handle the error.
75 throw e; 77 throw e;
76 } 78 }
77 }; 79 };
78 80
79 // Import Polymer and iron-test-helpers before running tests. 81 // Import Polymer before running tests.
80 suiteSetup(function() { 82 suiteSetup(function() {
81 var promises = [];
82 if (!window.Polymer) { 83 if (!window.Polymer) {
83 promises.push( 84 return PolymerTest.importHtml('chrome://resources/html/polymer.html');
84 PolymerTest.importHtml('chrome://resources/html/polymer.html'));
85 } 85 }
86 if (typeof MockInteractions != 'object') {
87 // Avoid importing the HTML file because iron-test-helpers assumes it is
88 // not being imported separately alongside a vulcanized Polymer.
89 promises.push(
90 PolymerTest.loadScript(
91 'chrome://resources/polymer/v1_0/iron-test-helpers/' +
92 'mock-interactions.js'));
93 }
94 return Promise.all(promises);
95 }); 86 });
96 }, 87 },
97 88
98 /** @override */ 89 /** @override */
99 tearDown: function() { 90 tearDown: function() {
100 // Note: We do this in tearDown() so that we have a chance to stamp all the 91 // Note: We do this in tearDown() so that we have a chance to stamp all the
101 // dom-if templates, add elements through interaction, etc. 92 // dom-if templates, add elements through interaction, etc.
102 PolymerTest.testIronIcons(document.body); 93 PolymerTest.testIronIcons(document.body);
103 94
104 testing.Test.prototype.tearDown.call(this); 95 testing.Test.prototype.tearDown.call(this);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme nt/helpers.js#L97 182 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme nt/helpers.js#L97
192 */ 183 */
193 PolymerTest.flushTasks = function() { 184 PolymerTest.flushTasks = function() {
194 Polymer.dom.flush(); 185 Polymer.dom.flush();
195 // Promises have microtask timing, so we use setTimeout to explicity force a 186 // Promises have microtask timing, so we use setTimeout to explicity force a
196 // new task. 187 // new task.
197 return new Promise(function(resolve, reject) { 188 return new Promise(function(resolve, reject) {
198 window.setTimeout(resolve, 0); 189 window.setTimeout(resolve, 0);
199 }); 190 });
200 }; 191 };
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | ui/webui/resources/polymer_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698