| 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 /** @fileoverview Suite of tests for settings-prefs. */ | 5 /** @fileoverview Suite of tests for settings-prefs. */ |
| 6 cr.define('settings_prefs', function() { | 6 cr.define('settings_prefs', function() { |
| 7 /** | 7 /** |
| 8 * Creates a deep copy of the object. | 8 * Creates a deep copy of the object. |
| 9 * @param {!Object} obj | 9 * @param {!Object} obj |
| 10 * @return {!Object} | 10 * @return {!Object} |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return CrSettingsPrefs.initialized; | 102 return CrSettingsPrefs.initialized; |
| 103 }); | 103 }); |
| 104 | 104 |
| 105 teardown(function() { | 105 teardown(function() { |
| 106 CrSettingsPrefs.resetForTesting(); | 106 CrSettingsPrefs.resetForTesting(); |
| 107 CrSettingsPrefs.deferInitialization = false; | 107 CrSettingsPrefs.deferInitialization = false; |
| 108 | 108 |
| 109 // Reset each <settings-prefs>. TODO(michaelpg): make settings-prefs | 109 // Reset each <settings-prefs>. TODO(michaelpg): make settings-prefs |
| 110 // less dependent on testing state so we don't have to do this. | 110 // less dependent on testing state so we don't have to do this. |
| 111 for (var i = 0; i < createdElements.length; i++) | 111 for (var i = 0; i < createdElements.length; i++) |
| 112 createdElements[i].resetForTesting(); | 112 createdElements[i].uninitializeForTesting(); |
| 113 | 113 |
| 114 PolymerTest.clearBody(); | 114 PolymerTest.clearBody(); |
| 115 }); | 115 }); |
| 116 | 116 |
| 117 test('receives and caches prefs', function testGetPrefs() { | 117 test('receives and caches prefs', function testGetPrefs() { |
| 118 // Test that each pref has been successfully copied to the Polymer | 118 // Test that each pref has been successfully copied to the Polymer |
| 119 // |prefs| property. | 119 // |prefs| property. |
| 120 for (var key in fakeApi.prefs) { | 120 for (var key in fakeApi.prefs) { |
| 121 var expectedPref = fakeApi.prefs[key]; | 121 var expectedPref = fakeApi.prefs[key]; |
| 122 var actualPref = getPrefFromKey(prefs.prefs, key); | 122 var actualPref = getPrefFromKey(prefs.prefs, key); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 fakeApi.sendPrefChanges(prefChanges); | 186 fakeApi.sendPrefChanges(prefChanges); |
| 187 assertPrefsSet(1); | 187 assertPrefsSet(1); |
| 188 }); | 188 }); |
| 189 }); | 189 }); |
| 190 } | 190 } |
| 191 | 191 |
| 192 return { | 192 return { |
| 193 registerTests: registerTests, | 193 registerTests: registerTests, |
| 194 }; | 194 }; |
| 195 }); | 195 }); |
| OLD | NEW |