OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 | 1541 |
1542 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); | 1542 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); |
1543 | 1543 |
1544 ui_test_utils::WindowedNotificationObserver signal( | 1544 ui_test_utils::WindowedNotificationObserver signal( |
1545 chrome::NOTIFICATION_BROWSER_CLOSED, | 1545 chrome::NOTIFICATION_BROWSER_CLOSED, |
1546 Source<Browser>(browser())); | 1546 Source<Browser>(browser())); |
1547 browser()->CloseWindow(); | 1547 browser()->CloseWindow(); |
1548 signal.Wait(); | 1548 signal.Wait(); |
1549 } | 1549 } |
1550 | 1550 |
| 1551 // Test to make sure the 'download' attribute in anchor tag is respected. |
| 1552 IN_PROC_BROWSER_TEST_F(DownloadTest, AnchorDownloadTag) { |
| 1553 ASSERT_TRUE(InitialSetup(false)); |
| 1554 FilePath file(FILE_PATH_LITERAL("download-anchor-attrib.html")); |
| 1555 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 1556 |
| 1557 // Create a download, wait until it's complete, and confirm |
| 1558 // we're in the expected state. |
| 1559 scoped_ptr<DownloadsObserver> observer(CreateWaiter(browser(), 1)); |
| 1560 ui_test_utils::NavigateToURL(browser(), url); |
| 1561 observer->WaitForFinished(); |
| 1562 |
| 1563 // Confirm the downloaded data exists. |
| 1564 FilePath downloaded_file = GetDownloadDirectory(browser()); |
| 1565 downloaded_file = downloaded_file.Append(FILE_PATH_LITERAL("a_red_dot.png")); |
| 1566 EXPECT_TRUE(file_util::PathExists(downloaded_file)); |
| 1567 } |
| 1568 |
1551 // Test to make sure auto-open works. | 1569 // Test to make sure auto-open works. |
1552 IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) { | 1570 IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) { |
1553 ASSERT_TRUE(InitialSetup(false)); | 1571 ASSERT_TRUE(InitialSetup(false)); |
1554 FilePath file(FILE_PATH_LITERAL("download-autoopen.txt")); | 1572 FilePath file(FILE_PATH_LITERAL("download-autoopen.txt")); |
1555 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1573 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1556 | 1574 |
1557 ASSERT_TRUE( | 1575 ASSERT_TRUE( |
1558 GetDownloadPrefs(browser())->EnableAutoOpenBasedOnExtension(file)); | 1576 GetDownloadPrefs(browser())->EnableAutoOpenBasedOnExtension(file)); |
1559 | 1577 |
1560 // Mock out external opening on all downloads until end of test. | 1578 // Mock out external opening on all downloads until end of test. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); | 1729 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); |
1712 | 1730 |
1713 // Download shelf should close. Download panel stays open on ChromeOS. | 1731 // Download shelf should close. Download panel stays open on ChromeOS. |
1714 CheckDownloadUI(browser(), false, true, FilePath()); | 1732 CheckDownloadUI(browser(), false, true, FilePath()); |
1715 | 1733 |
1716 // Check that the extension was installed. | 1734 // Check that the extension was installed. |
1717 ExtensionService* extension_service = | 1735 ExtensionService* extension_service = |
1718 browser()->profile()->GetExtensionService(); | 1736 browser()->profile()->GetExtensionService(); |
1719 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); | 1737 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); |
1720 } | 1738 } |
OLD | NEW |