| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * TestFixture for testing the formatting of settings pages. | 6 * TestFixture for testing the formatting of settings pages. |
| 7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
| 8 * @constructor | 8 * @constructor |
| 9 */ | 9 */ |
| 10 function SettingsFormatWebUITest() {} | 10 function SettingsFormatWebUITest() {} |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 /** | 39 /** |
| 40 * Navigate to browser settings. | 40 * Navigate to browser settings. |
| 41 */ | 41 */ |
| 42 browsePreload: 'chrome://settings-frame/', | 42 browsePreload: 'chrome://settings-frame/', |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * List of errors generated during a test. Used instead of expect* functions | 45 * List of errors generated during a test. Used instead of expect* functions |
| 46 * to suppress verbosity. The implementation of errorsToMessage in the | 46 * to suppress verbosity. The implementation of errorsToMessage in the |
| 47 * testing API generates a call stack for each error produced which greatly | 47 * testing API generates a call stack for each error produced which greatly |
| 48 * reduces readability. | 48 * reduces readability. |
| 49 * @type {Array.<string>} | 49 * @type {Array<string>} |
| 50 */ | 50 */ |
| 51 errors: null, | 51 errors: null, |
| 52 | 52 |
| 53 setUp: function() { | 53 setUp: function() { |
| 54 this.errors = []; | 54 this.errors = []; |
| 55 }, | 55 }, |
| 56 | 56 |
| 57 tearDown: function() { | 57 tearDown: function() { |
| 58 assertTrue(this.errors.length == 0, '\n' + this.errors.join('\n')); | 58 assertTrue(this.errors.length == 0, '\n' + this.errors.join('\n')); |
| 59 }, | 59 }, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 if (element.name && element.value) | 92 if (element.name && element.value) |
| 93 return element.name + '-' + element.value; | 93 return element.name + '-' + element.value; |
| 94 | 94 |
| 95 return this.getLabel(element.parentNode); | 95 return this.getLabel(element.parentNode); |
| 96 }, | 96 }, |
| 97 | 97 |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Checks if the node is exempt from following the formatting rule. | 100 * Checks if the node is exempt from following the formatting rule. |
| 101 * @param {!Element} element The candidate element. | 101 * @param {!Element} element The candidate element. |
| 102 * @param {Array.<string>} filters List of exemptions. | 102 * @param {Array<string>} filters List of exemptions. |
| 103 * @return {boolean} True if the element is exempt. | 103 * @return {boolean} True if the element is exempt. |
| 104 */ | 104 */ |
| 105 isExempt: function(element, filters) { | 105 isExempt: function(element, filters) { |
| 106 var target = this.getLabel(element); | 106 var target = this.getLabel(element); |
| 107 for (var i = 0; i < filters.length; i++) { | 107 for (var i = 0; i < filters.length; i++) { |
| 108 if (filters[i] == target) | 108 if (filters[i] == target) |
| 109 return true; | 109 return true; |
| 110 } | 110 } |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 var elements = document.querySelectorAll('input[type=radio]'); | 149 var elements = document.querySelectorAll('input[type=radio]'); |
| 150 for (var i = 0; i < elements.length; i++) { | 150 for (var i = 0; i < elements.length; i++) { |
| 151 var element = elements[i]; | 151 var element = elements[i]; |
| 152 if (!element.name) | 152 if (!element.name) |
| 153 this.fail('MISSING_RADIO_BUTTON_NAME', element); | 153 this.fail('MISSING_RADIO_BUTTON_NAME', element); |
| 154 | 154 |
| 155 if (!element.getAttribute('value')) | 155 if (!element.getAttribute('value')) |
| 156 this.fail('MISSING_RADIO_BUTTON_VALUE', element); | 156 this.fail('MISSING_RADIO_BUTTON_VALUE', element); |
| 157 } | 157 } |
| 158 }); | 158 }); |
| OLD | NEW |