OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // None of these tests is relevant for Chrome OS. | 5 // None of these tests is relevant for Chrome OS. |
6 GEN('#if !defined(OS_CHROMEOS)'); | 6 GEN('#if !defined(OS_CHROMEOS)'); |
7 | 7 |
8 /** | 8 /** |
9 * TestFixture for ManageProfileOverlay and CreateProfileOverlay WebUI testing. | 9 * TestFixture for ManageProfileOverlay and CreateProfileOverlay WebUI testing. |
10 * @extends {testing.Test} | 10 * @extends {testing.Test} |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 assertEquals('deleteProfile', messages[0]); | 510 assertEquals('deleteProfile', messages[0]); |
511 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); | 511 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); |
512 | 512 |
513 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); | 513 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); |
514 this.setProfileManaged_(true, 'manage'); | 514 this.setProfileManaged_(true, 'manage'); |
515 messages = clickAndListen(); | 515 messages = clickAndListen(); |
516 assertEquals(0, messages.length); | 516 assertEquals(0, messages.length); |
517 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); | 517 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); |
518 }); | 518 }); |
519 | 519 |
| 520 // If there are any downloads in progress when a profile is deleted, an extra |
| 521 // warning message should be shown. |
| 522 TEST_F('ManageProfileUITest', 'DeleteDownloadMessage', function() { |
| 523 // Override chrome.send to intercept requestProfileInProgressDownloads. |
| 524 var originalChromeSend = chrome.send; |
| 525 var requestCount = 0; |
| 526 chrome.send = function(message, args) { |
| 527 if (message === 'requestProfileInProgressDownloads') { |
| 528 // Count received message and ignore. |
| 529 ++requestCount; |
| 530 } else { |
| 531 originalChromeSend(message, args); |
| 532 } |
| 533 }; |
| 534 |
| 535 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); |
| 536 // Make sure we actually intercepted the request. |
| 537 assertEquals(1, requestCount); |
| 538 |
| 539 var addendumSingle = $('delete-profile-single-download-addendum'); |
| 540 var addendumMulti = $('delete-profile-multiple-downloads-addendum'); |
| 541 |
| 542 // Initially, the download warnings should be hidden. |
| 543 expectTrue(addendumSingle.hidden); |
| 544 expectTrue(addendumMulti.hidden); |
| 545 |
| 546 // If there is one download, the corresponding message should show up. |
| 547 ManageProfileOverlay.receiveDownloadCount(1); |
| 548 expectFalse(addendumSingle.hidden); |
| 549 expectTrue(addendumMulti.hidden); |
| 550 |
| 551 // If there are no downloads, both messages should be hidden. |
| 552 ManageProfileOverlay.receiveDownloadCount(0); |
| 553 expectTrue(addendumSingle.hidden); |
| 554 expectTrue(addendumMulti.hidden); |
| 555 |
| 556 // If there are multiple downloads, the corresponding message should show up. |
| 557 ManageProfileOverlay.receiveDownloadCount(2); |
| 558 expectTrue(addendumSingle.hidden); |
| 559 expectFalse(addendumMulti.hidden); |
| 560 |
| 561 chrome.send = originalChromeSend; |
| 562 }); |
| 563 |
520 GEN('#endif // OS_CHROMEOS'); | 564 GEN('#endif // OS_CHROMEOS'); |
OLD | NEW |