| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2849 download_item->Cancel(true); | 2849 download_item->Cancel(true); |
| 2850 EXPECT_TRUE(download_item->IsCancelled()); | 2850 EXPECT_TRUE(download_item->IsCancelled()); |
| 2851 } | 2851 } |
| 2852 | 2852 |
| 2853 // The Mac downloaded files quarantine feature is implemented by the | 2853 // The Mac downloaded files quarantine feature is implemented by the |
| 2854 // Contents/Info.plist file in cocoa apps. browser_tests cannot test | 2854 // Contents/Info.plist file in cocoa apps. browser_tests cannot test |
| 2855 // quarantining files on Mac because it is not a cocoa app. | 2855 // quarantining files on Mac because it is not a cocoa app. |
| 2856 // TODO(benjhayden) test the equivalents on other platforms. | 2856 // TODO(benjhayden) test the equivalents on other platforms. |
| 2857 | 2857 |
| 2858 // Test downloading a huge file and that PercentComplete is monotonic. | 2858 // Test downloading a huge file and that PercentComplete is monotonic. |
| 2859 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_PercentComplete) { | 2859 |
| 2860 // Disable on mac: http://crbug.com/238831 |
| 2861 #if defined(OS_MACOSX) |
| 2862 #define MAYBE_DownloadTest_PercentComplete DISABLED_DownloadTest_PercentComplete |
| 2863 #else |
| 2864 #define MAYBE_DownloadTest_PercentComplete DownloadTest_PercentComplete |
| 2865 #endif |
| 2866 IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_PercentComplete) { |
| 2860 // Write a huge file. | 2867 // Write a huge file. |
| 2861 base::FilePath file_path(DestinationFile( | 2868 base::FilePath file_path(DestinationFile( |
| 2862 browser(), base::FilePath(FILE_PATH_LITERAL("DownloadTest_BigZip.zip")))); | 2869 browser(), base::FilePath(FILE_PATH_LITERAL("DownloadTest_BigZip.zip")))); |
| 2863 int flags = (base::PLATFORM_FILE_CREATE | | 2870 int flags = (base::PLATFORM_FILE_CREATE | |
| 2864 base::PLATFORM_FILE_WRITE); | 2871 base::PLATFORM_FILE_WRITE); |
| 2865 bool created = false; | 2872 bool created = false; |
| 2866 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_MAX; | 2873 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_MAX; |
| 2867 base::PlatformFile fd = base::CreatePlatformFile( | 2874 base::PlatformFile fd = base::CreatePlatformFile( |
| 2868 file_path, flags, &created, &error); | 2875 file_path, flags, &created, &error); |
| 2869 int64 size = 1 << 29; | 2876 int64 size = 1 << 29; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2924 scoped_ptr<content::DownloadTestObserver> observer( | 2931 scoped_ptr<content::DownloadTestObserver> observer( |
| 2925 DangerousDownloadWaiter( | 2932 DangerousDownloadWaiter( |
| 2926 browser(), 1, | 2933 browser(), 1, |
| 2927 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 2934 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 2928 ui_test_utils::NavigateToURL(browser(), url); | 2935 ui_test_utils::NavigateToURL(browser(), url); |
| 2929 observer->WaitForFinished(); | 2936 observer->WaitForFinished(); |
| 2930 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); | 2937 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); |
| 2931 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); | 2938 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); |
| 2932 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 2939 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 2933 } | 2940 } |
| OLD | NEW |