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