Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 1549573002: [download] DownloadTest.Resumption_Automatic should check final path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@path-reservation-tracker-owned-by-di
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 3101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 DownloadItem* download = StartMockDownloadAndInjectError( 3112 DownloadItem* download = StartMockDownloadAndInjectError(
3113 error_injector.get(), 3113 error_injector.get(),
3114 content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR); 3114 content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR);
3115 ASSERT_TRUE(download); 3115 ASSERT_TRUE(download);
3116 3116
3117 // The number of times this the download is resumed automatically is defined 3117 // The number of times this the download is resumed automatically is defined
3118 // in DownloadItemImpl::kMaxAutoResumeAttempts. The number of DownloadFiles 3118 // in DownloadItemImpl::kMaxAutoResumeAttempts. The number of DownloadFiles
3119 // created should be that number + 1 (for the original download request). We 3119 // created should be that number + 1 (for the original download request). We
3120 // only care that it is greater than 1. 3120 // only care that it is greater than 1.
3121 EXPECT_GT(1u, error_injector->TotalFileCount()); 3121 EXPECT_GT(1u, error_injector->TotalFileCount());
3122
3123 scoped_ptr<content::DownloadTestObserver> completion_observer(
3124 CreateWaiter(browser(), 1));
3125 download->Resume();
3126 completion_observer->WaitForFinished();
3127
3128 // Automatic resumption causes download target determination to be run
3129 // multiple times. Make sure we end up with the correct filename at the end.
3130 EXPECT_STREQ(kDownloadTest1Path,
3131 download->GetTargetFilePath().BaseName().AsUTF8Unsafe().c_str());
3122 } 3132 }
3123 3133
3124 // An interrupting download should be resumable multiple times. 3134 // An interrupting download should be resumable multiple times.
3125 IN_PROC_BROWSER_TEST_F(DownloadTest, Resumption_MultipleAttempts) { 3135 IN_PROC_BROWSER_TEST_F(DownloadTest, Resumption_MultipleAttempts) {
3126 scoped_refptr<content::TestFileErrorInjector> error_injector( 3136 scoped_refptr<content::TestFileErrorInjector> error_injector(
3127 content::TestFileErrorInjector::Create( 3137 content::TestFileErrorInjector::Create(
3128 DownloadManagerForBrowser(browser()))); 3138 DownloadManagerForBrowser(browser())));
3129 scoped_ptr<DownloadTestObserverNotInProgress> completion_observer( 3139 scoped_ptr<DownloadTestObserverNotInProgress> completion_observer(
3130 new DownloadTestObserverNotInProgress( 3140 new DownloadTestObserverNotInProgress(
3131 DownloadManagerForBrowser(browser()), 1)); 3141 DownloadManagerForBrowser(browser()), 1));
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 3633
3624 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( 3634 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter(
3625 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3635 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3626 ui_test_utils::NavigateToURL(browser(), extension_url); 3636 ui_test_utils::NavigateToURL(browser(), extension_url);
3627 3637
3628 observer->WaitForFinished(); 3638 observer->WaitForFinished();
3629 3639
3630 // Download shelf should close. 3640 // Download shelf should close.
3631 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3641 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3632 } 3642 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698