| 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 site-list. */ | 5 /** @fileoverview Suite of tests for site-list. */ |
| 6 cr.define('site_list', function() { | 6 cr.define('site_list', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('SiteList', function() { | 8 suite('SiteList', function() { |
| 9 /** | 9 /** |
| 10 * A site list element created before each test. | 10 * A site list element created before each test. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 * Configures the test element as a location category. | 132 * Configures the test element as a location category. |
| 133 * @param {settings.PermissionValues} subtype Type of list to use: ALLOW | 133 * @param {settings.PermissionValues} subtype Type of list to use: ALLOW |
| 134 * or BLOCK. | 134 * or BLOCK. |
| 135 * @param {dictionary} prefs The prefs to use. | 135 * @param {dictionary} prefs The prefs to use. |
| 136 */ | 136 */ |
| 137 function setupLocationCategory(subtype, prefs) { | 137 function setupLocationCategory(subtype, prefs) { |
| 138 testElement.category = settings.ContentSettingsTypes.GEOLOCATION; | 138 testElement.category = settings.ContentSettingsTypes.GEOLOCATION; |
| 139 testElement.categorySubtype = subtype; | 139 testElement.categorySubtype = subtype; |
| 140 testElement.categoryEnabled = true; | 140 testElement.categoryEnabled = true; |
| 141 testElement.prefs = prefs; | 141 testElement.prefs = prefs; |
| 142 testElement.currentRoute = { |
| 143 page: 'dummy', |
| 144 section: 'privacy', |
| 145 subpage: ['site-settings', 'site-settings-category-location'], |
| 146 }; |
| 142 } | 147 } |
| 143 | 148 |
| 144 test('Empty list', function() { | 149 test('Empty list', function() { |
| 145 setupLocationCategory(settings.PermissionValues.ALLOW, prefsEmpty); | 150 setupLocationCategory(settings.PermissionValues.ALLOW, prefsEmpty); |
| 146 return CrSettingsPrefs.initialized.then(function() { | 151 return CrSettingsPrefs.initialized.then(function() { |
| 147 assertEquals(0, testElement.sites_.length); | 152 assertEquals(0, testElement.sites_.length); |
| 148 | 153 |
| 149 assertTrue(testElement.isAllowList_()); | 154 assertTrue(testElement.isAllowList_()); |
| 150 assertFalse(testElement.showSiteList_(testElement.sites_, true)); | 155 assertFalse(testElement.showSiteList_(testElement.sites_, true)); |
| 151 assertFalse(testElement.showSiteList_(testElement.sites_, false)); | 156 assertFalse(testElement.showSiteList_(testElement.sites_, false)); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return CrSettingsPrefs.initialized.then(function() { | 270 return CrSettingsPrefs.initialized.then(function() { |
| 266 assertTrue(testElement.$.category.hidden); | 271 assertTrue(testElement.$.category.hidden); |
| 267 }.bind(this)); | 272 }.bind(this)); |
| 268 }); | 273 }); |
| 269 }); | 274 }); |
| 270 } | 275 } |
| 271 return { | 276 return { |
| 272 registerTests: registerTests, | 277 registerTests: registerTests, |
| 273 }; | 278 }; |
| 274 }); | 279 }); |
| OLD | NEW |