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 // This file contains download browser tests that are known to be runnable | 5 // This file contains download browser tests that are known to be runnable |
6 // in a pure content context. Over time tests should be migrated here. | 6 // in a pure content context. Over time tests should be migrated here. |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 const int kIntermediateSize = 1331; | 1852 const int kIntermediateSize = 1331; |
1853 url_chain.push_back(request_handler.url()); | 1853 url_chain.push_back(request_handler.url()); |
1854 | 1854 |
1855 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1855 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
1856 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 1856 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
1857 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 1857 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
1858 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 1858 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
1859 base::Time(), parameters.etag, std::string(), kIntermediateSize, | 1859 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
1860 parameters.size, std::string(), DownloadItem::INTERRUPTED, | 1860 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
1861 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1861 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
1862 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 1862 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
1863 std::vector<DownloadItem::ReceivedSlice>()); | 1863 std::vector<DownloadItem::ReceivedSlice>()); |
1864 | 1864 |
1865 download->Resume(); | 1865 download->Resume(); |
1866 WaitForCompletion(download); | 1866 WaitForCompletion(download); |
1867 | 1867 |
1868 EXPECT_FALSE(PathExists(intermediate_file_path)); | 1868 EXPECT_FALSE(PathExists(intermediate_file_path)); |
1869 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1869 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
1870 parameters.size, | 1870 parameters.size, |
1871 download->GetTargetFilePath()); | 1871 download->GetTargetFilePath()); |
1872 | 1872 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 | 1915 |
1916 url_chain.push_back(request_handler.url()); | 1916 url_chain.push_back(request_handler.url()); |
1917 | 1917 |
1918 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1918 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
1919 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 1919 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
1920 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 1920 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
1921 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 1921 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
1922 base::Time(), parameters.etag, std::string(), kIntermediateSize, | 1922 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
1923 parameters.size, std::string(), DownloadItem::INTERRUPTED, | 1923 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
1924 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1924 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
1925 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 1925 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
1926 std::vector<DownloadItem::ReceivedSlice>()); | 1926 std::vector<DownloadItem::ReceivedSlice>()); |
1927 | 1927 |
1928 download->Resume(); | 1928 download->Resume(); |
1929 WaitForCompletion(download); | 1929 WaitForCompletion(download); |
1930 | 1930 |
1931 EXPECT_FALSE(PathExists(intermediate_file_path)); | 1931 EXPECT_FALSE(PathExists(intermediate_file_path)); |
1932 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1932 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
1933 parameters.size, | 1933 parameters.size, |
1934 download->GetTargetFilePath()); | 1934 download->GetTargetFilePath()); |
1935 | 1935 |
(...skipping 29 matching lines...) Expand all Loading... |
1965 | 1965 |
1966 url_chain.push_back(request_handler.url()); | 1966 url_chain.push_back(request_handler.url()); |
1967 | 1967 |
1968 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1968 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
1969 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 1969 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
1970 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 1970 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
1971 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 1971 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
1972 base::Time(), "fake-etag", std::string(), kIntermediateSize, | 1972 base::Time(), "fake-etag", std::string(), kIntermediateSize, |
1973 parameters.size, std::string(), DownloadItem::INTERRUPTED, | 1973 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
1974 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1974 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
1975 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 1975 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
1976 std::vector<DownloadItem::ReceivedSlice>()); | 1976 std::vector<DownloadItem::ReceivedSlice>()); |
1977 | 1977 |
1978 download->Resume(); | 1978 download->Resume(); |
1979 WaitForCompletion(download); | 1979 WaitForCompletion(download); |
1980 | 1980 |
1981 EXPECT_FALSE(PathExists(intermediate_file_path)); | 1981 EXPECT_FALSE(PathExists(intermediate_file_path)); |
1982 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1982 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
1983 parameters.size, | 1983 parameters.size, |
1984 download->GetTargetFilePath()); | 1984 download->GetTargetFilePath()); |
1985 | 1985 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 url_chain.push_back(request_handler.url()); | 2021 url_chain.push_back(request_handler.url()); |
2022 | 2022 |
2023 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2023 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
2024 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 2024 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
2025 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 2025 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
2026 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 2026 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
2027 base::Time(), parameters.etag, std::string(), kIntermediateSize, | 2027 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
2028 parameters.size, | 2028 parameters.size, |
2029 std::string(std::begin(kPartialHash), std::end(kPartialHash)), | 2029 std::string(std::begin(kPartialHash), std::end(kPartialHash)), |
2030 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2030 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
2031 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 2031 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
2032 std::vector<DownloadItem::ReceivedSlice>()); | 2032 std::vector<DownloadItem::ReceivedSlice>()); |
2033 | 2033 |
2034 download->Resume(); | 2034 download->Resume(); |
2035 WaitForCompletion(download); | 2035 WaitForCompletion(download); |
2036 | 2036 |
2037 EXPECT_FALSE(PathExists(intermediate_file_path)); | 2037 EXPECT_FALSE(PathExists(intermediate_file_path)); |
2038 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2038 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
2039 parameters.size, | 2039 parameters.size, |
2040 download->GetTargetFilePath()); | 2040 download->GetTargetFilePath()); |
2041 | 2041 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 url_chain.push_back(request_handler.url()); | 2083 url_chain.push_back(request_handler.url()); |
2084 | 2084 |
2085 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2085 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
2086 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 2086 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
2087 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 2087 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
2088 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 2088 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
2089 base::Time(), parameters.etag, std::string(), kIntermediateSize, | 2089 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
2090 parameters.size, | 2090 parameters.size, |
2091 std::string(std::begin(kPartialHash), std::end(kPartialHash)), | 2091 std::string(std::begin(kPartialHash), std::end(kPartialHash)), |
2092 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2092 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
2093 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 2093 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
2094 std::vector<DownloadItem::ReceivedSlice>()); | 2094 std::vector<DownloadItem::ReceivedSlice>()); |
2095 | 2095 |
2096 download->Resume(); | 2096 download->Resume(); |
2097 WaitForCompletion(download); | 2097 WaitForCompletion(download); |
2098 | 2098 |
2099 EXPECT_FALSE(PathExists(intermediate_file_path)); | 2099 EXPECT_FALSE(PathExists(intermediate_file_path)); |
2100 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2100 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
2101 parameters.size, | 2101 parameters.size, |
2102 download->GetTargetFilePath()); | 2102 download->GetTargetFilePath()); |
2103 | 2103 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 } | 2154 } |
2155 url_chain.push_back(request_handler.url()); | 2155 url_chain.push_back(request_handler.url()); |
2156 | 2156 |
2157 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2157 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
2158 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 2158 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
2159 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 2159 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
2160 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 2160 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
2161 base::Time(), parameters.etag, std::string(), kIntermediateSize, | 2161 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
2162 parameters.size, std::string(), DownloadItem::INTERRUPTED, | 2162 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
2163 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2163 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
2164 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 2164 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
2165 std::vector<DownloadItem::ReceivedSlice>()); | 2165 std::vector<DownloadItem::ReceivedSlice>()); |
2166 | 2166 |
2167 download->Resume(); | 2167 download->Resume(); |
2168 WaitForCompletion(download); | 2168 WaitForCompletion(download); |
2169 | 2169 |
2170 EXPECT_FALSE(PathExists(intermediate_file_path)); | 2170 EXPECT_FALSE(PathExists(intermediate_file_path)); |
2171 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2171 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
2172 parameters.size, | 2172 parameters.size, |
2173 download->GetTargetFilePath()); | 2173 download->GetTargetFilePath()); |
2174 | 2174 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 } | 2223 } |
2224 url_chain.push_back(request_handler.url()); | 2224 url_chain.push_back(request_handler.url()); |
2225 | 2225 |
2226 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2226 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
2227 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, | 2227 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
2228 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), | 2228 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
2229 "application/octet-stream", "application/octet-stream", base::Time::Now(), | 2229 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
2230 base::Time(), parameters.etag, std::string(), kIntermediateSize, | 2230 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
2231 parameters.size, std::string(), DownloadItem::INTERRUPTED, | 2231 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
2232 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2232 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
2233 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), | 2233 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false, base::Time(), false, |
2234 std::vector<DownloadItem::ReceivedSlice>()); | 2234 std::vector<DownloadItem::ReceivedSlice>()); |
2235 | 2235 |
2236 download->Resume(); | 2236 download->Resume(); |
2237 WaitForCompletion(download); | 2237 WaitForCompletion(download); |
2238 | 2238 |
2239 EXPECT_FALSE(PathExists(intermediate_file_path)); | 2239 EXPECT_FALSE(PathExists(intermediate_file_path)); |
2240 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2240 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
2241 parameters.size, | 2241 parameters.size, |
2242 download->GetTargetFilePath()); | 2242 download->GetTargetFilePath()); |
2243 | 2243 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 GURL document_url = | 2656 GURL document_url = |
2657 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); | 2657 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); |
2658 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); | 2658 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); |
2659 WaitForCompletion(download); | 2659 WaitForCompletion(download); |
2660 | 2660 |
2661 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), | 2661 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), |
2662 download->GetTargetFilePath().BaseName().value().c_str()); | 2662 download->GetTargetFilePath().BaseName().value().c_str()); |
2663 } | 2663 } |
2664 | 2664 |
2665 } // namespace content | 2665 } // namespace content |
OLD | NEW |