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

Unified Diff: chrome/browser/ui/webui/options/manage_profile_browsertest.js

Issue 220593003: [Canceled] Show a "downloads in progress" warning in the delete profile overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/manage_profile_browsertest.js
diff --git a/chrome/browser/ui/webui/options/manage_profile_browsertest.js b/chrome/browser/ui/webui/options/manage_profile_browsertest.js
index 950d1b8e21d7d28e5aad305d051acacca03155a7..341c22bd7281e65d7cef351dfd29c37d401f17f8 100644
--- a/chrome/browser/ui/webui/options/manage_profile_browsertest.js
+++ b/chrome/browser/ui/webui/options/manage_profile_browsertest.js
@@ -517,4 +517,48 @@ TEST_F('ManageProfileUITest', 'ManagedDelete', function() {
assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
});
+// If there are any downloads in progress when a profile is deleted, an extra
+// warning message should be shown.
+TEST_F('ManageProfileUITest', 'DeleteDownloadMessage', function() {
+ // Override chrome.send to intercept requestProfileInProgressDownloads.
+ var originalChromeSend = chrome.send;
+ var requestCount = 0;
+ chrome.send = function(message, args) {
+ if (message === 'requestProfileInProgressDownloads') {
+ // Count received message and ignore.
+ ++requestCount;
+ } else {
+ originalChromeSend(message, args);
+ }
+ };
+
+ ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
+ // Make sure we actually intercepted the request.
+ assertEquals(1, requestCount);
+
+ var addendumSingle = $('delete-profile-single-download-addendum');
+ var addendumMulti = $('delete-profile-multiple-downloads-addendum');
+
+ // Initially, the download warnings should be hidden.
+ expectTrue(addendumSingle.hidden);
+ expectTrue(addendumMulti.hidden);
+
+ // If there is one download, the corresponding message should show up.
+ ManageProfileOverlay.receiveDownloadCount(1);
+ expectFalse(addendumSingle.hidden);
+ expectTrue(addendumMulti.hidden);
+
+ // If there are no downloads, both messages should be hidden.
+ ManageProfileOverlay.receiveDownloadCount(0);
+ expectTrue(addendumSingle.hidden);
+ expectTrue(addendumMulti.hidden);
+
+ // If there are multiple downloads, the corresponding message should show up.
+ ManageProfileOverlay.receiveDownloadCount(2);
+ expectTrue(addendumSingle.hidden);
+ expectFalse(addendumMulti.hidden);
+
+ chrome.send = originalChromeSend;
+});
+
GEN('#endif // OS_CHROMEOS');
« no previous file with comments | « chrome/browser/resources/options/manage_profile_overlay.js ('k') | chrome/browser/ui/webui/options/manage_profile_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698