| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** @fileoverview Tests for shared Polymer elements. */ | 5 /** @fileoverview Tests for shared Polymer elements. */ |
| 6 | 6 |
| 7 /** @const {string} Path to source root. */ | 7 /** @const {string} Path to source root. */ |
| 8 var ROOT_PATH = '../../../../../'; | 8 var ROOT_PATH = '../../../../../'; |
| 9 | 9 |
| 10 // Polymer BrowserTest fixture. | 10 // Polymer BrowserTest fixture. |
| 11 GEN_INCLUDE( | 11 GEN_INCLUDE( |
| 12 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']); | 12 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']); |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Test fixture for shared Polymer elements. | 15 * Test fixture for shared Polymer elements. |
| 16 * @constructor | 16 * @constructor |
| 17 * @extends {PolymerTest} | 17 * @extends {PolymerTest} |
| 18 */ | 18 */ |
| 19 function CrElementsBrowserTest() {} | 19 function CrElementsBrowserTest() {} |
| 20 | 20 |
| 21 CrElementsBrowserTest.prototype = { | 21 CrElementsBrowserTest.prototype = { |
| 22 __proto__: PolymerTest.prototype, | 22 __proto__: PolymerTest.prototype, |
| 23 | 23 |
| 24 /** @override */ | 24 /** @override */ |
| 25 extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([ | 25 extraLibraries: PolymerTest.getLibraries(ROOT_PATH), |
| 26 'cr_slider_tests.js', | |
| 27 'cr_toolbar_search_field_tests.js', | |
| 28 ]), | |
| 29 | 26 |
| 30 /** | 27 /** @override */ |
| 31 * Hack: load a page underneath chrome://resources so script errors come | 28 get browsePreload() { |
| 32 * from the same "domain" and can be viewed. HTML imports aren't deduped with | 29 throw 'this is abstract and should be overriden by subclasses'; |
| 33 * the current page, but it should be safe to load assert.html twice. | 30 }, |
| 34 * @override | |
| 35 */ | |
| 36 browsePreload: 'chrome://resources/html/assert.html', | |
| 37 | 31 |
| 38 /** @override */ | 32 /** @override */ |
| 39 setUp: function() { | 33 setUp: function() { |
| 40 PolymerTest.prototype.setUp.call(this); | 34 PolymerTest.prototype.setUp.call(this); |
| 41 // We aren't loading the main document. | 35 // We aren't loading the main document. |
| 42 this.accessibilityAuditConfig.ignoreSelectors('humanLangMissing', 'html'); | 36 this.accessibilityAuditConfig.ignoreSelectors('humanLangMissing', 'html'); |
| 43 }, | 37 }, |
| 44 }; | 38 }; |
| 45 | 39 |
| 46 TEST_F('CrElementsBrowserTest', 'CrToolbarSearchFieldTest', function() { | 40 function CrElementsProfileAvatarSelectorTest() {} |
| 41 |
| 42 CrElementsProfileAvatarSelectorTest.prototype = { |
| 43 __proto__: CrElementsBrowserTest.prototype, |
| 44 |
| 45 /** @override */ |
| 46 browsePreload: |
| 47 'chrome://resources/cr_elements/cr_profile_avatar_selector/' + |
| 48 'cr_profile_avatar_selector.html', |
| 49 |
| 50 /** @override */ |
| 51 extraLibraries: CrElementsBrowserTest.prototype.extraLibraries.concat([ |
| 52 'cr_profile_avatar_selector_tests.js', |
| 53 ]), |
| 54 }; |
| 55 |
| 56 TEST_F('CrElementsProfileAvatarSelectorTest', 'All', function() { |
| 57 cr_profile_avatar_selector.registerTests(); |
| 58 mocha.run(); |
| 59 }); |
| 60 |
| 61 function CrElementsToolbarSearchFieldTest() {} |
| 62 |
| 63 CrElementsToolbarSearchFieldTest.prototype = { |
| 64 __proto__: CrElementsBrowserTest.prototype, |
| 65 |
| 66 /** @override */ |
| 67 browsePreload: |
| 68 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar_search_field.html', |
| 69 |
| 70 /** @override */ |
| 71 extraLibraries: CrElementsBrowserTest.prototype.extraLibraries.concat([ |
| 72 'cr_toolbar_search_field_tests.js', |
| 73 ]), |
| 74 }; |
| 75 |
| 76 TEST_F('CrElementsToolbarSearchFieldTest', 'All', function() { |
| 47 cr_toolbar_search_field.registerTests(); | 77 cr_toolbar_search_field.registerTests(); |
| 48 mocha.run(); | 78 mocha.run(); |
| 49 }); | 79 }); |
| 50 | 80 |
| 51 TEST_F('CrElementsBrowserTest', 'CrSliderTest', function() { | 81 function CrElementsSliderTest() {} |
| 82 |
| 83 CrElementsSliderTest.prototype = { |
| 84 __proto__: CrElementsBrowserTest.prototype, |
| 85 |
| 86 /** @override */ |
| 87 browsePreload: 'chrome://resources/cr_elements/cr_slider/cr_slider.html', |
| 88 |
| 89 /** @override */ |
| 90 extraLibraries: CrElementsBrowserTest.prototype.extraLibraries.concat([ |
| 91 'cr_slider_tests.js', |
| 92 ]), |
| 93 }; |
| 94 |
| 95 TEST_F('CrElementsSliderTest', 'All', function() { |
| 52 cr_slider.registerTests(); | 96 cr_slider.registerTests(); |
| 53 mocha.run(); | 97 mocha.run(); |
| 54 }); | 98 }); |
| OLD | NEW |