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