Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/test/test_file_util.h" | 9 #include "base/test/test_file_util.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 12 #include "chrome/browser/download/download_item.h" | 12 #include "chrome/browser/download/download_item.h" |
| 13 #include "chrome/browser/download/download_manager.h" | 13 #include "chrome/browser/download/download_manager.h" |
| 14 #include "chrome/browser/download/download_prefs.h" | 14 #include "chrome/browser/download/download_prefs.h" |
| 15 #include "chrome/browser/download/download_shelf.h" | |
| 15 #include "chrome/browser/net/url_request_mock_http_job.h" | 16 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 17 #include "chrome/browser/net/url_request_slow_download_job.h" | |
| 16 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | |
| 21 #include "chrome/browser/ui/browser_list.h" | |
| 18 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/page_transition_types.h" | |
| 20 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/test/in_process_browser_test.h" | 26 #include "chrome/test/in_process_browser_test.h" |
| 22 #include "chrome/test/ui_test_utils.h" | 27 #include "chrome/test/ui_test_utils.h" |
| 28 #include "net/base/net_util.h" | |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 30 |
| 25 namespace { | 31 namespace { |
| 26 | 32 |
| 27 // Variation of DownloadsCompleteObserver from ui_test_utils.cc; the | 33 // Variation of DownloadsCompleteObserver from ui_test_utils.cc; the |
| 28 // specifically targeted download tests need finer granularity on waiting. | 34 // specifically targeted download tests need finer granularity on waiting. |
| 29 // Construction of this class defines a system state, based on some number | 35 // Construction of this class defines a system state, based on some number |
| 30 // of downloads being seen in a particular state + other events that | 36 // of downloads being seen in a particular state + other events that |
| 31 // may occur in the download system. That state will be recorded if it | 37 // may occur in the download system. That state will be recorded if it |
| 32 // occurs at any point after construction. When that state occurs, the class | 38 // occurs at any point after construction. When that state occurs, the class |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 // the select file dialog comes up. | 212 // the select file dialog comes up. |
| 207 bool finish_on_select_file_; | 213 bool finish_on_select_file_; |
| 208 | 214 |
| 209 // True if we've seen the select file dialog. | 215 // True if we've seen the select file dialog. |
| 210 bool select_file_dialog_seen_; | 216 bool select_file_dialog_seen_; |
| 211 | 217 |
| 212 DISALLOW_COPY_AND_ASSIGN(DownloadsObserver); | 218 DISALLOW_COPY_AND_ASSIGN(DownloadsObserver); |
| 213 }; | 219 }; |
| 214 | 220 |
| 215 class DownloadTest : public InProcessBrowserTest { | 221 class DownloadTest : public InProcessBrowserTest { |
| 222 public: | |
| 223 enum SelectExpectation { | |
| 224 EXPECT_NO_SELECT_DIALOG = -1, | |
| 225 EXPECT_NOTHING, | |
| 226 EXPECT_SELECT_DIALOG | |
| 227 }; | |
| 228 | |
| 229 // Returning false indicates a failure of the setup, and should be asserted | |
| 230 // in the caller. | |
| 231 virtual bool InitialSetup(bool prompt_for_download) { | |
| 232 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_); | |
| 233 EXPECT_TRUE(have_test_dir); | |
| 234 if (!have_test_dir) | |
| 235 return false; | |
| 236 | |
| 237 // Sanity check default values for window / tab count and shelf visibility. | |
| 238 int window_count = BrowserList::size(); | |
| 239 EXPECT_EQ(1, window_count); | |
| 240 EXPECT_EQ(1, browser()->tab_count()); | |
| 241 bool is_shelf_visible = browser()->window()->IsDownloadShelfVisible(); | |
| 242 EXPECT_FALSE(is_shelf_visible); | |
| 243 | |
| 244 // Set up the temporary download folder. | |
| 245 bool created_downloads_dir = CreateAndSetDownloadsDirectory(browser()); | |
| 246 EXPECT_TRUE(created_downloads_dir); | |
| 247 if (!created_downloads_dir) | |
| 248 return false; | |
| 249 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, | |
| 250 prompt_for_download); | |
| 251 | |
| 252 return true; | |
| 253 } | |
| 254 | |
| 216 protected: | 255 protected: |
| 217 void SetUpInProcessBrowserTestFixture() { | |
| 218 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir_)); | |
| 219 } | |
| 220 | 256 |
| 221 // Must be called after browser creation. Creates a temporary | 257 // Must be called after browser creation. Creates a temporary |
| 222 // directory for downloads that is auto-deleted on destruction. | 258 // directory for downloads that is auto-deleted on destruction. |
| 223 bool CreateAndSetDownloadsDirectory() { | 259 // Returning false indicates a failure of the function, and should be asserted |
| 224 if (downloads_directory_.CreateUniqueTempDir()) { | 260 // in the caller. |
| 225 browser()->profile()->GetPrefs()->SetFilePath( | 261 bool CreateAndSetDownloadsDirectory(Browser* browser) { |
| 226 prefs::kDownloadDefaultDirectory, | 262 if (!browser) |
| 227 downloads_directory_.path()); | 263 return false; |
| 228 return true; | 264 |
| 229 } | 265 if (!downloads_directory_.CreateUniqueTempDir()) |
| 230 return false; | 266 return false; |
| 267 | |
| 268 browser->profile()->GetPrefs()->SetFilePath( | |
| 269 prefs::kDownloadDefaultDirectory, | |
| 270 downloads_directory_.path()); | |
| 271 | |
| 272 return true; | |
| 231 } | 273 } |
| 232 | 274 |
| 233 // May only be called inside of an individual test; browser() is NULL | 275 FilePath GetDownloadDirectory(Browser* browser) { |
| 234 // outside of that context. | |
| 235 FilePath GetDownloadDirectory() { | |
| 236 DownloadManager* download_mananger = | 276 DownloadManager* download_mananger = |
| 237 browser()->profile()->GetDownloadManager(); | 277 browser->profile()->GetDownloadManager(); |
| 238 return download_mananger->download_prefs()->download_path(); | 278 return download_mananger->download_prefs()->download_path(); |
| 239 } | 279 } |
| 240 | 280 |
| 241 DownloadsObserver* CreateWaiter(int num_downloads) { | 281 DownloadsObserver* CreateWaiter(Browser* browser, int num_downloads) { |
| 242 DownloadManager* download_manager = | 282 DownloadManager* download_manager = |
| 243 browser()->profile()->GetDownloadManager(); | 283 browser->profile()->GetDownloadManager(); |
| 244 return new DownloadsObserver( | 284 return new DownloadsObserver( |
| 245 download_manager, num_downloads, | 285 download_manager, num_downloads, |
| 246 DownloadsObserver::FILE_RENAME, // Really done | 286 DownloadsObserver::FILE_RENAME, // Really done |
| 247 true); // Bail on select file | 287 true); // Bail on select file |
| 288 } | |
| 289 | |
| 290 // Download |url|, then wait for the download to finish. | |
| 291 // |disposition| indicates where the navigation occurs (current tab, new | |
| 292 // foreground tab, etc). | |
| 293 // |expectation| indicates whether or not a Select File dialog should be | |
| 294 // open when the download is finished, or if we don't care. | |
| 295 // If the dialog appears, the test completes. The only effect |expectation| | |
| 296 // has is whether or not the test succeeds. | |
| 297 // |browser_test_flags| indicate what to wait for, and is an OR of 0 or more | |
| 298 // values in the ui_test_utils::BrowserTestWaitFlags enum. | |
| 299 void DownloadAndWaitWithDisposition(Browser* browser, | |
| 300 const GURL& url, | |
| 301 WindowOpenDisposition disposition, | |
| 302 SelectExpectation expectation, | |
| 303 int browser_test_flags) { | |
| 304 // Setup notification, navigate, and block. | |
| 305 scoped_ptr<DownloadsObserver> observer(CreateWaiter(browser, 1)); | |
| 306 // This call will block until the condition specified by | |
| 307 // |browser_test_flags|, but will not wait for the download to finish. | |
| 308 ui_test_utils::NavigateToURLWithDisposition(browser, | |
| 309 url, | |
| 310 disposition, | |
| 311 browser_test_flags); | |
| 312 // Waits for the download to complete. | |
| 313 observer->WaitForFinished(); | |
| 314 | |
| 315 // If specified, check the state of the select file dialog. | |
| 316 if (expectation != EXPECT_NOTHING) { | |
| 317 EXPECT_EQ(expectation == EXPECT_SELECT_DIALOG, | |
| 318 observer->select_file_dialog_seen()); | |
| 319 } | |
| 320 } | |
| 321 | |
| 322 // Download a file in the current tab, then wait for the download to finish. | |
| 323 void DownloadAndWait(Browser* browser, | |
| 324 const GURL& url, | |
| 325 SelectExpectation expectation) { | |
| 326 DownloadAndWaitWithDisposition( | |
| 327 browser, | |
| 328 url, | |
| 329 CURRENT_TAB, | |
| 330 expectation, | |
| 331 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
| 248 } | 332 } |
| 249 | 333 |
| 250 // Should only be called when the download is known to have finished | 334 // Should only be called when the download is known to have finished |
| 251 // (in error or not). | 335 // (in error or not). |
| 252 void CheckDownload(const FilePath& downloaded_filename, | 336 // Returning false indicates a failure of the function, and should be asserted |
| 337 // in the caller. | |
| 338 bool CheckDownload(Browser* browser, | |
| 339 const FilePath& downloaded_filename, | |
| 253 const FilePath& origin_filename) { | 340 const FilePath& origin_filename) { |
| 254 // Find the path to which the data will be downloaded. | 341 // Find the path to which the data will be downloaded. |
| 255 FilePath downloaded_file = | 342 FilePath downloaded_file = |
| 256 GetDownloadDirectory().Append(downloaded_filename); | 343 GetDownloadDirectory(browser).Append(downloaded_filename); |
| 257 | 344 |
| 258 // Find the origin path (from which the data comes). | 345 // Find the origin path (from which the data comes). |
| 259 FilePath origin_file(test_dir_.Append(origin_filename)); | 346 FilePath origin_file(test_dir_.Append(origin_filename)); |
| 260 ASSERT_TRUE(file_util::PathExists(origin_file)); | 347 bool origin_file_exists = file_util::PathExists(origin_file); |
| 348 EXPECT_TRUE(origin_file_exists); | |
| 349 if (!origin_file_exists) | |
| 350 return false; | |
| 261 | 351 |
| 262 // Confirm the downloaded data file exists. | 352 // Confirm the downloaded data file exists. |
| 263 ASSERT_TRUE(file_util::PathExists(downloaded_file)); | 353 bool downloaded_file_exists = file_util::PathExists(downloaded_file); |
| 354 EXPECT_TRUE(downloaded_file_exists); | |
| 355 if (!downloaded_file_exists) | |
| 356 return false; | |
| 357 | |
| 264 int64 origin_file_size = 0; | 358 int64 origin_file_size = 0; |
| 265 int64 downloaded_file_size = 0; | 359 int64 downloaded_file_size = 0; |
| 266 EXPECT_TRUE(file_util::GetFileSize(origin_file, &origin_file_size)); | 360 EXPECT_TRUE(file_util::GetFileSize(origin_file, &origin_file_size)); |
| 267 EXPECT_TRUE(file_util::GetFileSize(downloaded_file, &downloaded_file_size)); | 361 EXPECT_TRUE(file_util::GetFileSize(downloaded_file, &downloaded_file_size)); |
| 268 EXPECT_EQ(origin_file_size, downloaded_file_size); | 362 EXPECT_EQ(origin_file_size, downloaded_file_size); |
| 269 EXPECT_TRUE(file_util::ContentsEqual(downloaded_file, origin_file)); | 363 EXPECT_TRUE(file_util::ContentsEqual(downloaded_file, origin_file)); |
| 270 | 364 |
| 271 #if defined(OS_WIN) | 365 #if defined(OS_WIN) |
| 272 // Check if the Zone Identifier is correctly set. | 366 // Check if the Zone Identifier is correctly set. |
| 273 if (file_util::VolumeSupportsADS(downloaded_file)) | 367 if (file_util::VolumeSupportsADS(downloaded_file)) |
| 274 EXPECT_TRUE(file_util::HasInternetZoneIdentifier(downloaded_file)); | 368 EXPECT_TRUE(file_util::HasInternetZoneIdentifier(downloaded_file)); |
| 275 #endif | 369 #endif |
| 276 | 370 |
| 277 // Delete the downloaded copy of the file. | 371 // Delete the downloaded copy of the file. |
| 278 EXPECT_TRUE(file_util::DieFileDie(downloaded_file, false)); | 372 bool downloaded_file_deleted = |
| 373 file_util::DieFileDie(downloaded_file, false); | |
| 374 EXPECT_TRUE(downloaded_file_deleted); | |
| 375 if (!downloaded_file_deleted) | |
|
Paweł Hajdan Jr.
2011/01/08 08:07:56
nit: Just return download_file_deleted, sorry I mi
ahendrickson
2011/01/09 01:14:16
Done.
| |
| 376 return false; | |
| 377 | |
| 378 return true; | |
| 379 } | |
| 380 | |
| 381 // TODO(ahendrickson) -- |expected_title_in_progress| and | |
| 382 // |expected_title_in_finished| need to be checked. | |
| 383 bool RunSizeTest(Browser* browser, | |
| 384 const GURL& url, | |
| 385 const std::wstring& expected_title_in_progress, | |
| 386 const std::wstring& expected_title_finished) { | |
| 387 if (!InitialSetup(false)) | |
| 388 return false; | |
| 389 | |
| 390 // Download a partial web page in a background tab and wait. | |
| 391 // The mock system will not complete until it gets a special URL. | |
| 392 scoped_ptr<DownloadsObserver> observer(CreateWaiter(browser, 1)); | |
| 393 ui_test_utils::NavigateToURL(browser, url); | |
| 394 | |
| 395 // TODO(ahendrickson): check download status text before downloading. | |
| 396 // Need to: | |
| 397 // - Add a member function to the |DownloadShelf| interface class, that | |
| 398 // indicates how many members it has. | |
| 399 // - Add a member function to |DownloadShelf| to get the status text | |
| 400 // of a given member (for example, via |DownloadItemView|'s | |
| 401 // GetAccessibleName() member function), by index. | |
| 402 // - Iterate over browser->window()->GetDownloadShelf()'s members | |
| 403 // to see if any match the status text we want. Start with the last one. | |
| 404 | |
| 405 // Complete sending the request. We do this by loading a second URL in a | |
| 406 // separate tab. | |
| 407 GURL finish_url(URLRequestSlowDownloadJob::kFinishDownloadUrl); | |
| 408 ui_test_utils::NavigateToURLWithDisposition( | |
| 409 browser, | |
| 410 finish_url, | |
| 411 NEW_FOREGROUND_TAB, | |
| 412 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
| 413 observer->WaitForFinished(); | |
| 414 | |
| 415 EXPECT_EQ(2, browser->tab_count()); | |
| 416 | |
| 417 // TODO(ahendrickson): check download status text after downloading. | |
| 418 | |
| 419 // Make sure the download shelf is showing. | |
| 420 EXPECT_TRUE(browser->window()->IsDownloadShelfVisible()); | |
| 421 | |
| 422 FilePath filename; | |
| 423 net::FileURLToFilePath(url, &filename); | |
| 424 filename = filename.BaseName(); | |
| 425 FilePath download_path = downloads_directory_.path().Append(filename); | |
| 426 | |
| 427 bool downloaded_path_exists = file_util::PathExists(download_path); | |
| 428 EXPECT_TRUE(downloaded_path_exists); | |
| 429 if (!downloaded_path_exists) | |
| 430 return false; | |
| 431 | |
| 432 // Delete the file we just downloaded. | |
| 433 EXPECT_TRUE(file_util::DieFileDie(download_path, true)); | |
| 434 EXPECT_FALSE(file_util::PathExists(download_path)); | |
| 435 | |
| 436 return true; | |
| 279 } | 437 } |
| 280 | 438 |
| 281 private: | 439 private: |
| 282 // Location of the test data. | 440 // Location of the test data. |
| 283 FilePath test_dir_; | 441 FilePath test_dir_; |
| 284 | 442 |
| 285 // Location of the downloads directory for these tests | 443 // Location of the downloads directory for these tests |
| 286 ScopedTempDir downloads_directory_; | 444 ScopedTempDir downloads_directory_; |
| 287 }; | 445 }; |
| 288 | 446 |
| 447 // NOTES: | |
| 448 // | |
| 449 // Files for these tests are found in DIR_TEST_DATA (currently | |
| 450 // "chrome\test\data\", see chrome_paths.cc). | |
| 451 // Mock responses have extension .mock-http-headers appended to the file name. | |
| 452 | |
| 453 // Download a file due to the associated MIME type. | |
| 454 // | |
| 289 // Test is believed good (non-flaky) in itself, but it | 455 // Test is believed good (non-flaky) in itself, but it |
| 290 // sometimes trips over underlying flakiness in the downloads | 456 // sometimes trips over underlying flakiness in the downloads |
| 291 // subsystem in in http://crbug.com/63237. Until that bug is | 457 // subsystem in in http://crbug.com/63237. Until that bug is |
| 292 // fixed, this test should be considered flaky. It's entered as | 458 // fixed, this test should be considered flaky. It's entered as |
| 293 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | 459 // DISABLED since if 63237 does cause a failure, it'll be a timeout. |
| 294 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_DownloadMimeType) { | 460 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_DownloadMimeType) { |
| 295 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 461 ASSERT_TRUE(InitialSetup(false)); |
| 296 ASSERT_TRUE(CreateAndSetDownloadsDirectory()); | 462 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 297 | 463 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 298 EXPECT_EQ(1, browser()->tab_count()); | 464 |
| 299 | 465 // Download the file and wait. We do not expect the Select File dialog. |
| 300 // Setup notification, navigate, and block. | 466 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
| 301 scoped_ptr<DownloadsObserver> observer(CreateWaiter(1)); | 467 |
| 302 ui_test_utils::NavigateToURL( | 468 // Check state. |
| 303 browser(), URLRequestMockHTTPJob::GetMockUrl(file)); | 469 EXPECT_EQ(1, browser()->tab_count()); |
| 304 observer->WaitForFinished(); | 470 CheckDownload(browser(), file, file); |
| 305 | 471 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
| 306 // Download should be finished; check state. | 472 } |
| 307 EXPECT_FALSE(observer->select_file_dialog_seen()); | 473 |
| 308 EXPECT_EQ(1, browser()->tab_count()); | 474 // Put up a Select File dialog when the file is downloaded, due to its MIME |
| 309 CheckDownload(file, file); | 475 // type. |
| 310 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 476 // |
| 311 } | |
| 312 | |
| 313 // This test runs correctly, but leaves behind turds in the test user's | 477 // This test runs correctly, but leaves behind turds in the test user's |
| 314 // download directory because of http://crbug.com/62099. No big loss; it | 478 // download directory because of http://crbug.com/62099. No big loss; it |
| 315 // was primarily confirming DownloadsObserver wait on select file dialog | 479 // was primarily confirming DownloadsObserver wait on select file dialog |
| 316 // functionality anyway. | 480 // functionality anyway. |
| 481 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 317 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_DownloadMimeTypeSelect) { | 482 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_DownloadMimeTypeSelect) { |
| 318 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 483 ASSERT_TRUE(InitialSetup(true)); |
| 319 ASSERT_TRUE(CreateAndSetDownloadsDirectory()); | 484 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 320 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, true); | 485 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 321 | 486 |
| 322 EXPECT_EQ(1, browser()->tab_count()); | 487 // Download the file and wait. We expect the Select File dialog to appear |
| 323 | 488 // due to the MIME type. |
| 324 // Setup notification, navigate, and block. | 489 DownloadAndWait(browser(), url, EXPECT_SELECT_DIALOG); |
| 325 scoped_ptr<DownloadsObserver> observer(CreateWaiter(1)); | 490 |
| 326 ui_test_utils::NavigateToURL( | 491 // Check state. |
| 327 browser(), URLRequestMockHTTPJob::GetMockUrl(file)); | 492 EXPECT_EQ(1, browser()->tab_count()); |
| 328 observer->WaitForFinished(); | 493 // Since we exited while the Select File dialog was visible, there should not |
| 329 | 494 // be anything in the download shelf and so it should not be visible. |
| 330 // Download should not be finished; check state. | 495 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 331 EXPECT_TRUE(observer->select_file_dialog_seen()); | 496 } |
| 332 EXPECT_EQ(1, browser()->tab_count()); | 497 |
| 333 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 498 // Access a file with a viewable mime-type, verify that a download |
| 499 // did not initiate. | |
| 500 IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) { | |
| 501 ASSERT_TRUE(InitialSetup(false)); | |
| 502 FilePath file(FILE_PATH_LITERAL("download-test2.html")); | |
| 503 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 504 FilePath file_path = GetDownloadDirectory(browser()).Append(file); | |
| 505 | |
| 506 // Open a web page and wait. | |
| 507 ui_test_utils::NavigateToURL(browser(), url); | |
| 508 | |
| 509 // Check that we did not download the web page. | |
| 510 EXPECT_FALSE(file_util::PathExists(file_path)); | |
| 511 | |
| 512 // Check state. | |
| 513 EXPECT_EQ(1, browser()->tab_count()); | |
| 514 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | |
| 515 } | |
| 516 | |
| 517 // Download a 0-size file with a content-disposition header, verify that the | |
| 518 // download tab opened and the file exists as the filename specified in the | |
| 519 // header. This also ensures we properly handle empty file downloads. | |
| 520 // The download shelf should be visible in the current tab. | |
| 521 // | |
| 522 // Test is believed mostly good (non-flaky) in itself, but it | |
| 523 // sometimes trips over underlying flakiness in the downloads | |
| 524 // subsystem in in http://crbug.com/63237. Until that bug is | |
| 525 // fixed, this test should be considered flaky. It's entered as | |
| 526 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 527 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 528 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_ContentDisposition) { | |
| 529 ASSERT_TRUE(InitialSetup(false)); | |
| 530 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); | |
| 531 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 532 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); | |
| 533 | |
| 534 // Download a file and wait. | |
| 535 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); | |
| 536 | |
| 537 CheckDownload(browser(), download_file, file); | |
| 538 | |
| 539 // Check state. | |
| 540 EXPECT_EQ(1, browser()->tab_count()); | |
| 541 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 542 } | |
| 543 | |
| 544 // Test that the download shelf is per-window by starting a download in one | |
| 545 // tab, opening a second tab, closing the shelf, going back to the first tab, | |
| 546 // and checking that the shelf is closed. | |
| 547 // | |
| 548 // The test sometimes trips over underlying flakiness in the downloads | |
| 549 // subsystem in in http://crbug.com/63237. It's entered as | |
| 550 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 551 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 552 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_PerWindowShelf) { | |
| 553 ASSERT_TRUE(InitialSetup(false)); | |
| 554 FilePath file(FILE_PATH_LITERAL("download-test3.gif")); | |
| 555 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 556 FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); | |
| 557 | |
| 558 // Download a file and wait. | |
| 559 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); | |
| 560 | |
| 561 CheckDownload(browser(), download_file, file); | |
| 562 | |
| 563 // Check state. | |
| 564 EXPECT_EQ(1, browser()->tab_count()); | |
| 565 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 566 | |
| 567 // Open a second tab and wait. | |
| 568 EXPECT_NE(static_cast<TabContentsWrapper*>(NULL), | |
| 569 browser()->AddSelectedTabWithURL(GURL(), PageTransition::TYPED)); | |
| 570 EXPECT_EQ(2, browser()->tab_count()); | |
| 571 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 572 | |
| 573 // Hide the download shelf. | |
| 574 browser()->window()->GetDownloadShelf()->Close(); | |
| 575 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | |
| 576 | |
| 577 // Go to the first tab. | |
| 578 browser()->SelectTabContentsAt(0, true); | |
| 579 EXPECT_EQ(2, browser()->tab_count()); | |
| 580 | |
| 581 // The download shelf should not be visible. | |
| 582 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | |
| 583 } | |
| 584 | |
| 585 // UnknownSize and KnownSize are tests which depend on | |
| 586 // URLRequestSlowDownloadJob to serve content in a certain way. Data will be | |
| 587 // sent in two chunks where the first chunk is 35K and the second chunk is 10K. | |
| 588 // The test will first attempt to download a file; but the server will "pause" | |
| 589 // in the middle until the server receives a second request for | |
| 590 // "download-finish". At that time, the download will finish. | |
| 591 // These tests don't currently test much due to holes in |RunSizeTest()|. See | |
| 592 // comments in that routine for details. | |
| 593 | |
| 594 // Test is believed mostly good (non-flaky) in itself, but it | |
| 595 // very occasionally trips over underlying flakiness in the downloads | |
| 596 // subsystem in in http://crbug.com/63237. Until that bug is | |
| 597 // fixed, this test should be considered flaky. It's entered as | |
| 598 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 599 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 600 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_UnknownSize) { | |
| 601 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); | |
| 602 FilePath filename; | |
| 603 net::FileURLToFilePath(url, &filename); | |
| 604 filename = filename.BaseName(); | |
| 605 ASSERT_TRUE(RunSizeTest(browser(), | |
| 606 url, | |
| 607 L"32.0 KB - " + filename.ToWStringHack(), | |
| 608 L"100% - " + filename.ToWStringHack())); | |
| 609 } | |
| 610 | |
| 611 // Test is believed mostly good (non-flaky) in itself, but it | |
| 612 // very occasionally trips over underlying flakiness in the downloads | |
| 613 // subsystem in in http://crbug.com/63237. Until that bug is | |
| 614 // fixed, this test should be considered flaky. It's entered as | |
| 615 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 616 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 617 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_KnownSize) { | |
| 618 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); | |
| 619 FilePath filename; | |
| 620 net::FileURLToFilePath(url, &filename); | |
| 621 filename = filename.BaseName(); | |
| 622 ASSERT_TRUE(RunSizeTest(browser(), | |
| 623 url, | |
| 624 L"71% - " + filename.ToWStringHack(), | |
| 625 L"100% - " + filename.ToWStringHack())); | |
| 626 } | |
| 627 | |
| 628 // Test that when downloading an item in Incognito mode, we don't crash when | |
| 629 // closing the last Incognito window (http://crbug.com/13983). | |
| 630 // Also check that the download shelf is not visible after closing the | |
| 631 // Incognito window. | |
| 632 // | |
| 633 // Test is believed mostly good (non-flaky) in itself, but it | |
| 634 // sometimes trips over underlying flakiness in the downloads | |
| 635 // subsystem in in http://crbug.com/63237. Until that bug is | |
| 636 // fixed, this test should be considered flaky. It's entered as | |
| 637 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 638 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 639 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_IncognitoDownload) { | |
| 640 ASSERT_TRUE(InitialSetup(false)); | |
| 641 | |
| 642 // Open an Incognito window. | |
| 643 Browser* incognito = CreateIncognitoBrowser(); // Waits. | |
| 644 ASSERT_TRUE(incognito); | |
| 645 int window_count = BrowserList::size(); | |
| 646 EXPECT_EQ(2, window_count); | |
| 647 | |
| 648 // Download a file in the Incognito window and wait. | |
| 649 CreateAndSetDownloadsDirectory(incognito); | |
| 650 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 651 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 652 // Since |incognito| is a separate browser, we have to set it up explicitly. | |
| 653 incognito->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, | |
| 654 false); | |
| 655 DownloadAndWait(incognito, url, EXPECT_NO_SELECT_DIALOG); | |
| 656 | |
| 657 // We should still have 2 windows. | |
| 658 window_count = BrowserList::size(); | |
| 659 EXPECT_EQ(2, window_count); | |
| 660 | |
| 661 // Verify that the download shelf is showing for the Incognito window. | |
| 662 bool is_shelf_visible = incognito->window()->IsDownloadShelfVisible(); | |
| 663 EXPECT_TRUE(is_shelf_visible); | |
| 664 | |
| 665 // Close the Incognito window and don't crash. | |
| 666 incognito->CloseWindow(); | |
| 667 ui_test_utils::WaitForNotificationFrom(NotificationType::BROWSER_CLOSED, | |
| 668 Source<Browser>(incognito)); | |
| 669 | |
| 670 window_count = BrowserList::size(); | |
| 671 EXPECT_EQ(1, window_count); | |
| 672 | |
| 673 // Verify that the regular window does not have a download shelf. | |
| 674 is_shelf_visible = browser()->window()->IsDownloadShelfVisible(); | |
| 675 EXPECT_FALSE(is_shelf_visible); | |
| 676 | |
| 677 CheckDownload(browser(), file, file); | |
| 678 } | |
| 679 | |
| 680 // Navigate to a new background page, but don't download. Confirm that the | |
| 681 // download shelf is not visible and that we have two tabs. | |
| 682 IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab1) { | |
| 683 ASSERT_TRUE(InitialSetup(false)); | |
| 684 // Because it's an HTML link, it should open a web page rather than | |
| 685 // downloading. | |
| 686 FilePath file1(FILE_PATH_LITERAL("download-test2.html")); | |
| 687 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); | |
| 688 | |
| 689 // Open a web page and wait. | |
| 690 ui_test_utils::NavigateToURLWithDisposition( | |
| 691 browser(), | |
| 692 url, | |
| 693 NEW_BACKGROUND_TAB, | |
| 694 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
| 695 | |
| 696 // We should have two tabs now. | |
| 697 EXPECT_EQ(2, browser()->tab_count()); | |
| 698 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | |
| 699 } | |
| 700 | |
| 701 // Download a file in a background tab. Verify that the tab is closed | |
| 702 // automatically, and that the download shelf is visible in the current tab. | |
| 703 // | |
| 704 // The test sometimes trips over underlying flakiness in the downloads | |
| 705 // subsystem in http://crbug.com/63237. It's entered as | |
| 706 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 707 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 708 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_CloseNewTab1) { | |
| 709 ASSERT_TRUE(InitialSetup(false)); | |
| 710 | |
| 711 // Download a file in a new background tab and wait. The tab is automatically | |
| 712 // closed when the download begins. | |
| 713 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 714 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 715 DownloadAndWaitWithDisposition( | |
| 716 browser(), | |
| 717 url, | |
| 718 NEW_BACKGROUND_TAB, | |
| 719 EXPECT_NO_SELECT_DIALOG, | |
| 720 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
| 721 | |
| 722 // When the download finishes, we should still have one tab. | |
| 723 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 724 EXPECT_EQ(1, browser()->tab_count()); | |
| 725 | |
| 726 CheckDownload(browser(), file, file); | |
| 727 } | |
| 728 | |
| 729 // Open a web page in the current tab, then download a file in another tab via | |
| 730 // a Javascript call. | |
| 731 // Verify that we have 2 tabs, and the download shelf is visible in the current | |
| 732 // tab. | |
| 733 // | |
| 734 // The download_page1.html page contains an openNew() function that opens a | |
| 735 // tab and then downloads download-test1.lib. | |
| 736 // | |
| 737 // The test sometimes trips over underlying flakiness in the downloads | |
| 738 // subsystem in in http://crbug.com/63237. It's entered as | |
| 739 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 740 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 741 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_DontCloseNewTab2) { | |
| 742 ASSERT_TRUE(InitialSetup(false)); | |
| 743 // Because it's an HTML link, it should open a web page rather than | |
| 744 // downloading. | |
| 745 FilePath file1(FILE_PATH_LITERAL("download_page1.html")); | |
| 746 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); | |
| 747 | |
| 748 // Open a web page and wait. | |
| 749 ui_test_utils::NavigateToURL(browser(), url); | |
| 750 | |
| 751 // Download a file in a new tab and wait (via Javascript). | |
| 752 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 753 DownloadAndWaitWithDisposition(browser(), | |
| 754 GURL("javascript:openNew()"), | |
| 755 CURRENT_TAB, | |
| 756 EXPECT_NO_SELECT_DIALOG, | |
| 757 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | |
| 758 | |
| 759 // When the download finishes, we should have two tabs. | |
| 760 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 761 EXPECT_EQ(2, browser()->tab_count()); | |
| 762 | |
| 763 CheckDownload(browser(), file, file); | |
| 764 } | |
| 765 | |
| 766 // Open a web page in the current tab, open another tab via a Javascript call, | |
| 767 // then download a file in the new tab. | |
| 768 // Verify that we have 2 tabs, and the download shelf is visible in the current | |
| 769 // tab. | |
| 770 // | |
| 771 // The download_page2.html page contains an openNew() function that opens a | |
| 772 // tab. | |
| 773 // | |
| 774 // The test sometimes trips over underlying flakiness in the downloads | |
| 775 // subsystem in in http://crbug.com/63237. It's entered as | |
| 776 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 777 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 778 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_DontCloseNewTab3) { | |
| 779 ASSERT_TRUE(InitialSetup(false)); | |
| 780 // Because it's an HTML link, it should open a web page rather than | |
| 781 // downloading. | |
| 782 FilePath file1(FILE_PATH_LITERAL("download_page2.html")); | |
| 783 GURL url1(URLRequestMockHTTPJob::GetMockUrl(file1)); | |
| 784 | |
| 785 // Open a web page and wait. | |
| 786 ui_test_utils::NavigateToURL(browser(), url1); | |
| 787 | |
| 788 // Open a new tab and wait. | |
| 789 ui_test_utils::NavigateToURLWithDisposition( | |
| 790 browser(), | |
| 791 GURL("javascript:openNew()"), | |
| 792 CURRENT_TAB, | |
| 793 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | |
| 794 | |
| 795 EXPECT_EQ(2, browser()->tab_count()); | |
| 796 | |
| 797 // Download a file and wait. | |
| 798 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 799 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 800 DownloadAndWaitWithDisposition(browser(), | |
| 801 url, | |
| 802 CURRENT_TAB, | |
| 803 EXPECT_NO_SELECT_DIALOG, | |
| 804 ui_test_utils::BROWSER_TEST_NONE); | |
| 805 | |
| 806 // When the download finishes, we should have two tabs. | |
| 807 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 808 EXPECT_EQ(2, browser()->tab_count()); | |
| 809 | |
| 810 CheckDownload(browser(), file, file); | |
| 811 } | |
| 812 | |
| 813 // Open a web page in the current tab, then download a file via Javascript, | |
| 814 // which will do so in a temporary tab. | |
| 815 // Verify that we have 1 tab, and the download shelf is visible. | |
| 816 // | |
| 817 // The download_page3.html page contains an openNew() function that opens a | |
| 818 // tab with download-test1.lib in the URL. When the URL is determined to be | |
| 819 // a download, the tab is closed automatically. | |
| 820 // | |
| 821 // The test sometimes trips over underlying flakiness in the downloads | |
| 822 // subsystem in in http://crbug.com/63237. It's entered as | |
| 823 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 824 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 825 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_CloseNewTab2) { | |
| 826 ASSERT_TRUE(InitialSetup(false)); | |
| 827 // Because it's an HTML link, it should open a web page rather than | |
| 828 // downloading. | |
| 829 FilePath file1(FILE_PATH_LITERAL("download_page3.html")); | |
| 830 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); | |
| 831 | |
| 832 // Open a web page and wait. | |
| 833 ui_test_utils::NavigateToURL(browser(), url); | |
| 834 | |
| 835 // Download a file and wait. | |
| 836 // The file to download is "download-test1.lib". | |
| 837 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 838 DownloadAndWaitWithDisposition(browser(), | |
| 839 GURL("javascript:openNew()"), | |
| 840 CURRENT_TAB, | |
| 841 EXPECT_NO_SELECT_DIALOG, | |
| 842 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | |
| 843 | |
| 844 // When the download finishes, we should still have one tab. | |
| 845 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 846 EXPECT_EQ(1, browser()->tab_count()); | |
| 847 | |
| 848 CheckDownload(browser(), file, file); | |
| 849 } | |
| 850 | |
| 851 // Open a web page in the current tab, then call Javascript via a button to | |
| 852 // download a file in a new tab, which is closed automatically when the | |
| 853 // download begins. | |
| 854 // Verify that we have 1 tab, and the download shelf is visible. | |
| 855 // | |
| 856 // The download_page4.html page contains a form with download-test1.lib as the | |
| 857 // action. | |
| 858 // | |
| 859 // The test sometimes trips over underlying flakiness in the downloads | |
| 860 // subsystem in in http://crbug.com/63237. It's entered as | |
| 861 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 862 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 863 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_CloseNewTab3) { | |
| 864 ASSERT_TRUE(InitialSetup(false)); | |
| 865 // Because it's an HTML link, it should open a web page rather than | |
| 866 // downloading. | |
| 867 FilePath file1(FILE_PATH_LITERAL("download_page4.html")); | |
| 868 GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); | |
| 869 | |
| 870 // Open a web page and wait. | |
| 871 ui_test_utils::NavigateToURL(browser(), url); | |
| 872 | |
| 873 // Download a file in a new tab and wait. The tab will automatically close | |
| 874 // when the download begins. | |
| 875 // The file to download is "download-test1.lib". | |
| 876 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 877 DownloadAndWaitWithDisposition( | |
| 878 browser(), | |
| 879 GURL("javascript:document.getElementById('form').submit()"), | |
| 880 CURRENT_TAB, | |
| 881 EXPECT_NO_SELECT_DIALOG, | |
| 882 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | |
| 883 | |
| 884 // When the download finishes, we should still have one tab. | |
| 885 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | |
| 886 EXPECT_EQ(1, browser()->tab_count()); | |
| 887 | |
| 888 CheckDownload(browser(), file, file); | |
| 889 } | |
| 890 | |
| 891 // Download a file in a new window. | |
| 892 // Verify that we have 2 windows, and the download shelf is not visible in the | |
| 893 // first window, but is visible in the second window. | |
| 894 // Close the new window. | |
| 895 // Verify that we have 1 window, and the download shelf is not visible. | |
| 896 // | |
| 897 // Regression test for http://crbug.com/44454 | |
| 898 // | |
| 899 // Test is believed mostly good (non-flaky) in itself, but it | |
| 900 // sometimes trips over underlying flakiness in the downloads | |
| 901 // subsystem in in http://crbug.com/63237. Until that bug is | |
| 902 // fixed, this test should be considered flaky. It's entered as | |
| 903 // DISABLED since if 63237 does cause a failure, it'll be a timeout. | |
| 904 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | |
| 905 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_NewWindow) { | |
| 906 ASSERT_TRUE(InitialSetup(false)); | |
| 907 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | |
| 908 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | |
| 909 Browser* first_browser = browser(); | |
| 910 | |
| 911 // Download a file in a new window and wait. | |
| 912 DownloadAndWaitWithDisposition(browser(), | |
| 913 url, | |
| 914 NEW_WINDOW, | |
| 915 EXPECT_NO_SELECT_DIALOG, | |
| 916 ui_test_utils::BROWSER_TEST_NONE); | |
| 917 | |
| 918 // When the download finishes, the download shelf SHOULD NOT be visible in | |
| 919 // the first window. | |
| 920 int window_count = BrowserList::size(); | |
| 921 EXPECT_EQ(2, window_count); | |
| 922 EXPECT_EQ(1, browser()->tab_count()); | |
| 923 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | |
| 924 | |
| 925 // The download shelf SHOULD be visible in the second window. | |
| 926 std::set<Browser*> original_browsers; | |
| 927 original_browsers.insert(browser()); | |
| 928 Browser* download_browser = | |
| 929 ui_test_utils::GetBrowserNotInSet(original_browsers); | |
| 930 ASSERT_TRUE(download_browser != NULL); | |
| 931 EXPECT_NE(download_browser, browser()); | |
| 932 EXPECT_EQ(1, download_browser->tab_count()); | |
| 933 EXPECT_TRUE(download_browser->window()->IsDownloadShelfVisible()); | |
| 934 | |
| 935 // Close the new window. | |
| 936 download_browser->CloseWindow(); | |
| 937 ui_test_utils::WaitForNotificationFrom(NotificationType::BROWSER_CLOSED, | |
| 938 Source<Browser>(download_browser)); | |
| 939 EXPECT_EQ(first_browser, browser()); | |
| 940 window_count = BrowserList::size(); | |
| 941 EXPECT_EQ(1, window_count); | |
| 942 EXPECT_EQ(1, browser()->tab_count()); | |
| 943 // The download shelf should not be visible in the remaining window. | |
| 944 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | |
| 945 | |
| 946 CheckDownload(browser(), file, file); | |
| 334 } | 947 } |
| 335 | 948 |
| 336 } // namespace | 949 } // namespace |
| OLD | NEW |