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