Commit d3c7acf8 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[WebUI] Reformat Settings Tests

The current migration to Polymer 3 mistakenly used `clang-format-on`
instead of `clang-format on` after turning `clang-format` off via
`clang-format off`. This resulted in clang-format effectively being
disabled for affected files, this change fixes it. Steps:

- sed 's/clang-format-on/clang-format on/g'
- git cl format --js --full

TBR=dpapad

Bug: 1026426
Change-Id: I4364d325e3e7df1add0f83d93e8b18453f6014e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107591Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751331}
parent 029ff8f9
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js'; // #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js';
// #import {TestOpenWindowProxy} from 'chrome://test/settings/test_open_window_proxy.m.js'; // #import {TestOpenWindowProxy} from 'chrome://test/settings/test_open_window_proxy.m.js';
// clang-format-on // clang-format on
suite('PasswordsAndForms', function() { suite('PasswordsAndForms', function() {
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// #import {eventToPromise} from 'chrome://test/test_util.m.js'; // #import {eventToPromise} from 'chrome://test/test_util.m.js';
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; // #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// clang-format-on // clang-format on
cr.define('settings_autofill_section', function() { cr.define('settings_autofill_section', function() {
/** /**
......
...@@ -12,15 +12,14 @@ ...@@ -12,15 +12,14 @@
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; // #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js'; // #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js';
// clang-format-on // clang-format on
cr.define('settings_passwords_check', function() { cr.define('settings_passwords_check', function() {
const PasswordCheckState = chrome.passwordsPrivate.PasswordCheckState; const PasswordCheckState = chrome.passwordsPrivate.PasswordCheckState;
function createCheckPasswordSection() { function createCheckPasswordSection() {
// Create a passwords-section to use for testing. // Create a passwords-section to use for testing.
const passwordsSection = const passwordsSection = document.createElement('settings-password-check');
document.createElement('settings-password-check');
document.body.appendChild(passwordsSection); document.body.appendChild(passwordsSection);
Polymer.dom.flush(); Polymer.dom.flush();
return passwordsSection; return passwordsSection;
...@@ -93,8 +92,8 @@ cr.define('settings_passwords_check', function() { ...@@ -93,8 +92,8 @@ cr.define('settings_passwords_check', function() {
* passwordList The expected data. * passwordList The expected data.
* @private * @private
*/ */
function validateLeakedPasswordsList(checkPasswordSection, function validateLeakedPasswordsList(
compromisedCredentials) { checkPasswordSection, compromisedCredentials) {
const listElements = checkPasswordSection.$.leakedPasswordList; const listElements = checkPasswordSection.$.leakedPasswordList;
assertEquals(listElements.items.length, compromisedCredentials.length); assertEquals(listElements.items.length, compromisedCredentials.length);
const nodes = checkPasswordSection.shadowRoot.querySelectorAll( const nodes = checkPasswordSection.shadowRoot.querySelectorAll(
...@@ -287,10 +286,9 @@ cr.define('settings_passwords_check', function() { ...@@ -287,10 +286,9 @@ cr.define('settings_passwords_check', function() {
autofill_test_util.makePasswordCheckStatus( autofill_test_util.makePasswordCheckStatus(
/*state=*/ PasswordCheckState.NO_PASSWORDS); /*state=*/ PasswordCheckState.NO_PASSWORDS);
const section = createCheckPasswordSection(); const section = createCheckPasswordSection();
return passwordManager.whenCalled('getPasswordCheckStatus') return passwordManager.whenCalled('getPasswordCheckStatus').then(() => {
.then(() => { expectFalse(isElementVisible(section.$.controlPasswordCheckButton));
expectFalse(isElementVisible(section.$.controlPasswordCheckButton)); });
});
}); });
// Test verifies that 'Try again' visible and working when users encounter a // Test verifies that 'Try again' visible and working when users encounter a
...@@ -378,15 +376,15 @@ cr.define('settings_passwords_check', function() { ...@@ -378,15 +376,15 @@ cr.define('settings_passwords_check', function() {
// proxy function. // proxy function.
test('testRemovePasswordConfirmationDialog', function() { test('testRemovePasswordConfirmationDialog', function() {
const entry = autofill_test_util.makeCompromisedCredential( const entry = autofill_test_util.makeCompromisedCredential(
'one.com', 'test4', 'LEAKED', 0); 'one.com', 'test4', 'LEAKED', 0);
const removeDialog = createRemovePasswordDialog(entry); const removeDialog = createRemovePasswordDialog(entry);
removeDialog.$.remove.click(); removeDialog.$.remove.click();
return passwordManager.whenCalled('removeCompromisedCredential') return passwordManager.whenCalled('removeCompromisedCredential')
.then(({id, username, formattedOrigin}) => { .then(({id, username, formattedOrigin}) => {
assertEquals(0 , id); assertEquals(0, id);
assertEquals('test4', username); assertEquals('test4', username);
assertEquals('one.com', formattedOrigin); assertEquals('one.com', formattedOrigin);
}); });
}); });
// A changing status is immediately reflected in title, icon and banner. // A changing status is immediately reflected in title, icon and banner.
...@@ -610,8 +608,8 @@ cr.define('settings_passwords_check', function() { ...@@ -610,8 +608,8 @@ cr.define('settings_passwords_check', function() {
const subtitle = section.$.subtitle; const subtitle = section.$.subtitle;
assertTrue(isElementVisible(title)); assertTrue(isElementVisible(title));
assertFalse(isElementVisible(subtitle)); assertFalse(isElementVisible(subtitle));
expectEquals(section.i18n('checkPasswordsDescription'), expectEquals(
title.innerText); section.i18n('checkPasswordsDescription'), title.innerText);
}); });
}); });
...@@ -832,8 +830,8 @@ cr.define('settings_passwords_check', function() { ...@@ -832,8 +830,8 @@ cr.define('settings_passwords_check', function() {
/*state=*/ PasswordCheckState.RUNNING, /*checked=*/ 1, /*state=*/ PasswordCheckState.RUNNING, /*checked=*/ 1,
/*remaining=*/ 5); /*remaining=*/ 5);
data.leakedCredentials = [ data.leakedCredentials = [
autofill_test_util.makeCompromisedCredential( autofill_test_util.makeCompromisedCredential(
'one.com', 'test4', 'LEAKED'), 'one.com', 'test4', 'LEAKED'),
]; ];
const checkPasswordSection = createCheckPasswordSection(); const checkPasswordSection = createCheckPasswordSection();
...@@ -849,8 +847,8 @@ cr.define('settings_passwords_check', function() { ...@@ -849,8 +847,8 @@ cr.define('settings_passwords_check', function() {
data.checkStatus = autofill_test_util.makePasswordCheckStatus( data.checkStatus = autofill_test_util.makePasswordCheckStatus(
/*state=*/ PasswordCheckState.IDLE); /*state=*/ PasswordCheckState.IDLE);
data.leakedCredentials = [ data.leakedCredentials = [
autofill_test_util.makeCompromisedCredential( autofill_test_util.makeCompromisedCredential(
'one.com', 'test4', 'LEAKED'), 'one.com', 'test4', 'LEAKED'),
]; ];
const checkPasswordSection = createCheckPasswordSection(); const checkPasswordSection = createCheckPasswordSection();
...@@ -866,8 +864,8 @@ cr.define('settings_passwords_check', function() { ...@@ -866,8 +864,8 @@ cr.define('settings_passwords_check', function() {
data.checkStatus = autofill_test_util.makePasswordCheckStatus( data.checkStatus = autofill_test_util.makePasswordCheckStatus(
/*state=*/ PasswordCheckState.CANCELED); /*state=*/ PasswordCheckState.CANCELED);
data.leakedCredentials = [ data.leakedCredentials = [
autofill_test_util.makeCompromisedCredential( autofill_test_util.makeCompromisedCredential(
'one.com', 'test4', 'LEAKED'), 'one.com', 'test4', 'LEAKED'),
]; ];
const checkPasswordSection = createCheckPasswordSection(); const checkPasswordSection = createCheckPasswordSection();
...@@ -954,7 +952,7 @@ cr.define('settings_passwords_check', function() { ...@@ -954,7 +952,7 @@ cr.define('settings_passwords_check', function() {
// Verify that the edit dialog has become visible. // Verify that the edit dialog has become visible.
Polymer.dom.flush(); Polymer.dom.flush();
assertTrue(!!checkPasswordSection.$$( assertTrue(!!checkPasswordSection.$$(
'settings-password-check-edit-dialog')); 'settings-password-check-edit-dialog'));
}); });
}); });
...@@ -984,8 +982,8 @@ cr.define('settings_passwords_check', function() { ...@@ -984,8 +982,8 @@ cr.define('settings_passwords_check', function() {
editDialog.$.passwordInput.value = 'yadhtribym'; editDialog.$.passwordInput.value = 'yadhtribym';
editDialog.$.cancel.click(); editDialog.$.cancel.click();
assertEquals(0, assertEquals(
passwordManager.getCallCount('changeCompromisedCredential')); 0, passwordManager.getCallCount('changeCompromisedCredential'));
}); });
}); });
// #cr_define_end // #cr_define_end
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js'; // #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js';
// #import {getSyncAllPrefs, simulateSyncStatus} from 'chrome://test/settings/sync_test_util.m.js'; // #import {getSyncAllPrefs, simulateSyncStatus} from 'chrome://test/settings/sync_test_util.m.js';
// #import {isChromeOS} from 'chrome://resources/js/cr.m.js'; // #import {isChromeOS} from 'chrome://resources/js/cr.m.js';
// clang-format-on // clang-format on
cr.define('settings_passwords_section', function() { cr.define('settings_passwords_section', function() {
const PasswordCheckState = chrome.passwordsPrivate.PasswordCheckState; const PasswordCheckState = chrome.passwordsPrivate.PasswordCheckState;
...@@ -33,8 +33,8 @@ cr.define('settings_passwords_section', function() { ...@@ -33,8 +33,8 @@ cr.define('settings_passwords_section', function() {
const listElement = passwordsSection.$.passwordList; const listElement = passwordsSection.$.passwordList;
assertEquals(passwordList.length, listElement.items.length); assertEquals(passwordList.length, listElement.items.length);
for (let index = 0; index < passwordList.length; ++index) { for (let index = 0; index < passwordList.length; ++index) {
const listItems = passwordsSection.shadowRoot.querySelectorAll( const listItems =
'password-list-item'); passwordsSection.shadowRoot.querySelectorAll('password-list-item');
const node = listItems[index]; const node = listItems[index];
assertTrue(!!node); assertTrue(!!node);
const passwordInfo = passwordList[index]; const passwordInfo = passwordList[index];
...@@ -127,7 +127,7 @@ cr.define('settings_passwords_section', function() { ...@@ -127,7 +127,7 @@ cr.define('settings_passwords_section', function() {
let elementFactory = null; let elementFactory = null;
suiteSetup(function() { suiteSetup(function() {
loadTimeData.overrideValues({enablePasswordCheck: true}); loadTimeData.overrideValues({enablePasswordCheck: true});
}); });
setup(function() { setup(function() {
...@@ -925,10 +925,8 @@ cr.define('settings_passwords_section', function() { ...@@ -925,10 +925,8 @@ cr.define('settings_passwords_section', function() {
passwordsSection.$$('#checkPasswordsBannerContainer').hidden); passwordsSection.$$('#checkPasswordsBannerContainer').hidden);
assertTrue(passwordsSection.$$('#checkPasswordsButton').hidden); assertTrue(passwordsSection.$$('#checkPasswordsButton').hidden);
assertFalse(passwordsSection.$$('#checkPasswordsLinkRow').hidden); assertFalse(passwordsSection.$$('#checkPasswordsLinkRow').hidden);
assertTrue( assertTrue(passwordsSection.$$('#checkPasswordLeakDescription').hidden);
passwordsSection.$$('#checkPasswordLeakDescription').hidden); assertFalse(passwordsSection.$$('#checkPasswordWarningIcon').hidden);
assertFalse(
passwordsSection.$$('#checkPasswordWarningIcon').hidden);
assertFalse(passwordsSection.$$('#checkPasswordLeakCount').hidden); assertFalse(passwordsSection.$$('#checkPasswordLeakCount').hidden);
}); });
}); });
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; // #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// #import {MockTimer} from 'chrome://test/mock_timer.m.js'; // #import {MockTimer} from 'chrome://test/mock_timer.m.js';
// #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js'; // #import {TestPasswordManagerProxy} from 'chrome://test/settings/test_password_manager_proxy.m.js';
// clang-format-on // clang-format on
cr.define('settings_passwords_section_cros', function() { cr.define('settings_passwords_section_cros', function() {
suite('PasswordsSection_Cros', function() { suite('PasswordsSection_Cros', function() {
...@@ -78,8 +78,8 @@ cr.define('settings_passwords_section_cros', function() { ...@@ -78,8 +78,8 @@ cr.define('settings_passwords_section_cros', function() {
const dialog = super.createExportPasswordsDialog(passwordManager); const dialog = super.createExportPasswordsDialog(passwordManager);
dialog.tokenRequestManager = new settings.BlockingRequestManager(); dialog.tokenRequestManager = new settings.BlockingRequestManager();
return overrideRequestManager ? return overrideRequestManager ?
Object.assign(dialog, Object.assign(
{tokenRequestManager: this.tokenRequestManager}) : dialog, {tokenRequestManager: this.tokenRequestManager}) :
dialog; dialog;
} }
...@@ -208,15 +208,15 @@ cr.define('settings_passwords_section_cros', function() { ...@@ -208,15 +208,15 @@ cr.define('settings_passwords_section_cros', function() {
// Note (rbpotter): this passes locally, but may still be flaky (see // Note (rbpotter): this passes locally, but may still be flaky (see
// https://www.crbug.com/1021474) // https://www.crbug.com/1021474)
test.skip('password-prompt-dialog appears on auth token request', test.skip(
function() { 'password-prompt-dialog appears on auth token request', function() {
const passwordsSection = const passwordsSection =
elementFactory.createPasswordsSection(passwordManager); elementFactory.createPasswordsSection(passwordManager);
assertTrue(!passwordsSection.$$('settings-password-prompt-dialog')); assertTrue(!passwordsSection.$$('settings-password-prompt-dialog'));
passwordsSection.tokenRequestManager_.request(fail); passwordsSection.tokenRequestManager_.request(fail);
Polymer.dom.flush(); Polymer.dom.flush();
assertTrue(!!passwordsSection.$$('settings-password-prompt-dialog')); assertTrue(!!passwordsSection.$$('settings-password-prompt-dialog'));
}); });
// Note (rbpotter): this fails locally, possibly out of date // Note (rbpotter): this fails locally, possibly out of date
test.skip( test.skip(
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {eventToPromise, isVisible, whenAttributeIs} from 'chrome://test/test_util.m.js'; // #import {eventToPromise, isVisible, whenAttributeIs} from 'chrome://test/test_util.m.js';
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; // #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// clang-format-on // clang-format on
cr.define('settings_payments_section', function() { cr.define('settings_payments_section', function() {
suite('PaymentSectionUiTest', function() { suite('PaymentSectionUiTest', function() {
...@@ -627,8 +627,7 @@ cr.define('settings_payments_section', function() { ...@@ -627,8 +627,7 @@ cr.define('settings_payments_section', function() {
const result = await testMetricsBrowserProxy.whenCalled( const result = await testMetricsBrowserProxy.whenCalled(
'recordSettingsPageHistogram'); 'recordSettingsPageHistogram');
assertEquals( assertEquals(settings.PrivacyElementInteractions.PAYMENT_METHOD, result);
settings.PrivacyElementInteractions.PAYMENT_METHOD, result);
}); });
}); });
// #cr_define_end // #cr_define_end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment