| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (!window.Polymer) { |
| 95 promises.push( | 95 promises.push( |
| 96 PolymerTest.importHtml( | 96 PolymerTest.importHtml('chrome://resources/html/polymer.html')); |
| 97 'chrome://resources/polymer/v1_0/polymer/polymer.html')); | |
| 98 } | 97 } |
| 99 if (typeof MockInteractions != 'object') { | 98 if (typeof MockInteractions != 'object') { |
| 100 // Avoid importing the HTML file because iron-test-helpers assumes it is | 99 // Avoid importing the HTML file because iron-test-helpers assumes it is |
| 101 // not being imported separately alongside a vulcanized Polymer. | 100 // not being imported separately alongside a vulcanized Polymer. |
| 102 promises.push( | 101 promises.push( |
| 103 PolymerTest.loadScript( | 102 PolymerTest.loadScript( |
| 104 'chrome://resources/polymer/v1_0/iron-test-helpers/' + | 103 'chrome://resources/polymer/v1_0/iron-test-helpers/' + |
| 105 'mock-interactions.js')); | 104 'mock-interactions.js')); |
| 106 } | 105 } |
| 107 return Promise.all(promises); | 106 return Promise.all(promises); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 */ | 173 */ |
| 175 PolymerTest.getLibraries = function(basePath) { | 174 PolymerTest.getLibraries = function(basePath) { |
| 176 // Ensure basePath ends in '/'. | 175 // Ensure basePath ends in '/'. |
| 177 if (basePath.length && basePath[basePath.length - 1] != '/') | 176 if (basePath.length && basePath[basePath.length - 1] != '/') |
| 178 basePath += '/'; | 177 basePath += '/'; |
| 179 | 178 |
| 180 return PolymerTest.prototype.extraLibraries.map(function(library) { | 179 return PolymerTest.prototype.extraLibraries.map(function(library) { |
| 181 return basePath + library; | 180 return basePath + library; |
| 182 }); | 181 }); |
| 183 }; | 182 }; |
| OLD | NEW |