Commit b09e0b6c authored by Alex Ilin's avatar Alex Ilin Committed by Chromium LUCI CQ

[ProiflePicker] Close the remove confirmation dialog after deletion

https://crrev.com/c/2615350 introduced a bug when deleting any profile
that is not the lst in the list. The profile gets deleted, the list
updates in background but the dialog stays open with info about the next
profile in the list.

The dialog should be explicitly closed from profile_card_menu.js

Bug: 1063856
Change-Id: I1688b19300fd7dc89893393bac239ed7163de4a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627520
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Commit-Queue: Monica Basta <msalama@chromium.org>
Auto-Submit: Alex Ilin <alexilin@chromium.org>
Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843516}
parent e3aaf8d4
...@@ -109,7 +109,7 @@ Polymer({ ...@@ -109,7 +109,7 @@ Polymer({
this.addWebUIListener( this.addWebUIListener(
'profiles-list-changed', () => this.handleProfilesUpdated_()); 'profiles-list-changed', () => this.handleProfilesUpdated_());
this.addWebUIListener( this.addWebUIListener(
'profile-removed', () => this.handleProfilesUpdated_()); 'profile-removed', this.handleProfileRemoved_.bind(this));
this.addWebUIListener( this.addWebUIListener(
'profile-statistics-received', 'profile-statistics-received',
this.handleProfileStatsReceived_.bind(this)); this.handleProfileStatsReceived_.bind(this));
...@@ -221,6 +221,18 @@ Polymer({ ...@@ -221,6 +221,18 @@ Polymer({
this.$.actionMenu.close(); this.$.actionMenu.close();
}, },
/**
* Closes the remove confirmation dialog when the profile is removed.
* @param {string} profilePath
* @private
*/
handleProfileRemoved_(profilePath) {
this.handleProfilesUpdated_();
if (this.profileState.profilePath === profilePath) {
this.$.removeConfirmationDialog.close();
}
},
/** @private */ /** @private */
onCustomizeButtonClicked_() { onCustomizeButtonClicked_() {
this.manageProfilesBrowserProxy_.openManageProfileSettingsSubPage( this.manageProfilesBrowserProxy_.openManageProfileSettingsSubPage(
......
...@@ -89,6 +89,7 @@ js_library("profile_card_menu_test") { ...@@ -89,6 +89,7 @@ js_library("profile_card_menu_test") {
"..:test_browser_proxy.m", "..:test_browser_proxy.m",
"..:test_util.m", "..:test_util.m",
"//chrome/browser/resources/signin/profile_picker:profile_card_menu", "//chrome/browser/resources/signin/profile_picker:profile_card_menu",
"//ui/webui/resources/js:cr.m",
] ]
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import {ManageProfilesBrowserProxyImpl, ProfileState} from 'chrome://profile-picker/profile_picker.js'; import {ManageProfilesBrowserProxyImpl, ProfileState} from 'chrome://profile-picker/profile_picker.js';
import {webUIListenerCallback} from 'chrome://resources/js/cr.m.js';
import {assertEquals, assertFalse, assertTrue} from '../chai_assert.js'; import {assertEquals, assertFalse, assertTrue} from '../chai_assert.js';
import {waitBeforeNextRender} from '../test_util.m.js'; import {waitBeforeNextRender} from '../test_util.m.js';
...@@ -95,5 +96,7 @@ suite('ProfileCardMenuTest', function() { ...@@ -95,5 +96,7 @@ suite('ProfileCardMenuTest', function() {
assertTrue(dialog.open); assertTrue(dialog.open);
dialog.querySelector('.action-button').click(); dialog.querySelector('.action-button').click();
await browserProxy.whenCalled('removeProfile'); await browserProxy.whenCalled('removeProfile');
webUIListenerCallback('profile-removed', 'profilePath');
assertFalse(dialog.open);
}); });
}); });
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