| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <shlwapi.h> | 10 #include <shlwapi.h> |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 EXPECT_TRUE(file_util::DieFileDie(download_path, true)); | 114 EXPECT_TRUE(file_util::DieFileDie(download_path, true)); |
| 115 EXPECT_FALSE(file_util::PathExists(download_path)); | 115 EXPECT_FALSE(file_util::PathExists(download_path)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 FilePath download_prefix_; | 118 FilePath download_prefix_; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // Download a file with non-viewable content, verify that the | 121 // Download a file with non-viewable content, verify that the |
| 122 // download tab opened and the file exists. | 122 // download tab opened and the file exists. |
| 123 // All download tests are flaky on all platforms, http://crbug.com/35275, | 123 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 124 // http://crbug.com/48913 and especially http://crbug.com/50060. | 124 // http://crbug.com/48913. |
| 125 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 125 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 126 TEST_F(DownloadTest, DISABLED_DownloadMimeType) { | 126 TEST_F(DownloadTest, DISABLED_DownloadMimeType) { |
| 127 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 127 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 128 CleanupDownloadFiles(file); | 128 CleanupDownloadFiles(file); |
| 129 | 129 |
| 130 EXPECT_EQ(1, GetTabCount()); | 130 EXPECT_EQ(1, GetTabCount()); |
| 131 | 131 |
| 132 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 132 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 133 // No new tabs created, downloads appear in the current tab's download shelf. | 133 // No new tabs created, downloads appear in the current tab's download shelf. |
| 134 WaitUntilTabCount(1); | 134 WaitUntilTabCount(1); |
| 135 | 135 |
| 136 CheckDownload(file); | 136 CheckDownload(file); |
| 137 | 137 |
| 138 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 138 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 139 ASSERT_TRUE(browser.get()); | 139 ASSERT_TRUE(browser.get()); |
| 140 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 140 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Access a file with a viewable mime-type, verify that a download | 143 // Access a file with a viewable mime-type, verify that a download |
| 144 // did not initiate. | 144 // did not initiate. |
| 145 // All download tests are flaky on all platforms, http://crbug.com/35275, | 145 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 146 // http://crbug.com/48913 and especially http://crbug.com/50060. | 146 // http://crbug.com/48913. |
| 147 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 147 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 148 TEST_F(DownloadTest, FLAKY_NoDownload) { | 148 TEST_F(DownloadTest, FLAKY_NoDownload) { |
| 149 FilePath file(FILE_PATH_LITERAL("download-test2.html")); | 149 FilePath file(FILE_PATH_LITERAL("download-test2.html")); |
| 150 FilePath file_path = download_prefix_.Append(file); | 150 FilePath file_path = download_prefix_.Append(file); |
| 151 CleanupDownloadFiles(file); | 151 CleanupDownloadFiles(file); |
| 152 | 152 |
| 153 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 153 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 154 WaitUntilTabCount(1); | 154 WaitUntilTabCount(1); |
| 155 | 155 |
| 156 // Wait to see if the file will be downloaded. | 156 // Wait to see if the file will be downloaded. |
| 157 PlatformThread::Sleep(sleep_timeout_ms()); | 157 PlatformThread::Sleep(sleep_timeout_ms()); |
| 158 | 158 |
| 159 EXPECT_FALSE(file_util::PathExists(file_path)); | 159 EXPECT_FALSE(file_util::PathExists(file_path)); |
| 160 if (file_util::PathExists(file_path)) | 160 if (file_util::PathExists(file_path)) |
| 161 ASSERT_TRUE(file_util::Delete(file_path, false)); | 161 ASSERT_TRUE(file_util::Delete(file_path, false)); |
| 162 | 162 |
| 163 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 163 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 164 ASSERT_TRUE(browser.get()); | 164 ASSERT_TRUE(browser.get()); |
| 165 EXPECT_FALSE(WaitForDownloadShelfVisible(browser.get())); | 165 EXPECT_FALSE(WaitForDownloadShelfVisible(browser.get())); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Download a 0-size file with a content-disposition header, verify that the | 168 // Download a 0-size file with a content-disposition header, verify that the |
| 169 // download tab opened and the file exists as the filename specified in the | 169 // download tab opened and the file exists as the filename specified in the |
| 170 // header. This also ensures we properly handle empty file downloads. | 170 // header. This also ensures we properly handle empty file downloads. |
| 171 // All download tests are flaky on all platforms, http://crbug.com/35275, | 171 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 172 // http://crbug.com/48913 and especially http://crbug.com/50060. | 172 // http://crbug.com/48913. |
| 173 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 173 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 174 TEST_F(DownloadTest, DISABLED_ContentDisposition) { | 174 TEST_F(DownloadTest, DISABLED_ContentDisposition) { |
| 175 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); | 175 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); |
| 176 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); | 176 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); |
| 177 CleanupDownloadFiles(file); | 177 CleanupDownloadFiles(file); |
| 178 | 178 |
| 179 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 179 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 180 WaitUntilTabCount(1); | 180 WaitUntilTabCount(1); |
| 181 | 181 |
| 182 CheckDownload(download_file, file); | 182 CheckDownload(download_file, file); |
| 183 | 183 |
| 184 // Ensure the download shelf is visible on the window. | 184 // Ensure the download shelf is visible on the window. |
| 185 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 185 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 186 ASSERT_TRUE(browser.get()); | 186 ASSERT_TRUE(browser.get()); |
| 187 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 187 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // Test that the download shelf is per-window by starting a download in one | 190 // Test that the download shelf is per-window by starting a download in one |
| 191 // tab, opening a second tab, closing the shelf, going back to the first tab, | 191 // tab, opening a second tab, closing the shelf, going back to the first tab, |
| 192 // and checking that the shelf is closed. | 192 // and checking that the shelf is closed. |
| 193 // See bug http://crbug.com/26325 | 193 // See bug http://crbug.com/26325 |
| 194 // All download tests are flaky on all platforms, http://crbug.com/35275, | 194 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 195 // http://crbug.com/48913 and especially http://crbug.com/50060. | 195 // http://crbug.com/48913. |
| 196 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 196 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 197 TEST_F(DownloadTest, DISABLED_PerWindowShelf) { | 197 TEST_F(DownloadTest, DISABLED_PerWindowShelf) { |
| 198 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); | 198 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); |
| 199 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); | 199 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); |
| 200 CleanupDownloadFiles(download_file); | 200 CleanupDownloadFiles(download_file); |
| 201 | 201 |
| 202 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 202 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 203 WaitUntilTabCount(1); | 203 WaitUntilTabCount(1); |
| 204 | 204 |
| 205 CheckDownload(download_file, file); | 205 CheckDownload(download_file, file); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 228 ASSERT_FALSE(shelf_visible); | 228 ASSERT_FALSE(shelf_visible); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // UnknownSize and KnownSize are tests which depend on | 231 // UnknownSize and KnownSize are tests which depend on |
| 232 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be | 232 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be |
| 233 // sent in two chunks where the first chunk is 35K and the second chunk is 10K. | 233 // sent in two chunks where the first chunk is 35K and the second chunk is 10K. |
| 234 // The test will first attempt to download a file; but the server will "pause" | 234 // The test will first attempt to download a file; but the server will "pause" |
| 235 // in the middle until the server receives a second request for | 235 // in the middle until the server receives a second request for |
| 236 // "download-finish. At that time, the download will finish. | 236 // "download-finish. At that time, the download will finish. |
| 237 // All download tests are flaky on all platforms, http://crbug.com/35275, | 237 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 238 // http://crbug.com/48913 and especially http://crbug.com/50060. | 238 // http://crbug.com/48913. |
| 239 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 239 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 240 TEST_F(DownloadTest, FLAKY_UnknownSize) { | 240 TEST_F(DownloadTest, FLAKY_UnknownSize) { |
| 241 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); | 241 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); |
| 242 FilePath filename; | 242 FilePath filename; |
| 243 net::FileURLToFilePath(url, &filename); | 243 net::FileURLToFilePath(url, &filename); |
| 244 filename = filename.BaseName(); | 244 filename = filename.BaseName(); |
| 245 RunSizeTest(url, L"32.0 KB - " + filename.ToWStringHack(), | 245 RunSizeTest(url, L"32.0 KB - " + filename.ToWStringHack(), |
| 246 L"100% - " + filename.ToWStringHack()); | 246 L"100% - " + filename.ToWStringHack()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 // All download tests are flaky on all platforms, http://crbug.com/35275, | 249 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 250 // http://crbug.com/48913 and especially http://crbug.com/50060. | 250 // http://crbug.com/48913. |
| 251 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 251 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 252 TEST_F(DownloadTest, FLAKY_KnownSize) { | 252 TEST_F(DownloadTest, FLAKY_KnownSize) { |
| 253 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); | 253 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); |
| 254 FilePath filename; | 254 FilePath filename; |
| 255 net::FileURLToFilePath(url, &filename); | 255 net::FileURLToFilePath(url, &filename); |
| 256 filename = filename.BaseName(); | 256 filename = filename.BaseName(); |
| 257 RunSizeTest(url, L"71% - " + filename.ToWStringHack(), | 257 RunSizeTest(url, L"71% - " + filename.ToWStringHack(), |
| 258 L"100% - " + filename.ToWStringHack()); | 258 L"100% - " + filename.ToWStringHack()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 // Test that when downloading an item in Incognito mode, we don't crash when | 261 // Test that when downloading an item in Incognito mode, we don't crash when |
| 262 // closing the last Incognito window (http://crbug.com/13983). | 262 // closing the last Incognito window (http://crbug.com/13983). |
| 263 // All download tests are flaky on all platforms, http://crbug.com/35275, | 263 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 264 // http://crbug.com/48913 and especially http://crbug.com/50060. | 264 // http://crbug.com/48913. |
| 265 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 265 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 266 TEST_F(DownloadTest, DISABLED_IncognitoDownload) { | 266 TEST_F(DownloadTest, DISABLED_IncognitoDownload) { |
| 267 // Open a regular window and sanity check default values for window / tab | 267 // Open a regular window and sanity check default values for window / tab |
| 268 // count and shelf visibility. | 268 // count and shelf visibility. |
| 269 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 269 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 270 ASSERT_TRUE(browser.get()); | 270 ASSERT_TRUE(browser.get()); |
| 271 int window_count = 0; | 271 int window_count = 0; |
| 272 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 272 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 273 ASSERT_EQ(1, window_count); | 273 ASSERT_EQ(1, window_count); |
| 274 EXPECT_EQ(1, GetTabCount()); | 274 EXPECT_EQ(1, GetTabCount()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 303 | 303 |
| 304 // Verify that the regular window does not have a download shelf. | 304 // Verify that the regular window does not have a download shelf. |
| 305 EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); | 305 EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); |
| 306 EXPECT_FALSE(is_shelf_visible); | 306 EXPECT_FALSE(is_shelf_visible); |
| 307 | 307 |
| 308 CheckDownload(file); | 308 CheckDownload(file); |
| 309 } | 309 } |
| 310 | 310 |
| 311 // All of the following tests are disabled, see http://crbug.com/43066 | 311 // All of the following tests are disabled, see http://crbug.com/43066 |
| 312 // All download tests are flaky on all platforms, http://crbug.com/35275, | 312 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 313 // http://crbug.com/48913 and especially http://crbug.com/50060. | 313 // http://crbug.com/48913. |
| 314 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 314 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 315 TEST_F(DownloadTest, FLAKY_DontCloseNewTab1) { | 315 TEST_F(DownloadTest, FLAKY_DontCloseNewTab1) { |
| 316 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 316 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 317 ASSERT_TRUE(browser.get()); | 317 ASSERT_TRUE(browser.get()); |
| 318 int window_count = 0; | 318 int window_count = 0; |
| 319 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 319 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 320 ASSERT_EQ(1, window_count); | 320 ASSERT_EQ(1, window_count); |
| 321 EXPECT_EQ(1, GetTabCount()); | 321 EXPECT_EQ(1, GetTabCount()); |
| 322 | 322 |
| 323 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 323 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 324 ASSERT_TRUE(tab_proxy.get()); | 324 ASSERT_TRUE(tab_proxy.get()); |
| 325 | 325 |
| 326 FilePath file1(FILE_PATH_LITERAL("download-test2.html")); | 326 FilePath file1(FILE_PATH_LITERAL("download-test2.html")); |
| 327 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 327 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 328 URLRequestMockHTTPJob::GetMockUrl(file1), | 328 URLRequestMockHTTPJob::GetMockUrl(file1), |
| 329 NEW_BACKGROUND_TAB)); | 329 NEW_BACKGROUND_TAB)); |
| 330 // We should have two tabs now. | 330 // We should have two tabs now. |
| 331 WaitUntilTabCount(2); | 331 WaitUntilTabCount(2); |
| 332 } | 332 } |
| 333 | 333 |
| 334 // All download tests are flaky on all platforms, http://crbug.com/35275, | 334 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 335 // http://crbug.com/48913 and especially http://crbug.com/50060. | 335 // http://crbug.com/48913. |
| 336 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 336 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 337 TEST_F(DownloadTest, FLAKY_CloseNewTab1) { | 337 TEST_F(DownloadTest, FLAKY_CloseNewTab1) { |
| 338 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 338 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 339 ASSERT_TRUE(browser.get()); | 339 ASSERT_TRUE(browser.get()); |
| 340 int window_count = 0; | 340 int window_count = 0; |
| 341 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 341 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 342 ASSERT_EQ(1, window_count); | 342 ASSERT_EQ(1, window_count); |
| 343 EXPECT_EQ(1, GetTabCount()); | 343 EXPECT_EQ(1, GetTabCount()); |
| 344 | 344 |
| 345 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 345 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 346 ASSERT_TRUE(tab_proxy.get()); | 346 ASSERT_TRUE(tab_proxy.get()); |
| 347 | 347 |
| 348 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 348 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 349 CleanupDownloadFiles(file); | 349 CleanupDownloadFiles(file); |
| 350 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 350 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 351 URLRequestMockHTTPJob::GetMockUrl(file), | 351 URLRequestMockHTTPJob::GetMockUrl(file), |
| 352 NEW_BACKGROUND_TAB)); | 352 NEW_BACKGROUND_TAB)); |
| 353 // When the download starts, we should still have one tab. | 353 // When the download starts, we should still have one tab. |
| 354 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 354 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 355 EXPECT_EQ(1, GetTabCount()); | 355 EXPECT_EQ(1, GetTabCount()); |
| 356 | 356 |
| 357 CheckDownload(file); | 357 CheckDownload(file); |
| 358 } | 358 } |
| 359 | 359 |
| 360 // Disabled, see http://crbug.com/43066 | 360 // Disabled, see http://crbug.com/43066 |
| 361 // All download tests are flaky on all platforms, http://crbug.com/35275, | 361 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 362 // http://crbug.com/48913 and especially http://crbug.com/50060. | 362 // http://crbug.com/48913. |
| 363 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 363 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 364 TEST_F(DownloadTest, FLAKY_DontCloseNewTab2) { | 364 TEST_F(DownloadTest, FLAKY_DontCloseNewTab2) { |
| 365 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 365 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 366 ASSERT_TRUE(browser.get()); | 366 ASSERT_TRUE(browser.get()); |
| 367 int window_count = 0; | 367 int window_count = 0; |
| 368 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 368 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 369 ASSERT_EQ(1, window_count); | 369 ASSERT_EQ(1, window_count); |
| 370 EXPECT_EQ(1, GetTabCount()); | 370 EXPECT_EQ(1, GetTabCount()); |
| 371 | 371 |
| 372 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 372 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 373 ASSERT_TRUE(tab_proxy.get()); | 373 ASSERT_TRUE(tab_proxy.get()); |
| 374 | 374 |
| 375 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 375 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 376 FilePath(FILE_PATH_LITERAL("download_page1.html"))))); | 376 FilePath(FILE_PATH_LITERAL("download_page1.html"))))); |
| 377 | 377 |
| 378 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 378 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 379 CleanupDownloadFiles(file); | 379 CleanupDownloadFiles(file); |
| 380 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); | 380 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); |
| 381 | 381 |
| 382 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 382 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 383 EXPECT_EQ(2, GetTabCount()); | 383 EXPECT_EQ(2, GetTabCount()); |
| 384 | 384 |
| 385 CheckDownload(file); | 385 CheckDownload(file); |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Flaky, see http://crbug.com/43066 | 388 // Flaky, see http://crbug.com/43066 |
| 389 // All download tests are flaky on all platforms, http://crbug.com/35275, | 389 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 390 // http://crbug.com/48913 and especially http://crbug.com/50060. | 390 // http://crbug.com/48913. |
| 391 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 391 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 392 TEST_F(DownloadTest, FLAKY_DontCloseNewTab3) { | 392 TEST_F(DownloadTest, FLAKY_DontCloseNewTab3) { |
| 393 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 393 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 394 ASSERT_TRUE(browser.get()); | 394 ASSERT_TRUE(browser.get()); |
| 395 int window_count = 0; | 395 int window_count = 0; |
| 396 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 396 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 397 ASSERT_EQ(1, window_count); | 397 ASSERT_EQ(1, window_count); |
| 398 EXPECT_EQ(1, GetTabCount()); | 398 EXPECT_EQ(1, GetTabCount()); |
| 399 | 399 |
| 400 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 400 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 411 URLRequestMockHTTPJob::GetMockUrl(file))); | 411 URLRequestMockHTTPJob::GetMockUrl(file))); |
| 412 | 412 |
| 413 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 413 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 414 EXPECT_EQ(2, GetTabCount()); | 414 EXPECT_EQ(2, GetTabCount()); |
| 415 | 415 |
| 416 CheckDownload(file); | 416 CheckDownload(file); |
| 417 } | 417 } |
| 418 | 418 |
| 419 // Flaky, see http://crbug.com/43066 | 419 // Flaky, see http://crbug.com/43066 |
| 420 // All download tests are flaky on all platforms, http://crbug.com/35275, | 420 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 421 // http://crbug.com/48913 and especially http://crbug.com/50060. | 421 // http://crbug.com/48913. |
| 422 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 422 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 423 TEST_F(DownloadTest, FLAKY_CloseNewTab2) { | 423 TEST_F(DownloadTest, FLAKY_CloseNewTab2) { |
| 424 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 424 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 425 ASSERT_TRUE(browser.get()); | 425 ASSERT_TRUE(browser.get()); |
| 426 int window_count = 0; | 426 int window_count = 0; |
| 427 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 427 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 428 ASSERT_EQ(1, window_count); | 428 ASSERT_EQ(1, window_count); |
| 429 EXPECT_EQ(1, GetTabCount()); | 429 EXPECT_EQ(1, GetTabCount()); |
| 430 | 430 |
| 431 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 431 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 432 ASSERT_TRUE(tab_proxy.get()); | 432 ASSERT_TRUE(tab_proxy.get()); |
| 433 | 433 |
| 434 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 434 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 435 FilePath(FILE_PATH_LITERAL("download_page3.html"))))); | 435 FilePath(FILE_PATH_LITERAL("download_page3.html"))))); |
| 436 | 436 |
| 437 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 437 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 438 CleanupDownloadFiles(file); | 438 CleanupDownloadFiles(file); |
| 439 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); | 439 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); |
| 440 | 440 |
| 441 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 441 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 442 EXPECT_EQ(1, GetTabCount()); | 442 EXPECT_EQ(1, GetTabCount()); |
| 443 | 443 |
| 444 CheckDownload(file); | 444 CheckDownload(file); |
| 445 } | 445 } |
| 446 | 446 |
| 447 // Flaky, see http://crbug.com/43066 | 447 // Flaky, see http://crbug.com/43066 |
| 448 // All download tests are flaky on all platforms, http://crbug.com/35275, | 448 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 449 // http://crbug.com/48913 and especially http://crbug.com/50060. | 449 // http://crbug.com/48913. |
| 450 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 450 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 451 TEST_F(DownloadTest, FLAKY_CloseNewTab3) { | 451 TEST_F(DownloadTest, FLAKY_CloseNewTab3) { |
| 452 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 452 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 453 ASSERT_TRUE(browser.get()); | 453 ASSERT_TRUE(browser.get()); |
| 454 int window_count = 0; | 454 int window_count = 0; |
| 455 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 455 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 456 ASSERT_EQ(1, window_count); | 456 ASSERT_EQ(1, window_count); |
| 457 EXPECT_EQ(1, GetTabCount()); | 457 EXPECT_EQ(1, GetTabCount()); |
| 458 | 458 |
| 459 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 459 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 460 ASSERT_TRUE(tab_proxy.get()); | 460 ASSERT_TRUE(tab_proxy.get()); |
| 461 | 461 |
| 462 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 462 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 463 FilePath(FILE_PATH_LITERAL("download_page4.html"))))); | 463 FilePath(FILE_PATH_LITERAL("download_page4.html"))))); |
| 464 | 464 |
| 465 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 465 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 466 CleanupDownloadFiles(file); | 466 CleanupDownloadFiles(file); |
| 467 ASSERT_TRUE(tab_proxy->NavigateToURLAsync( | 467 ASSERT_TRUE(tab_proxy->NavigateToURLAsync( |
| 468 GURL("javascript:document.getElementById('form').submit()"))); | 468 GURL("javascript:document.getElementById('form').submit()"))); |
| 469 | 469 |
| 470 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 470 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 471 EXPECT_EQ(1, GetTabCount()); | 471 EXPECT_EQ(1, GetTabCount()); |
| 472 | 472 |
| 473 CheckDownload(file); | 473 CheckDownload(file); |
| 474 } | 474 } |
| 475 | 475 |
| 476 // All download tests are flaky on all platforms, http://crbug.com/35275, | 476 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 477 // http://crbug.com/48913 and especially http://crbug.com/50060. | 477 // http://crbug.com/48913. |
| 478 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 478 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 479 TEST_F(DownloadTest, DISABLED_DontCloseNewWindow) { | 479 TEST_F(DownloadTest, DISABLED_DontCloseNewWindow) { |
| 480 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 480 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 481 ASSERT_TRUE(browser.get()); | 481 ASSERT_TRUE(browser.get()); |
| 482 int window_count = 0; | 482 int window_count = 0; |
| 483 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 483 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 484 ASSERT_EQ(1, window_count); | 484 ASSERT_EQ(1, window_count); |
| 485 EXPECT_EQ(1, GetTabCount()); | 485 EXPECT_EQ(1, GetTabCount()); |
| 486 | 486 |
| 487 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 487 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 488 ASSERT_TRUE(tab_proxy.get()); | 488 ASSERT_TRUE(tab_proxy.get()); |
| 489 | 489 |
| 490 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 490 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 491 CleanupDownloadFiles(file); | 491 CleanupDownloadFiles(file); |
| 492 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 492 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 493 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); | 493 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); |
| 494 | 494 |
| 495 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 495 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
| 496 | 496 |
| 497 CheckDownload(file); | 497 CheckDownload(file); |
| 498 } | 498 } |
| 499 | 499 |
| 500 // Regression test for http://crbug.com/44454 | 500 // Regression test for http://crbug.com/44454 |
| 501 // See also http://crbug.com/50060. | |
| 502 // All download tests are flaky on all platforms, http://crbug.com/35275, | 501 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 503 // http://crbug.com/48913 and especially http://crbug.com/50060. | 502 // http://crbug.com/48913. |
| 504 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 503 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 505 TEST_F(DownloadTest, DISABLED_NewWindow) { | 504 TEST_F(DownloadTest, DISABLED_NewWindow) { |
| 506 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 505 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 507 ASSERT_TRUE(browser.get()); | 506 ASSERT_TRUE(browser.get()); |
| 508 int window_count = 0; | 507 int window_count = 0; |
| 509 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 508 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 510 ASSERT_EQ(1, window_count); | 509 ASSERT_EQ(1, window_count); |
| 511 EXPECT_EQ(1, GetTabCount()); | 510 EXPECT_EQ(1, GetTabCount()); |
| 512 | 511 |
| 513 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 512 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 514 ASSERT_TRUE(tab_proxy.get()); | 513 ASSERT_TRUE(tab_proxy.get()); |
| 515 | 514 |
| 516 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 515 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 517 CleanupDownloadFiles(file); | 516 CleanupDownloadFiles(file); |
| 518 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 517 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 519 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); | 518 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); |
| 520 | 519 |
| 521 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 520 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
| 522 | 521 |
| 523 CheckDownload(file); | 522 CheckDownload(file); |
| 524 } | 523 } |
| 525 | 524 |
| 526 } // namespace | 525 } // namespace |
| OLD | NEW |