OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/download/download_prefs.h" | 10 #include "chrome/browser/download/download_prefs.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 // The download's target file path. | 381 // The download's target file path. |
382 base::FilePath target_path = | 382 base::FilePath target_path = |
383 downloads_dir_.path().Append(FILE_PATH_LITERAL("download_target.txt")); | 383 downloads_dir_.path().Append(FILE_PATH_LITERAL("download_target.txt")); |
384 | 384 |
385 // Set the downloads parameters. | 385 // Set the downloads parameters. |
386 content::WebContents* web_contents = | 386 content::WebContents* web_contents = |
387 browser()->tab_strip_model()->GetActiveWebContents(); | 387 browser()->tab_strip_model()->GetActiveWebContents(); |
388 ASSERT_TRUE(web_contents); | 388 ASSERT_TRUE(web_contents); |
389 std::unique_ptr<DownloadUrlParameters> params( | 389 std::unique_ptr<DownloadUrlParameters> params( |
390 DownloadUrlParameters::FromWebContents(web_contents, url)); | 390 DownloadUrlParameters::CreateForWebContentsMainFrame( |
| 391 web_contents, url)); |
391 params->set_file_path(target_path); | 392 params->set_file_path(target_path); |
392 | 393 |
393 // Start download of the URL with a path "/text_path.txt" on the test server. | 394 // Start download of the URL with a path "/text_path.txt" on the test server. |
394 download_manager->DownloadUrl(std::move(params)); | 395 download_manager->DownloadUrl(std::move(params)); |
395 | 396 |
396 // Wait for the download to start. | 397 // Wait for the download to start. |
397 download_observer->WaitForFinished(); | 398 download_observer->WaitForFinished(); |
398 | 399 |
399 // There should have been one download. | 400 // There should have been one download. |
400 std::vector<DownloadItem*> downloads; | 401 std::vector<DownloadItem*> downloads; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 base::MessageLoop::current()->RunUntilIdle(); | 448 base::MessageLoop::current()->RunUntilIdle(); |
448 EXPECT_TRUE(catcher.GetNextResult()); | 449 EXPECT_TRUE(catcher.GetNextResult()); |
449 | 450 |
450 ui_test_utils::NavigateToURL(browser(), | 451 ui_test_utils::NavigateToURL(browser(), |
451 test_server_->GetURL("/abort.rtf")); | 452 test_server_->GetURL("/abort.rtf")); |
452 base::MessageLoop::current()->RunUntilIdle(); | 453 base::MessageLoop::current()->RunUntilIdle(); |
453 EXPECT_TRUE(catcher.GetNextResult()); | 454 EXPECT_TRUE(catcher.GetNextResult()); |
454 } | 455 } |
455 | 456 |
456 } // namespace | 457 } // namespace |
OLD | NEW |