OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
10 #include "chrome/browser/extensions/browser_action_test_util.h" | 10 #include "chrome/browser/extensions/browser_action_test_util.h" |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 // works: No navigation, but download shelf visible + download goes through. | 984 // works: No navigation, but download shelf visible + download goes through. |
985 // | 985 // |
986 // Note - there is no "...ViaGet" flavour of this test, because we don't care | 986 // Note - there is no "...ViaGet" flavour of this test, because we don't care |
987 // (yet) if GET succeeds with the download or not (it probably should succeed | 987 // (yet) if GET succeeds with the download or not (it probably should succeed |
988 // for consistency with POST, but it always failed in M54 and before). After | 988 // for consistency with POST, but it always failed in M54 and before). After |
989 // abandoing ShouldFork/OpenURL for all methods (not just for POST) [see comment | 989 // abandoing ShouldFork/OpenURL for all methods (not just for POST) [see comment |
990 // about https://crbug.com/646261 in ChromeContentRendererClient::ShouldFork] | 990 // about https://crbug.com/646261 in ChromeContentRendererClient::ShouldFork] |
991 // GET should automagically start working for downloads. | 991 // GET should automagically start working for downloads. |
992 // TODO(lukasza): https://crbug.com/650694: Add a "Get" flavour of the test once | 992 // TODO(lukasza): https://crbug.com/650694: Add a "Get" flavour of the test once |
993 // the download works both for GET and POST requests. | 993 // the download works both for GET and POST requests. |
994 IN_PROC_BROWSER_TEST_F(NavigatingExtensionPopupBrowserTest, DownloadViaPost) { | 994 |
| 995 // Disabled on Windows. See http://crbug.com/653856. |
| 996 #if defined(OS_WIN) |
| 997 #define MAYBE_DownloadViaPost DISABLED_DownloadViaPost |
| 998 #else |
| 999 #define MAYBE_DownloadViaPost DownloadViaPost |
| 1000 #endif |
| 1001 |
| 1002 IN_PROC_BROWSER_TEST_F(NavigatingExtensionPopupBrowserTest, |
| 1003 MAYBE_DownloadViaPost) { |
995 content::DownloadTestObserverTerminal downloads_observer( | 1004 content::DownloadTestObserverTerminal downloads_observer( |
996 content::BrowserContext::GetDownloadManager(browser()->profile()), | 1005 content::BrowserContext::GetDownloadManager(browser()->profile()), |
997 1, // == wait_count (only waiting for "download-test3.gif"). | 1006 1, // == wait_count (only waiting for "download-test3.gif"). |
998 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); | 1007 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
999 | 1008 |
1000 // Navigate to a URL that replies with | 1009 // Navigate to a URL that replies with |
1001 // Content-Disposition: attachment; filename=... | 1010 // Content-Disposition: attachment; filename=... |
1002 // header. | 1011 // header. |
1003 GURL download_url( | 1012 GURL download_url( |
1004 embedded_test_server()->GetURL("foo.com", "/download-test3.gif")); | 1013 embedded_test_server()->GetURL("foo.com", "/download-test3.gif")); |
1005 TestPopupNavigationViaPost(download_url, EXPECTING_NAVIGATION_FAILURE); | 1014 TestPopupNavigationViaPost(download_url, EXPECTING_NAVIGATION_FAILURE); |
1006 | 1015 |
1007 // Verify that "download-test3.gif got downloaded. | 1016 // Verify that "download-test3.gif got downloaded. |
1008 downloads_observer.WaitForFinished(); | 1017 downloads_observer.WaitForFinished(); |
1009 EXPECT_EQ(0u, downloads_observer.NumDangerousDownloadsSeen()); | 1018 EXPECT_EQ(0u, downloads_observer.NumDangerousDownloadsSeen()); |
1010 EXPECT_EQ(1u, downloads_observer.NumDownloadsSeenInState( | 1019 EXPECT_EQ(1u, downloads_observer.NumDownloadsSeenInState( |
1011 content::DownloadItem::COMPLETE)); | 1020 content::DownloadItem::COMPLETE)); |
1012 | 1021 |
1013 // The test verification below is applicable only to scenarios where the | 1022 // The test verification below is applicable only to scenarios where the |
1014 // download shelf is supported - on ChromeOS, instead of the download shelf, | 1023 // download shelf is supported - on ChromeOS, instead of the download shelf, |
1015 // there is a download notification in the right-bottom corner of the screen. | 1024 // there is a download notification in the right-bottom corner of the screen. |
1016 #if !defined(OS_CHROMEOS) | 1025 #if !defined(OS_CHROMEOS) |
1017 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 1026 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
1018 #endif | 1027 #endif |
1019 } | 1028 } |
1020 | 1029 |
1021 } // namespace | 1030 } // namespace |
1022 } // namespace extensions | 1031 } // namespace extensions |
OLD | NEW |