Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 msg += ' ' + PolymerTest.scriptUrls_[i] + '\n'; | 83 msg += ' ' + PolymerTest.scriptUrls_[i] + '\n'; |
| 84 console.error(msg); | 84 console.error(msg); |
| 85 | 85 |
| 86 // Mocha will handle the error. | 86 // Mocha will handle the error. |
| 87 throw e; | 87 throw e; |
| 88 } | 88 } |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // Import Polymer and iron-test-helpers before running tests. | 91 // Import Polymer and iron-test-helpers before running tests. |
| 92 suiteSetup(function() { | 92 suiteSetup(function() { |
| 93 var promises = []; | 93 var promises = [ |
| 94 if (typeof Polymer != 'function') { | 94 PolymerTest.importHtml('chrome://resources/html/polymer.html'), |
|
michaelpg
2016/04/05 00:49:42
maybe keep this as
if (!Polymer) {
|
michaelpg
2016/04/05 00:49:42
this assumes the page being tested doesn't load
Dan Beam
2016/04/05 01:38:58
why doesn't media router stuff use polymer.html?
|
| 95 promises.push( | 95 ]; |
| 96 PolymerTest.importHtml( | |
| 97 'chrome://resources/polymer/v1_0/polymer/polymer.html')); | |
| 98 } | |
| 99 if (typeof MockInteractions != 'object') { | 96 if (typeof MockInteractions != 'object') { |
| 100 // Avoid importing the HTML file because iron-test-helpers assumes it is | 97 // Avoid importing the HTML file because iron-test-helpers assumes it is |
| 101 // not being imported separately alongside a vulcanized Polymer. | 98 // not being imported separately alongside a vulcanized Polymer. |
| 102 promises.push( | 99 promises.push( |
| 103 PolymerTest.loadScript( | 100 PolymerTest.loadScript( |
| 104 'chrome://resources/polymer/v1_0/iron-test-helpers/' + | 101 'chrome://resources/polymer/v1_0/iron-test-helpers/' + |
| 105 'mock-interactions.js')); | 102 'mock-interactions.js')); |
| 106 } | 103 } |
| 107 return Promise.all(promises); | 104 return Promise.all(promises); |
| 108 }); | 105 }); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 */ | 171 */ |
| 175 PolymerTest.getLibraries = function(basePath) { | 172 PolymerTest.getLibraries = function(basePath) { |
| 176 // Ensure basePath ends in '/'. | 173 // Ensure basePath ends in '/'. |
| 177 if (basePath.length && basePath[basePath.length - 1] != '/') | 174 if (basePath.length && basePath[basePath.length - 1] != '/') |
| 178 basePath += '/'; | 175 basePath += '/'; |
| 179 | 176 |
| 180 return PolymerTest.prototype.extraLibraries.map(function(library) { | 177 return PolymerTest.prototype.extraLibraries.map(function(library) { |
| 181 return basePath + library; | 178 return basePath + library; |
| 182 }); | 179 }); |
| 183 }; | 180 }; |
| OLD | NEW |