Chromium Code Reviews| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 loop_runner->Run(); | 767 loop_runner->Run(); |
| 768 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( | 768 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( |
| 769 GetDownloadManager())->DownloadPath(); | 769 GetDownloadManager())->DownloadPath(); |
| 770 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); | 770 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); |
| 771 ASSERT_TRUE(base::PathExists(filename)); | 771 ASSERT_TRUE(base::PathExists(filename)); |
| 772 std::string contents; | 772 std::string contents; |
| 773 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); | 773 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); |
| 774 EXPECT_EQ("foo", contents); | 774 EXPECT_EQ("foo", contents); |
| 775 } | 775 } |
| 776 | 776 |
| 777 // Disabled on Windows due to flakiness. http://crbug.com/162323 | |
|
dcheng
2015/09/25 21:28:21
Let's try unconditionally enabling this test, so w
Łukasz Anforowicz
2015/09/25 21:38:28
Done.
| |
| 778 #if defined(OS_WIN) | |
| 779 #define MAYBE_SaveDownloadableIFrame DISABLED_SaveDownloadableIFrame | |
| 780 #else | |
| 781 #define MAYBE_SaveDownloadableIFrame SaveDownloadableIFrame | |
| 782 #endif | |
| 783 // Test that we don't crash when the page contains an iframe that | |
| 784 // was handled as a download (http://crbug.com/42212). | |
| 785 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveDownloadableIFrame) { | |
| 786 GURL url = URLRequestMockHTTPJob::GetMockUrl( | |
| 787 base::FilePath(FILE_PATH_LITERAL("downloads")) | |
| 788 .AppendASCII("iframe-src-is-a-download.htm")); | |
| 789 ui_test_utils::NavigateToURL(browser(), url); | |
| 790 | |
| 791 // Wait for and then dismiss the non-save-page-as-related download item | |
| 792 // (the one associated with downloading of "thisdayinhistory.xls" file). | |
| 793 VerifySavePackageExpectations(browser(), url); | |
| 794 GetDownloadManager()->RemoveAllDownloads(); | |
| 795 | |
| 796 base::FilePath full_file_name, dir; | |
| 797 SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, | |
| 798 "iframe-src-is-a-download", 2, &dir, &full_file_name); | |
| 799 ASSERT_FALSE(HasFailure()); | |
| 800 | |
| 801 EXPECT_TRUE(base::PathExists(full_file_name)); | |
| 802 } | |
| 803 | |
| 777 class SavePageSitePerProcessBrowserTest : public SavePageBrowserTest { | 804 class SavePageSitePerProcessBrowserTest : public SavePageBrowserTest { |
| 778 public: | 805 public: |
| 779 SavePageSitePerProcessBrowserTest() {} | 806 SavePageSitePerProcessBrowserTest() {} |
| 780 | 807 |
| 781 protected: | 808 protected: |
| 782 void SetUpCommandLine(base::CommandLine* command_line) override { | 809 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 783 SavePageBrowserTest::SetUpCommandLine(command_line); | 810 SavePageBrowserTest::SetUpCommandLine(command_line); |
| 784 | 811 |
| 785 // TODO(lukasza): Enable --site-per-process once crbug.com/526786 is fixed. | 812 // TODO(lukasza): Enable --site-per-process once crbug.com/526786 is fixed. |
| 786 // (currently, when the line below is uncommented out, the test crashes | 813 // (currently, when the line below is uncommented out, the test crashes |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 829 EXPECT_TRUE(base::PathExists(file_path)) << "Does " << file_path.value() | 856 EXPECT_TRUE(base::PathExists(file_path)) << "Does " << file_path.value() |
| 830 << " exist?"; | 857 << " exist?"; |
| 831 int64 actual_file_size = 0; | 858 int64 actual_file_size = 0; |
| 832 EXPECT_TRUE(base::GetFileSize(file_path, &actual_file_size)); | 859 EXPECT_TRUE(base::GetFileSize(file_path, &actual_file_size)); |
| 833 EXPECT_NE(0, actual_file_size) << "Is " << file_path.value() | 860 EXPECT_NE(0, actual_file_size) << "Is " << file_path.value() |
| 834 << " non-empty?"; | 861 << " non-empty?"; |
| 835 } | 862 } |
| 836 } | 863 } |
| 837 | 864 |
| 838 } // namespace | 865 } // namespace |
| OLD | NEW |