| 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 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 request_handler.StartServing(parameters); | 1807 request_handler.StartServing(parameters); |
| 1808 | 1808 |
| 1809 base::FilePath intermediate_file_path = | 1809 base::FilePath intermediate_file_path = |
| 1810 GetDownloadDirectory().AppendASCII("intermediate"); | 1810 GetDownloadDirectory().AppendASCII("intermediate"); |
| 1811 std::vector<GURL> url_chain; | 1811 std::vector<GURL> url_chain; |
| 1812 | 1812 |
| 1813 const int kIntermediateSize = 1331; | 1813 const int kIntermediateSize = 1331; |
| 1814 url_chain.push_back(request_handler.url()); | 1814 url_chain.push_back(request_handler.url()); |
| 1815 | 1815 |
| 1816 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1816 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 1817 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 1817 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 1818 1, | 1818 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 1819 intermediate_file_path, | 1819 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 1820 base::FilePath(), | 1820 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
| 1821 url_chain, | 1821 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
| 1822 GURL(), | |
| 1823 GURL(), | |
| 1824 GURL(), | |
| 1825 "application/octet-stream", | |
| 1826 "application/octet-stream", | |
| 1827 base::Time::Now(), | |
| 1828 base::Time(), | |
| 1829 parameters.etag, | |
| 1830 std::string(), | |
| 1831 kIntermediateSize, | |
| 1832 parameters.size, | |
| 1833 std::string(), | |
| 1834 DownloadItem::INTERRUPTED, | |
| 1835 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1822 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 1836 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | 1823 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 1837 false); | |
| 1838 | 1824 |
| 1839 download->Resume(); | 1825 download->Resume(); |
| 1840 WaitForCompletion(download); | 1826 WaitForCompletion(download); |
| 1841 | 1827 |
| 1842 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 1828 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 1843 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1829 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 1844 parameters.size, | 1830 parameters.size, |
| 1845 download->GetTargetFilePath()); | 1831 download->GetTargetFilePath()); |
| 1846 | 1832 |
| 1847 TestDownloadRequestHandler::CompletedRequests completed_requests; | 1833 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 std::vector<char> buffer(kIntermediateSize); | 1867 std::vector<char> buffer(kIntermediateSize); |
| 1882 request_handler.GetPatternBytes( | 1868 request_handler.GetPatternBytes( |
| 1883 parameters.pattern_generator_seed, 0, buffer.size(), buffer.data()); | 1869 parameters.pattern_generator_seed, 0, buffer.size(), buffer.data()); |
| 1884 ASSERT_EQ( | 1870 ASSERT_EQ( |
| 1885 kIntermediateSize, | 1871 kIntermediateSize, |
| 1886 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); | 1872 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); |
| 1887 | 1873 |
| 1888 url_chain.push_back(request_handler.url()); | 1874 url_chain.push_back(request_handler.url()); |
| 1889 | 1875 |
| 1890 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1876 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 1891 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 1877 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 1892 1, | 1878 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 1893 intermediate_file_path, | 1879 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 1894 base::FilePath(), | 1880 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
| 1895 url_chain, | 1881 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
| 1896 GURL(), | |
| 1897 GURL(), | |
| 1898 GURL(), | |
| 1899 "application/octet-stream", | |
| 1900 "application/octet-stream", | |
| 1901 base::Time::Now(), | |
| 1902 base::Time(), | |
| 1903 parameters.etag, | |
| 1904 std::string(), | |
| 1905 kIntermediateSize, | |
| 1906 parameters.size, | |
| 1907 std::string(), | |
| 1908 DownloadItem::INTERRUPTED, | |
| 1909 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1882 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 1910 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | 1883 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 1911 false); | |
| 1912 | 1884 |
| 1913 download->Resume(); | 1885 download->Resume(); |
| 1914 WaitForCompletion(download); | 1886 WaitForCompletion(download); |
| 1915 | 1887 |
| 1916 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 1888 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 1917 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1889 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 1918 parameters.size, | 1890 parameters.size, |
| 1919 download->GetTargetFilePath()); | 1891 download->GetTargetFilePath()); |
| 1920 | 1892 |
| 1921 TestDownloadRequestHandler::CompletedRequests completed_requests; | 1893 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1942 std::vector<char> buffer(kIntermediateSize); | 1914 std::vector<char> buffer(kIntermediateSize); |
| 1943 request_handler.GetPatternBytes( | 1915 request_handler.GetPatternBytes( |
| 1944 parameters.pattern_generator_seed + 1, 0, buffer.size(), buffer.data()); | 1916 parameters.pattern_generator_seed + 1, 0, buffer.size(), buffer.data()); |
| 1945 ASSERT_EQ( | 1917 ASSERT_EQ( |
| 1946 kIntermediateSize, | 1918 kIntermediateSize, |
| 1947 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); | 1919 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); |
| 1948 | 1920 |
| 1949 url_chain.push_back(request_handler.url()); | 1921 url_chain.push_back(request_handler.url()); |
| 1950 | 1922 |
| 1951 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1923 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 1952 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 1924 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 1953 1, | 1925 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 1954 intermediate_file_path, | 1926 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 1955 base::FilePath(), | 1927 base::Time(), "fake-etag", std::string(), kIntermediateSize, |
| 1956 url_chain, | 1928 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
| 1957 GURL(), | |
| 1958 GURL(), | |
| 1959 GURL(), | |
| 1960 "application/octet-stream", | |
| 1961 "application/octet-stream", | |
| 1962 base::Time::Now(), | |
| 1963 base::Time(), | |
| 1964 "fake-etag", | |
| 1965 std::string(), | |
| 1966 kIntermediateSize, | |
| 1967 parameters.size, | |
| 1968 std::string(), | |
| 1969 DownloadItem::INTERRUPTED, | |
| 1970 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1929 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 1971 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | 1930 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 1972 false); | |
| 1973 | 1931 |
| 1974 download->Resume(); | 1932 download->Resume(); |
| 1975 WaitForCompletion(download); | 1933 WaitForCompletion(download); |
| 1976 | 1934 |
| 1977 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 1935 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 1978 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1936 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 1979 parameters.size, | 1937 parameters.size, |
| 1980 download->GetTargetFilePath()); | 1938 download->GetTargetFilePath()); |
| 1981 | 1939 |
| 1982 TestDownloadRequestHandler::CompletedRequests completed_requests; | 1940 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2008 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); | 1966 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); |
| 2009 // SHA-256 hash of the pattern bytes in buffer. | 1967 // SHA-256 hash of the pattern bytes in buffer. |
| 2010 static const uint8_t kPartialHash[] = { | 1968 static const uint8_t kPartialHash[] = { |
| 2011 0x77, 0x14, 0xfd, 0x83, 0x06, 0x15, 0x10, 0x7a, 0x47, 0x15, 0xd3, | 1969 0x77, 0x14, 0xfd, 0x83, 0x06, 0x15, 0x10, 0x7a, 0x47, 0x15, 0xd3, |
| 2012 0xcf, 0xdd, 0x46, 0xa2, 0x61, 0x96, 0xff, 0xc3, 0xbb, 0x49, 0x30, | 1970 0xcf, 0xdd, 0x46, 0xa2, 0x61, 0x96, 0xff, 0xc3, 0xbb, 0x49, 0x30, |
| 2013 0xaf, 0x31, 0x3a, 0x64, 0x0b, 0xd5, 0xfa, 0xb1, 0xe3, 0x81}; | 1971 0xaf, 0x31, 0x3a, 0x64, 0x0b, 0xd5, 0xfa, 0xb1, 0xe3, 0x81}; |
| 2014 | 1972 |
| 2015 url_chain.push_back(request_handler.url()); | 1973 url_chain.push_back(request_handler.url()); |
| 2016 | 1974 |
| 2017 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 1975 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 2018 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 1976 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 2019 1, | 1977 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 2020 intermediate_file_path, | 1978 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 2021 base::FilePath(), | 1979 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
| 2022 url_chain, | |
| 2023 GURL(), | |
| 2024 GURL(), | |
| 2025 GURL(), | |
| 2026 "application/octet-stream", | |
| 2027 "application/octet-stream", | |
| 2028 base::Time::Now(), | |
| 2029 base::Time(), | |
| 2030 parameters.etag, | |
| 2031 std::string(), | |
| 2032 kIntermediateSize, | |
| 2033 parameters.size, | 1980 parameters.size, |
| 2034 std::string(std::begin(kPartialHash), std::end(kPartialHash)), | 1981 std::string(std::begin(kPartialHash), std::end(kPartialHash)), |
| 2035 DownloadItem::INTERRUPTED, | 1982 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 2036 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 1983 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 2037 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | |
| 2038 false); | |
| 2039 | 1984 |
| 2040 download->Resume(); | 1985 download->Resume(); |
| 2041 WaitForCompletion(download); | 1986 WaitForCompletion(download); |
| 2042 | 1987 |
| 2043 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 1988 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 2044 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 1989 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 2045 parameters.size, | 1990 parameters.size, |
| 2046 download->GetTargetFilePath()); | 1991 download->GetTargetFilePath()); |
| 2047 | 1992 |
| 2048 TestDownloadRequestHandler::CompletedRequests completed_requests; | 1993 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 // SHA-256 hash of the expected pattern bytes in buffer. This doesn't match | 2025 // SHA-256 hash of the expected pattern bytes in buffer. This doesn't match |
| 2081 // the current contents of the intermediate file which should all be 0. | 2026 // the current contents of the intermediate file which should all be 0. |
| 2082 static const uint8_t kPartialHash[] = { | 2027 static const uint8_t kPartialHash[] = { |
| 2083 0x77, 0x14, 0xfd, 0x83, 0x06, 0x15, 0x10, 0x7a, 0x47, 0x15, 0xd3, | 2028 0x77, 0x14, 0xfd, 0x83, 0x06, 0x15, 0x10, 0x7a, 0x47, 0x15, 0xd3, |
| 2084 0xcf, 0xdd, 0x46, 0xa2, 0x61, 0x96, 0xff, 0xc3, 0xbb, 0x49, 0x30, | 2029 0xcf, 0xdd, 0x46, 0xa2, 0x61, 0x96, 0xff, 0xc3, 0xbb, 0x49, 0x30, |
| 2085 0xaf, 0x31, 0x3a, 0x64, 0x0b, 0xd5, 0xfa, 0xb1, 0xe3, 0x81}; | 2030 0xaf, 0x31, 0x3a, 0x64, 0x0b, 0xd5, 0xfa, 0xb1, 0xe3, 0x81}; |
| 2086 | 2031 |
| 2087 url_chain.push_back(request_handler.url()); | 2032 url_chain.push_back(request_handler.url()); |
| 2088 | 2033 |
| 2089 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2034 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 2090 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 2035 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 2091 1, | 2036 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 2092 intermediate_file_path, | 2037 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 2093 base::FilePath(), | 2038 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
| 2094 url_chain, | |
| 2095 GURL(), | |
| 2096 GURL(), | |
| 2097 GURL(), | |
| 2098 "application/octet-stream", | |
| 2099 "application/octet-stream", | |
| 2100 base::Time::Now(), | |
| 2101 base::Time(), | |
| 2102 parameters.etag, | |
| 2103 std::string(), | |
| 2104 kIntermediateSize, | |
| 2105 parameters.size, | 2039 parameters.size, |
| 2106 std::string(std::begin(kPartialHash), std::end(kPartialHash)), | 2040 std::string(std::begin(kPartialHash), std::end(kPartialHash)), |
| 2107 DownloadItem::INTERRUPTED, | 2041 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 2108 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2042 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 2109 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | |
| 2110 false); | |
| 2111 | 2043 |
| 2112 download->Resume(); | 2044 download->Resume(); |
| 2113 WaitForCompletion(download); | 2045 WaitForCompletion(download); |
| 2114 | 2046 |
| 2115 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 2047 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 2116 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2048 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 2117 parameters.size, | 2049 parameters.size, |
| 2118 download->GetTargetFilePath()); | 2050 download->GetTargetFilePath()); |
| 2119 | 2051 |
| 2120 TestDownloadRequestHandler::CompletedRequests completed_requests; | 2052 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 // Size of file is slightly shorter than the size known to DownloadItem. | 2093 // Size of file is slightly shorter than the size known to DownloadItem. |
| 2162 std::vector<char> buffer(kIntermediateSize - 100); | 2094 std::vector<char> buffer(kIntermediateSize - 100); |
| 2163 request_handler.GetPatternBytes( | 2095 request_handler.GetPatternBytes( |
| 2164 parameters.pattern_generator_seed, 0, buffer.size(), buffer.data()); | 2096 parameters.pattern_generator_seed, 0, buffer.size(), buffer.data()); |
| 2165 ASSERT_EQ( | 2097 ASSERT_EQ( |
| 2166 kIntermediateSize - 100, | 2098 kIntermediateSize - 100, |
| 2167 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); | 2099 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); |
| 2168 url_chain.push_back(request_handler.url()); | 2100 url_chain.push_back(request_handler.url()); |
| 2169 | 2101 |
| 2170 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2102 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 2171 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 2103 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 2172 1, | 2104 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 2173 intermediate_file_path, | 2105 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 2174 base::FilePath(), | 2106 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
| 2175 url_chain, | 2107 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
| 2176 GURL(), | |
| 2177 GURL(), | |
| 2178 GURL(), | |
| 2179 "application/octet-stream", | |
| 2180 "application/octet-stream", | |
| 2181 base::Time::Now(), | |
| 2182 base::Time(), | |
| 2183 parameters.etag, | |
| 2184 std::string(), | |
| 2185 kIntermediateSize, | |
| 2186 parameters.size, | |
| 2187 std::string(), | |
| 2188 DownloadItem::INTERRUPTED, | |
| 2189 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2108 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 2190 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | 2109 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 2191 false); | |
| 2192 | 2110 |
| 2193 download->Resume(); | 2111 download->Resume(); |
| 2194 WaitForCompletion(download); | 2112 WaitForCompletion(download); |
| 2195 | 2113 |
| 2196 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 2114 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 2197 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2115 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 2198 parameters.size, | 2116 parameters.size, |
| 2199 download->GetTargetFilePath()); | 2117 download->GetTargetFilePath()); |
| 2200 | 2118 |
| 2201 TestDownloadRequestHandler::CompletedRequests completed_requests; | 2119 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 // Size of file is slightly longer than the size known to DownloadItem. | 2190 // Size of file is slightly longer than the size known to DownloadItem. |
| 2273 std::vector<char> buffer(kIntermediateSize + 100); | 2191 std::vector<char> buffer(kIntermediateSize + 100); |
| 2274 request_handler.GetPatternBytes( | 2192 request_handler.GetPatternBytes( |
| 2275 parameters.pattern_generator_seed, 0, buffer.size(), buffer.data()); | 2193 parameters.pattern_generator_seed, 0, buffer.size(), buffer.data()); |
| 2276 ASSERT_EQ( | 2194 ASSERT_EQ( |
| 2277 kIntermediateSize + 100, | 2195 kIntermediateSize + 100, |
| 2278 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); | 2196 base::WriteFile(intermediate_file_path, buffer.data(), buffer.size())); |
| 2279 url_chain.push_back(request_handler.url()); | 2197 url_chain.push_back(request_handler.url()); |
| 2280 | 2198 |
| 2281 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( | 2199 DownloadItem* download = DownloadManagerForShell(shell())->CreateDownloadItem( |
| 2282 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", | 2200 "F7FB1F59-7DE1-4845-AFDB-8A688F70F583", 1, intermediate_file_path, |
| 2283 1, | 2201 base::FilePath(), url_chain, GURL(), GURL(), GURL(), GURL(), |
| 2284 intermediate_file_path, | 2202 "application/octet-stream", "application/octet-stream", base::Time::Now(), |
| 2285 base::FilePath(), | 2203 base::Time(), parameters.etag, std::string(), kIntermediateSize, |
| 2286 url_chain, | 2204 parameters.size, std::string(), DownloadItem::INTERRUPTED, |
| 2287 GURL(), | |
| 2288 GURL(), | |
| 2289 GURL(), | |
| 2290 "application/octet-stream", | |
| 2291 "application/octet-stream", | |
| 2292 base::Time::Now(), | |
| 2293 base::Time(), | |
| 2294 parameters.etag, | |
| 2295 std::string(), | |
| 2296 kIntermediateSize, | |
| 2297 parameters.size, | |
| 2298 std::string(), | |
| 2299 DownloadItem::INTERRUPTED, | |
| 2300 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 2205 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 2301 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, | 2206 DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, false); |
| 2302 false); | |
| 2303 | 2207 |
| 2304 download->Resume(); | 2208 download->Resume(); |
| 2305 WaitForCompletion(download); | 2209 WaitForCompletion(download); |
| 2306 | 2210 |
| 2307 EXPECT_FALSE(base::PathExists(intermediate_file_path)); | 2211 EXPECT_FALSE(base::PathExists(intermediate_file_path)); |
| 2308 ReadAndVerifyFileContents(parameters.pattern_generator_seed, | 2212 ReadAndVerifyFileContents(parameters.pattern_generator_seed, |
| 2309 parameters.size, | 2213 parameters.size, |
| 2310 download->GetTargetFilePath()); | 2214 download->GetTargetFilePath()); |
| 2311 | 2215 |
| 2312 TestDownloadRequestHandler::CompletedRequests completed_requests; | 2216 TestDownloadRequestHandler::CompletedRequests completed_requests; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 | 2470 |
| 2567 std::vector<DownloadItem*> downloads; | 2471 std::vector<DownloadItem*> downloads; |
| 2568 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 2472 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
| 2569 ASSERT_EQ(1u, downloads.size()); | 2473 ASSERT_EQ(1u, downloads.size()); |
| 2570 | 2474 |
| 2571 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), | 2475 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), |
| 2572 downloads[0]->GetTargetFilePath().BaseName().value()); | 2476 downloads[0]->GetTargetFilePath().BaseName().value()); |
| 2573 } | 2477 } |
| 2574 | 2478 |
| 2575 } // namespace content | 2479 } // namespace content |
| OLD | NEW |