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

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

Issue 2854753002: [MD settings] clear incognito only checkbox (Closed)
Patch Set: review changes Created 3 years, 7 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
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 /** 7 /**
8 * An example pref with 2 blocked location items and 2 allowed. This pref 8 * An example pref with 2 blocked location items and 2 allowed. This pref
9 * is also used for the All Sites category and therefore needs values for 9 * is also used for the All Sites category and therefore needs values for
10 * all types, even though some might be blank. 10 * all types, even though some might be blank.
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 /** @type {AddSiteDialogElement} */ var dialog; 1154 /** @type {AddSiteDialogElement} */ var dialog;
1155 1155
1156 setup(function() { 1156 setup(function() {
1157 browserProxy = new TestSiteSettingsPrefsBrowserProxy(); 1157 browserProxy = new TestSiteSettingsPrefsBrowserProxy();
1158 settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy; 1158 settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy;
1159 PolymerTest.clearBody(); 1159 PolymerTest.clearBody();
1160 dialog = document.createElement('add-site-dialog'); 1160 dialog = document.createElement('add-site-dialog');
1161 dialog.category = settings.ContentSettingsTypes.GEOLOCATION; 1161 dialog.category = settings.ContentSettingsTypes.GEOLOCATION;
1162 dialog.contentSetting = settings.PermissionValues.ALLOW; 1162 dialog.contentSetting = settings.PermissionValues.ALLOW;
1163 document.body.appendChild(dialog); 1163 document.body.appendChild(dialog);
1164 dialog.open();
1164 }); 1165 });
1165 1166
1166 teardown(function() { 1167 teardown(function() {
1167 dialog.remove(); 1168 dialog.remove();
1168 }); 1169 });
1169 1170
1171 test('incognito', function() {
1172 cr.webUIListenerCallback(
1173 'onIncognitoStatusChanged',
1174 /*hasIncognito=*/true);
1175 assertFalse(dialog.$.incognito.checked);
1176 dialog.$.incognito.checked = true;
1177 // Changing the incognito status will reset the checkbox.
1178 cr.webUIListenerCallback(
1179 'onIncognitoStatusChanged',
1180 /*hasIncognito=*/false);
1181 assertFalse(dialog.$.incognito.checked);
1182 });
1183
1170 test('invalid input', function() { 1184 test('invalid input', function() {
1171 // Initially the action button should be disabled, but the error warning 1185 // Initially the action button should be disabled, but the error warning
1172 // should not be shown for an empty input. 1186 // should not be shown for an empty input.
1173 var input = dialog.$$('paper-input'); 1187 var input = dialog.$$('paper-input');
1174 assertTrue(!!input); 1188 assertTrue(!!input);
1175 assertFalse(input.invalid); 1189 assertFalse(input.invalid);
1176 1190
1177 var actionButton = dialog.$.add; 1191 var actionButton = dialog.$.add;
1178 assertTrue(!!actionButton); 1192 assertTrue(!!actionButton);
1179 assertTrue(actionButton.disabled); 1193 assertTrue(actionButton.disabled);
1180 1194
1181 // Simulate user input of invalid text. 1195 // Simulate user input of invalid text.
1182 browserProxy.setIsPatternValid(false); 1196 browserProxy.setIsPatternValid(false);
1183 var expectedPattern = 'foobarbaz'; 1197 var expectedPattern = 'foobarbaz';
1184 input.value = expectedPattern; 1198 input.value = expectedPattern;
1185 input.fire('input'); 1199 input.fire('input');
1186 1200
1187 return browserProxy.whenCalled('isPatternValid').then(function(pattern) { 1201 return browserProxy.whenCalled('isPatternValid').then(function(pattern) {
1188 assertEquals(expectedPattern, pattern); 1202 assertEquals(expectedPattern, pattern);
1189 assertTrue(actionButton.disabled); 1203 assertTrue(actionButton.disabled);
1190 assertTrue(input.invalid); 1204 assertTrue(input.invalid);
1191 }); 1205 });
1192 }); 1206 });
1193 }); 1207 });
1194 1208
1195 return { 1209 return {
1196 registerTests: registerTests, 1210 registerTests: registerTests,
1197 }; 1211 };
1198 }); 1212 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698