Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/test/data/webui/settings/site_list_tests.js

Issue 2044963003: Site Settings Desktop: Change how adding site exceptions work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_settings_category.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 function(contentType) { 313 function(contentType) {
314 assertEquals( 314 assertEquals(
315 settings.ContentSettingsTypes.GEOLOCATION, contentType); 315 settings.ContentSettingsTypes.GEOLOCATION, contentType);
316 316
317 assertEquals(0, testElement.sites.length); 317 assertEquals(0, testElement.sites.length);
318 318
319 assertEquals( 319 assertEquals(
320 settings.PermissionValues.ALLOW, testElement.categorySubtype); 320 settings.PermissionValues.ALLOW, testElement.categorySubtype);
321 assertEquals('Allow - 0', testElement.$.header.innerText.trim()); 321 assertEquals('Allow - 0', testElement.$.header.innerText.trim());
322 322
323 // Site list should not show, no matter what category default is set 323 assertFalse(testElement.$.category.hidden);
324 // to.
325 assertTrue(testElement.$.category.hidden);
326 browserProxy.resetResolver('getExceptionList'); 324 browserProxy.resetResolver('getExceptionList');
327 testElement.categoryEnabled = false; 325 testElement.categoryEnabled = false;
328 return browserProxy.whenCalled('getExceptionList').then( 326 return browserProxy.whenCalled('getExceptionList').then(
329 function(contentType) { 327 function(contentType) {
330 assertTrue(testElement.$.category.hidden); 328 assertFalse(testElement.$.category.hidden);
331 assertEquals('Exceptions - 0', 329 assertEquals('Exceptions - 0',
332 testElement.$.header.innerText.trim()); 330 testElement.$.header.innerText.trim());
333 }); 331 });
334 }); 332 });
335 }); 333 });
336 334
337 test('initial ALLOW state is correct', function() { 335 test('initial ALLOW state is correct', function() {
338 setupLocationCategory(settings.PermissionValues.ALLOW, prefs); 336 setupLocationCategory(settings.PermissionValues.ALLOW, prefs);
339 return browserProxy.whenCalled('getExceptionList').then( 337 return browserProxy.whenCalled('getExceptionList').then(
340 function(contentType) { 338 function(contentType) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 assertEquals( 468 assertEquals(
471 settings.ContentSettingsTypes.GEOLOCATION, contentType); 469 settings.ContentSettingsTypes.GEOLOCATION, contentType);
472 470
473 assertFalse(testElement.$.category.hidden); 471 assertFalse(testElement.$.category.hidden);
474 assertTrue(testElement.$.category.opened); 472 assertTrue(testElement.$.category.opened);
475 }).then(function() { 473 }).then(function() {
476 assertNotEquals(0, testElement.$.listContainer.offsetHeight); 474 assertNotEquals(0, testElement.$.listContainer.offsetHeight);
477 }); 475 });
478 }); 476 });
479 477
480 test('Block list hidden when empty', function() { 478 test('Block list not hidden when empty', function() {
481 // Prefs: One item in Allow list, nothing in Block list. 479 // Prefs: One item in Allow list, nothing in Block list.
482 setupLocationCategory( 480 setupLocationCategory(
483 settings.PermissionValues.BLOCK, prefsOneEnabled); 481 settings.PermissionValues.BLOCK, prefsOneEnabled);
484 return browserProxy.whenCalled('getExceptionList').then( 482 return browserProxy.whenCalled('getExceptionList').then(
485 function(contentType) { 483 function(contentType) {
486 assertEquals( 484 assertEquals(
487 settings.ContentSettingsTypes.GEOLOCATION, contentType); 485 settings.ContentSettingsTypes.GEOLOCATION, contentType);
488 486
489 assertTrue(testElement.$.category.hidden); 487 assertFalse(testElement.$.category.hidden);
490 }); 488 });
491 }); 489 });
492 490
493 test('Allow list hidden when empty', function() { 491 test('Allow list not hidden when empty', function() {
494 // Prefs: One item in Block list, nothing in Allow list. 492 // Prefs: One item in Block list, nothing in Allow list.
495 setupLocationCategory(settings.PermissionValues.ALLOW, 493 setupLocationCategory(settings.PermissionValues.ALLOW,
496 prefsOneDisabled); 494 prefsOneDisabled);
497 return browserProxy.whenCalled('getExceptionList').then( 495 return browserProxy.whenCalled('getExceptionList').then(
498 function(contentType) { 496 function(contentType) {
499 assertEquals( 497 assertEquals(
500 settings.ContentSettingsTypes.GEOLOCATION, contentType); 498 settings.ContentSettingsTypes.GEOLOCATION, contentType);
501 499
502 assertTrue(testElement.$.category.hidden); 500 assertFalse(testElement.$.category.hidden);
503 }); 501 });
504 }); 502 });
505 503
506 test('All sites category', function() { 504 test('All sites category', function() {
507 // Prefs: Multiple and overlapping sites. 505 // Prefs: Multiple and overlapping sites.
508 setupAllSitesCategory(prefsVarious); 506 setupAllSitesCategory(prefsVarious);
509 507
510 return browserProxy.whenCalled('getExceptionList').then( 508 return browserProxy.whenCalled('getExceptionList').then(
511 function(contentType) { 509 function(contentType) {
512 // Use resolver to ensure asserts bubble up to the framework with 510 // Use resolver to ensure asserts bubble up to the framework with
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 function(contentType) { 593 function(contentType) {
596 // No further checks needed. If this fails, it will hang the test. 594 // No further checks needed. If this fails, it will hang the test.
597 }); 595 });
598 }); 596 });
599 }); 597 });
600 } 598 }
601 return { 599 return {
602 registerTests: registerTests, 600 registerTests: registerTests,
603 }; 601 };
604 }); 602 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_settings_category.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698