Commit 9b832114 authored by Christos Froussios's avatar Christos Froussios Committed by Commit Bot

[Password Manager] Reduce minimum time for showing the export progress

The "busy exporting" dialog is shown for at least 2 seconds, to avoid
flashing when exporting happens fast. We reduce this time to 1 seconds,
as suggested by UX.

Bug: 789561
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ibeb1c3736d914ee1d83814dfdc9d3a902fed1796
Reviewed-on: https://chromium-review.googlesource.com/918562Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Christos Froussios <cfroussios@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536973}
parent 7315b5e3
...@@ -33,7 +33,7 @@ const progressBarDelayMs = 100; ...@@ -33,7 +33,7 @@ const progressBarDelayMs = 100;
* The minimum amount of time (ms) that the progress bar will be visible. * The minimum amount of time (ms) that the progress bar will be visible.
* @type {number} * @type {number}
*/ */
const progressBarBlockMs = 2000; const progressBarBlockMs = 1000;
Polymer({ Polymer({
is: 'passwords-export-dialog', is: 'passwords-export-dialog',
...@@ -67,16 +67,16 @@ Polymer({ ...@@ -67,16 +67,16 @@ Polymer({
/** /**
* The task that will display the completion of the export, if any. We display * The task that will display the completion of the export, if any. We display
* the progress bar for at least 2000ms, therefore, if export finishes * the progress bar for at least |progressBarBlockMs|, therefore, if export
* earlier, we cache the result in |delayedProgress_| and this task will * finishes earlier, we cache the result in |delayedProgress_| and this task
* consume it. This is null, unless the task is currently scheduled. * will consume it. This is null, unless the task is currently scheduled.
* @private {?number} * @private {?number}
*/ */
delayedCompletionToken_: null, delayedCompletionToken_: null,
/** /**
* We display the progress bar for at least 2000ms. If progress is achieved * We display the progress bar for at least |progressBarBlockMs|. If progress
* earlier, we store the update here and consume it later. * is achieved earlier, we store the update here and consume it later.
* @private {?PasswordManager.PasswordExportProgress} * @private {?PasswordManager.PasswordExportProgress}
*/ */
delayedProgress_: null, delayedProgress_: null,
......
...@@ -672,7 +672,7 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { ...@@ -672,7 +672,7 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() {
}); });
// Test the export flow. If exporting is slow, Chrome should show the // Test the export flow. If exporting is slow, Chrome should show the
// in-progress dialog for at least 2000ms. // in-progress dialog for at least 1000ms.
test('exportFlowSlow', function(done) { test('exportFlowSlow', function(done) {
const exportDialog = createExportPasswordsDialog(passwordManager); const exportDialog = createExportPasswordsDialog(passwordManager);
const progressCallback = passwordManager.progressCallback; const progressCallback = passwordManager.progressCallback;
...@@ -690,7 +690,7 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { ...@@ -690,7 +690,7 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() {
assertTrue(exportDialog.$.dialog_start.open); assertTrue(exportDialog.$.dialog_start.open);
// After 100ms of not having completed, the dialog switches to the // After 100ms of not having completed, the dialog switches to the
// progress bar. Chrome will continue to show the progress bar for 2000ms, // progress bar. Chrome will continue to show the progress bar for 1000ms,
// despite a completion event. // despite a completion event.
mockTimer.tick(99); mockTimer.tick(99);
assertTrue(exportDialog.$.dialog_start.open); assertTrue(exportDialog.$.dialog_start.open);
...@@ -700,8 +700,8 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { ...@@ -700,8 +700,8 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() {
{status: chrome.passwordsPrivate.ExportProgressStatus.SUCCEEDED}); {status: chrome.passwordsPrivate.ExportProgressStatus.SUCCEEDED});
assertTrue(exportDialog.$.dialog_progress.open); assertTrue(exportDialog.$.dialog_progress.open);
// After 2000ms, Chrome will display the completion event. // After 1000ms, Chrome will display the completion event.
mockTimer.tick(1999); mockTimer.tick(999);
assertTrue(exportDialog.$.dialog_progress.open); assertTrue(exportDialog.$.dialog_progress.open);
mockTimer.tick(1); mockTimer.tick(1);
// On SUCCEEDED the dialog closes completely. // On SUCCEEDED the dialog closes completely.
......
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