| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 FAIL() << "Could not detect Internet ZoneIndentifier"; | 166 FAIL() << "Could not detect Internet ZoneIndentifier"; |
| 167 } | 167 } |
| 168 #endif // defined(OS_WIN) | 168 #endif // defined(OS_WIN) |
| 169 | 169 |
| 170 FilePath download_prefix_; | 170 FilePath download_prefix_; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 // Download a file with non-viewable content, verify that the | 173 // Download a file with non-viewable content, verify that the |
| 174 // download tab opened and the file exists. | 174 // download tab opened and the file exists. |
| 175 // All download tests are disabled on all platforms, http://crbug.com/35275. | 175 // All download tests are disabled on all platforms, http://crbug.com/35275, |
| 176 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 176 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 177 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 177 TEST_F(DownloadTest, FLAKY_DownloadMimeType) { | 178 TEST_F(DownloadTest, DISABLED_DownloadMimeType) { |
| 178 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 179 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 179 | 180 |
| 180 EXPECT_EQ(1, GetTabCount()); | 181 EXPECT_EQ(1, GetTabCount()); |
| 181 | 182 |
| 182 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 183 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 183 // No new tabs created, downloads appear in the current tab's download shelf. | 184 // No new tabs created, downloads appear in the current tab's download shelf. |
| 184 WaitUntilTabCount(1); | 185 WaitUntilTabCount(1); |
| 185 | 186 |
| 186 CheckDownload(file); | 187 CheckDownload(file); |
| 187 | 188 |
| 188 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 189 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 189 ASSERT_TRUE(browser.get()); | 190 ASSERT_TRUE(browser.get()); |
| 190 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 191 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); |
| 191 } | 192 } |
| 192 | 193 |
| 193 // Access a file with a viewable mime-type, verify that a download | 194 // Access a file with a viewable mime-type, verify that a download |
| 194 // did not initiate. | 195 // did not initiate. |
| 195 // All download tests are flaky on all platforms, http://crbug.com/35275. | 196 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 197 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 196 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 198 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 197 TEST_F(DownloadTest, FLAKY_NoDownload) { | 199 TEST_F(DownloadTest, DISABLED_NoDownload) { |
| 198 FilePath file(FILE_PATH_LITERAL("download-test2.html")); | 200 FilePath file(FILE_PATH_LITERAL("download-test2.html")); |
| 199 FilePath file_path = download_prefix_.Append(file); | 201 FilePath file_path = download_prefix_.Append(file); |
| 200 | 202 |
| 201 if (file_util::PathExists(file_path)) | 203 if (file_util::PathExists(file_path)) |
| 202 ASSERT_TRUE(file_util::Delete(file_path, false)); | 204 ASSERT_TRUE(file_util::Delete(file_path, false)); |
| 203 | 205 |
| 204 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 206 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 205 WaitUntilTabCount(1); | 207 WaitUntilTabCount(1); |
| 206 | 208 |
| 207 // Wait to see if the file will be downloaded. | 209 // Wait to see if the file will be downloaded. |
| 208 PlatformThread::Sleep(sleep_timeout_ms()); | 210 PlatformThread::Sleep(sleep_timeout_ms()); |
| 209 | 211 |
| 210 EXPECT_FALSE(file_util::PathExists(file_path)); | 212 EXPECT_FALSE(file_util::PathExists(file_path)); |
| 211 if (file_util::PathExists(file_path)) | 213 if (file_util::PathExists(file_path)) |
| 212 ASSERT_TRUE(file_util::Delete(file_path, false)); | 214 ASSERT_TRUE(file_util::Delete(file_path, false)); |
| 213 | 215 |
| 214 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 216 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 215 ASSERT_TRUE(browser.get()); | 217 ASSERT_TRUE(browser.get()); |
| 216 EXPECT_FALSE(WaitForDownloadShelfVisible(browser.get())); | 218 EXPECT_FALSE(WaitForDownloadShelfVisible(browser.get())); |
| 217 } | 219 } |
| 218 | 220 |
| 219 // Download a 0-size file with a content-disposition header, verify that the | 221 // Download a 0-size file with a content-disposition header, verify that the |
| 220 // download tab opened and the file exists as the filename specified in the | 222 // download tab opened and the file exists as the filename specified in the |
| 221 // header. This also ensures we properly handle empty file downloads. | 223 // header. This also ensures we properly handle empty file downloads. |
| 222 // All download tests are flaky on all platforms, http://crbug.com/35275. | 224 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 225 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 223 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 226 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 224 TEST_F(DownloadTest, FLAKY_ContentDisposition) { | 227 TEST_F(DownloadTest, DISABLED_ContentDisposition) { |
| 225 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); | 228 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); |
| 226 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); | 229 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); |
| 227 | 230 |
| 228 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 231 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 229 WaitUntilTabCount(1); | 232 WaitUntilTabCount(1); |
| 230 | 233 |
| 231 CheckDownload(download_file, file); | 234 CheckDownload(download_file, file); |
| 232 | 235 |
| 233 // Ensure the download shelf is visible on the window. | 236 // Ensure the download shelf is visible on the window. |
| 234 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 237 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 235 ASSERT_TRUE(browser.get()); | 238 ASSERT_TRUE(browser.get()); |
| 236 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 239 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); |
| 237 } | 240 } |
| 238 | 241 |
| 239 // Test that the download shelf is per-window by starting a download in one | 242 // Test that the download shelf is per-window by starting a download in one |
| 240 // tab, opening a second tab, closing the shelf, going back to the first tab, | 243 // tab, opening a second tab, closing the shelf, going back to the first tab, |
| 241 // and checking that the shelf is closed. | 244 // and checking that the shelf is closed. |
| 242 // See bug http://crbug.com/26325 | 245 // See bug http://crbug.com/26325 |
| 243 // All download tests are flaky on all platforms, http://crbug.com/35275. | 246 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 247 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 244 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 248 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 245 TEST_F(DownloadTest, FLAKY_PerWindowShelf) { | 249 TEST_F(DownloadTest, DISABLED_PerWindowShelf) { |
| 246 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); | 250 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); |
| 247 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); | 251 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); |
| 248 | 252 |
| 249 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 253 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 250 WaitUntilTabCount(1); | 254 WaitUntilTabCount(1); |
| 251 | 255 |
| 252 CheckDownload(download_file, file); | 256 CheckDownload(download_file, file); |
| 253 | 257 |
| 254 // Ensure the download shelf is visible on the window. | 258 // Ensure the download shelf is visible on the window. |
| 255 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 259 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 274 EXPECT_TRUE(browser->IsShelfVisible(&shelf_visible)); | 278 EXPECT_TRUE(browser->IsShelfVisible(&shelf_visible)); |
| 275 ASSERT_FALSE(shelf_visible); | 279 ASSERT_FALSE(shelf_visible); |
| 276 } | 280 } |
| 277 | 281 |
| 278 // UnknownSize and KnownSize are tests which depend on | 282 // UnknownSize and KnownSize are tests which depend on |
| 279 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be | 283 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be |
| 280 // sent in two chunks where the first chunk is 35K and the second chunk is 10K. | 284 // sent in two chunks where the first chunk is 35K and the second chunk is 10K. |
| 281 // The test will first attempt to download a file; but the server will "pause" | 285 // The test will first attempt to download a file; but the server will "pause" |
| 282 // in the middle until the server receives a second request for | 286 // in the middle until the server receives a second request for |
| 283 // "download-finish. At that time, the download will finish. | 287 // "download-finish. At that time, the download will finish. |
| 284 // All download tests are flaky on all platforms, http://crbug.com/35275. | 288 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 289 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 285 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 290 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 286 TEST_F(DownloadTest, FLAKY_UnknownSize) { | 291 TEST_F(DownloadTest, DISABLED_UnknownSize) { |
| 287 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); | 292 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); |
| 288 FilePath filename; | 293 FilePath filename; |
| 289 net::FileURLToFilePath(url, &filename); | 294 net::FileURLToFilePath(url, &filename); |
| 290 filename = filename.BaseName(); | 295 filename = filename.BaseName(); |
| 291 RunSizeTest(url, L"32.0 KB - " + filename.ToWStringHack(), | 296 RunSizeTest(url, L"32.0 KB - " + filename.ToWStringHack(), |
| 292 L"100% - " + filename.ToWStringHack()); | 297 L"100% - " + filename.ToWStringHack()); |
| 293 } | 298 } |
| 294 | 299 |
| 295 // http://crbug.com/35275 | 300 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 296 TEST_F(DownloadTest, FLAKY_KnownSize) { | 301 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 302 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 303 TEST_F(DownloadTest, DISABLED_KnownSize) { |
| 297 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); | 304 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); |
| 298 FilePath filename; | 305 FilePath filename; |
| 299 net::FileURLToFilePath(url, &filename); | 306 net::FileURLToFilePath(url, &filename); |
| 300 filename = filename.BaseName(); | 307 filename = filename.BaseName(); |
| 301 RunSizeTest(url, L"71% - " + filename.ToWStringHack(), | 308 RunSizeTest(url, L"71% - " + filename.ToWStringHack(), |
| 302 L"100% - " + filename.ToWStringHack()); | 309 L"100% - " + filename.ToWStringHack()); |
| 303 } | 310 } |
| 304 | 311 |
| 305 // Test that when downloading an item in Incognito mode, we don't crash when | 312 // Test that when downloading an item in Incognito mode, we don't crash when |
| 306 // closing the last Incognito window (http://crbug.com/13983). | 313 // closing the last Incognito window (http://crbug.com/13983). |
| 307 // All download tests are flaky on all platforms, http://crbug.com/35275. | 314 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 315 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 308 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 316 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 309 TEST_F(DownloadTest, FLAKY_IncognitoDownload) { | 317 TEST_F(DownloadTest, DISABLED_IncognitoDownload) { |
| 310 // Open a regular window and sanity check default values for window / tab | 318 // Open a regular window and sanity check default values for window / tab |
| 311 // count and shelf visibility. | 319 // count and shelf visibility. |
| 312 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 320 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 313 ASSERT_TRUE(browser.get()); | 321 ASSERT_TRUE(browser.get()); |
| 314 int window_count = 0; | 322 int window_count = 0; |
| 315 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 323 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 316 ASSERT_EQ(1, window_count); | 324 ASSERT_EQ(1, window_count); |
| 317 EXPECT_EQ(1, GetTabCount()); | 325 EXPECT_EQ(1, GetTabCount()); |
| 318 bool is_shelf_visible; | 326 bool is_shelf_visible; |
| 319 EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); | 327 EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 344 ASSERT_EQ(1, window_count); | 352 ASSERT_EQ(1, window_count); |
| 345 | 353 |
| 346 // Verify that the regular window does not have a download shelf. | 354 // Verify that the regular window does not have a download shelf. |
| 347 EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); | 355 EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); |
| 348 EXPECT_FALSE(is_shelf_visible); | 356 EXPECT_FALSE(is_shelf_visible); |
| 349 | 357 |
| 350 CheckDownload(file); | 358 CheckDownload(file); |
| 351 } | 359 } |
| 352 | 360 |
| 353 // All of the following tests are disabled, see http://crbug.com/43066 | 361 // All of the following tests are disabled, see http://crbug.com/43066 |
| 362 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 363 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 364 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 354 TEST_F(DownloadTest, DISABLED_DontCloseNewTab1) { | 365 TEST_F(DownloadTest, DISABLED_DontCloseNewTab1) { |
| 355 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 366 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 356 ASSERT_TRUE(browser.get()); | 367 ASSERT_TRUE(browser.get()); |
| 357 int window_count = 0; | 368 int window_count = 0; |
| 358 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 369 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 359 ASSERT_EQ(1, window_count); | 370 ASSERT_EQ(1, window_count); |
| 360 EXPECT_EQ(1, GetTabCount()); | 371 EXPECT_EQ(1, GetTabCount()); |
| 361 | 372 |
| 362 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 373 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 363 ASSERT_TRUE(tab_proxy.get()); | 374 ASSERT_TRUE(tab_proxy.get()); |
| 364 | 375 |
| 365 FilePath file1(FILE_PATH_LITERAL("download-test2.html")); | 376 FilePath file1(FILE_PATH_LITERAL("download-test2.html")); |
| 366 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 377 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 367 URLRequestMockHTTPJob::GetMockUrl(file1), | 378 URLRequestMockHTTPJob::GetMockUrl(file1), |
| 368 NEW_BACKGROUND_TAB)); | 379 NEW_BACKGROUND_TAB)); |
| 369 // We should have two tabs now. | 380 // We should have two tabs now. |
| 370 WaitUntilTabCount(2); | 381 WaitUntilTabCount(2); |
| 371 } | 382 } |
| 372 | 383 |
| 384 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 385 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 386 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 373 TEST_F(DownloadTest, DISABLED_CloseNewTab1) { | 387 TEST_F(DownloadTest, DISABLED_CloseNewTab1) { |
| 374 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 388 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 375 ASSERT_TRUE(browser.get()); | 389 ASSERT_TRUE(browser.get()); |
| 376 int window_count = 0; | 390 int window_count = 0; |
| 377 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 391 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 378 ASSERT_EQ(1, window_count); | 392 ASSERT_EQ(1, window_count); |
| 379 EXPECT_EQ(1, GetTabCount()); | 393 EXPECT_EQ(1, GetTabCount()); |
| 380 | 394 |
| 381 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 395 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 382 ASSERT_TRUE(tab_proxy.get()); | 396 ASSERT_TRUE(tab_proxy.get()); |
| 383 | 397 |
| 384 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 398 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 385 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 399 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 386 URLRequestMockHTTPJob::GetMockUrl(file), | 400 URLRequestMockHTTPJob::GetMockUrl(file), |
| 387 NEW_BACKGROUND_TAB)); | 401 NEW_BACKGROUND_TAB)); |
| 388 // When the download starts, we should still have one tab. | 402 // When the download starts, we should still have one tab. |
| 389 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 403 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 390 EXPECT_EQ(1, GetTabCount()); | 404 EXPECT_EQ(1, GetTabCount()); |
| 391 | 405 |
| 392 CheckDownload(file); | 406 CheckDownload(file); |
| 393 } | 407 } |
| 394 | 408 |
| 395 // Disabled, see http://crbug.com/43066 | 409 // Disabled, see http://crbug.com/43066 |
| 410 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 411 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 412 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 396 TEST_F(DownloadTest, DISABLED_DontCloseNewTab2) { | 413 TEST_F(DownloadTest, DISABLED_DontCloseNewTab2) { |
| 397 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 414 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 398 ASSERT_TRUE(browser.get()); | 415 ASSERT_TRUE(browser.get()); |
| 399 int window_count = 0; | 416 int window_count = 0; |
| 400 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 417 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 401 ASSERT_EQ(1, window_count); | 418 ASSERT_EQ(1, window_count); |
| 402 EXPECT_EQ(1, GetTabCount()); | 419 EXPECT_EQ(1, GetTabCount()); |
| 403 | 420 |
| 404 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 421 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 405 ASSERT_TRUE(tab_proxy.get()); | 422 ASSERT_TRUE(tab_proxy.get()); |
| 406 | 423 |
| 407 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 424 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 408 FilePath(FILE_PATH_LITERAL("download_page1.html"))))); | 425 FilePath(FILE_PATH_LITERAL("download_page1.html"))))); |
| 409 | 426 |
| 410 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 427 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 411 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); | 428 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); |
| 412 | 429 |
| 413 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 430 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 414 EXPECT_EQ(2, GetTabCount()); | 431 EXPECT_EQ(2, GetTabCount()); |
| 415 | 432 |
| 416 CheckDownload(file); | 433 CheckDownload(file); |
| 417 } | 434 } |
| 418 | 435 |
| 419 // Flaky, see http://crbug.com/43066 | 436 // Flaky, see http://crbug.com/43066 |
| 437 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 438 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 439 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 420 TEST_F(DownloadTest, DISABLED_DontCloseNewTab3) { | 440 TEST_F(DownloadTest, DISABLED_DontCloseNewTab3) { |
| 421 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 441 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 422 ASSERT_TRUE(browser.get()); | 442 ASSERT_TRUE(browser.get()); |
| 423 int window_count = 0; | 443 int window_count = 0; |
| 424 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 444 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 425 ASSERT_EQ(1, window_count); | 445 ASSERT_EQ(1, window_count); |
| 426 EXPECT_EQ(1, GetTabCount()); | 446 EXPECT_EQ(1, GetTabCount()); |
| 427 | 447 |
| 428 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 448 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 429 ASSERT_TRUE(tab_proxy.get()); | 449 ASSERT_TRUE(tab_proxy.get()); |
| 430 | 450 |
| 431 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 451 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 432 FilePath(FILE_PATH_LITERAL("download_page2.html"))))); | 452 FilePath(FILE_PATH_LITERAL("download_page2.html"))))); |
| 433 | 453 |
| 434 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); | 454 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); |
| 435 | 455 |
| 436 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 456 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 437 ASSERT_TRUE(tab_proxy->NavigateToURLAsync( | 457 ASSERT_TRUE(tab_proxy->NavigateToURLAsync( |
| 438 URLRequestMockHTTPJob::GetMockUrl(file))); | 458 URLRequestMockHTTPJob::GetMockUrl(file))); |
| 439 | 459 |
| 440 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 460 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 441 EXPECT_EQ(2, GetTabCount()); | 461 EXPECT_EQ(2, GetTabCount()); |
| 442 | 462 |
| 443 CheckDownload(file); | 463 CheckDownload(file); |
| 444 } | 464 } |
| 445 | 465 |
| 446 // Flaky, see http://crbug.com/43066 | 466 // Flaky, see http://crbug.com/43066 |
| 467 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 468 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 469 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 447 TEST_F(DownloadTest, DISABLED_CloseNewTab2) { | 470 TEST_F(DownloadTest, DISABLED_CloseNewTab2) { |
| 448 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 471 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 449 ASSERT_TRUE(browser.get()); | 472 ASSERT_TRUE(browser.get()); |
| 450 int window_count = 0; | 473 int window_count = 0; |
| 451 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 474 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 452 ASSERT_EQ(1, window_count); | 475 ASSERT_EQ(1, window_count); |
| 453 EXPECT_EQ(1, GetTabCount()); | 476 EXPECT_EQ(1, GetTabCount()); |
| 454 | 477 |
| 455 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 478 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 456 ASSERT_TRUE(tab_proxy.get()); | 479 ASSERT_TRUE(tab_proxy.get()); |
| 457 | 480 |
| 458 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 481 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 459 FilePath(FILE_PATH_LITERAL("download_page3.html"))))); | 482 FilePath(FILE_PATH_LITERAL("download_page3.html"))))); |
| 460 | 483 |
| 461 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 484 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 462 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); | 485 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(GURL("javascript:openNew()"))); |
| 463 | 486 |
| 464 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 487 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 465 EXPECT_EQ(1, GetTabCount()); | 488 EXPECT_EQ(1, GetTabCount()); |
| 466 | 489 |
| 467 CheckDownload(file); | 490 CheckDownload(file); |
| 468 } | 491 } |
| 469 | 492 |
| 470 // Flaky, see http://crbug.com/43066 | 493 // Flaky, see http://crbug.com/43066 |
| 494 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 495 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 496 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 471 TEST_F(DownloadTest, DISABLED_CloseNewTab3) { | 497 TEST_F(DownloadTest, DISABLED_CloseNewTab3) { |
| 472 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 498 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 473 ASSERT_TRUE(browser.get()); | 499 ASSERT_TRUE(browser.get()); |
| 474 int window_count = 0; | 500 int window_count = 0; |
| 475 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 501 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 476 ASSERT_EQ(1, window_count); | 502 ASSERT_EQ(1, window_count); |
| 477 EXPECT_EQ(1, GetTabCount()); | 503 EXPECT_EQ(1, GetTabCount()); |
| 478 | 504 |
| 479 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 505 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 480 ASSERT_TRUE(tab_proxy.get()); | 506 ASSERT_TRUE(tab_proxy.get()); |
| 481 | 507 |
| 482 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( | 508 ASSERT_TRUE(tab_proxy->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl( |
| 483 FilePath(FILE_PATH_LITERAL("download_page4.html"))))); | 509 FilePath(FILE_PATH_LITERAL("download_page4.html"))))); |
| 484 | 510 |
| 485 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 511 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 486 ASSERT_TRUE(tab_proxy->NavigateToURLAsync( | 512 ASSERT_TRUE(tab_proxy->NavigateToURLAsync( |
| 487 GURL("javascript:document.getElementById('form').submit()"))); | 513 GURL("javascript:document.getElementById('form').submit()"))); |
| 488 | 514 |
| 489 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); | 515 ASSERT_TRUE(WaitForDownloadShelfVisible(browser)); |
| 490 EXPECT_EQ(1, GetTabCount()); | 516 EXPECT_EQ(1, GetTabCount()); |
| 491 | 517 |
| 492 CheckDownload(file); | 518 CheckDownload(file); |
| 493 } | 519 } |
| 494 | 520 |
| 521 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 522 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 523 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 495 TEST_F(DownloadTest, DISABLED_DontCloseNewWindow) { | 524 TEST_F(DownloadTest, DISABLED_DontCloseNewWindow) { |
| 496 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 525 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 497 ASSERT_TRUE(browser.get()); | 526 ASSERT_TRUE(browser.get()); |
| 498 int window_count = 0; | 527 int window_count = 0; |
| 499 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 528 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 500 ASSERT_EQ(1, window_count); | 529 ASSERT_EQ(1, window_count); |
| 501 EXPECT_EQ(1, GetTabCount()); | 530 EXPECT_EQ(1, GetTabCount()); |
| 502 | 531 |
| 503 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 532 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 504 ASSERT_TRUE(tab_proxy.get()); | 533 ASSERT_TRUE(tab_proxy.get()); |
| 505 | 534 |
| 506 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 535 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 507 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 536 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 508 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); | 537 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); |
| 509 | 538 |
| 510 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 539 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
| 511 | 540 |
| 512 CheckDownload(file); | 541 CheckDownload(file); |
| 513 } | 542 } |
| 514 | 543 |
| 515 // Regression test for http://crbug.com/44454 | 544 // Regression test for http://crbug.com/44454 |
| 516 // See also http://crbug.com/50060. | 545 // See also http://crbug.com/50060. |
| 546 // All download tests are flaky on all platforms, http://crbug.com/35275, |
| 547 // http://crbug.com/48913 and especially http://crbug.com/50060. |
| 548 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 517 TEST_F(DownloadTest, DISABLED_NewWindow) { | 549 TEST_F(DownloadTest, DISABLED_NewWindow) { |
| 518 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 550 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 519 ASSERT_TRUE(browser.get()); | 551 ASSERT_TRUE(browser.get()); |
| 520 int window_count = 0; | 552 int window_count = 0; |
| 521 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 553 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 522 ASSERT_EQ(1, window_count); | 554 ASSERT_EQ(1, window_count); |
| 523 EXPECT_EQ(1, GetTabCount()); | 555 EXPECT_EQ(1, GetTabCount()); |
| 524 | 556 |
| 525 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 557 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
| 526 ASSERT_TRUE(tab_proxy.get()); | 558 ASSERT_TRUE(tab_proxy.get()); |
| 527 | 559 |
| 528 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 560 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 529 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 561 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 530 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); | 562 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); |
| 531 | 563 |
| 532 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 564 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
| 533 | 565 |
| 534 CheckDownload(file); | 566 CheckDownload(file); |
| 535 } | 567 } |
| 536 | 568 |
| 537 } // namespace | 569 } // namespace |
| OLD | NEW |