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

Side by Side Diff: chrome/browser/android/download/download_manager_service_unittest.cc

Issue 2344483003: Ask download manager to remove a download if it is overwritten by another (Closed)
Patch Set: rename function Created 4 years, 3 months 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 | « chrome/browser/android/download/download_manager_service.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/android/download/download_manager_service.h" 5 #include "chrome/browser/android/download/download_manager_service.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 23
24 namespace content { 24 namespace content {
25 class BrowserContext; 25 class BrowserContext;
26 class ByteStreamReader; 26 class ByteStreamReader;
27 class DownloadManagerDelegate; 27 class DownloadManagerDelegate;
28 struct DownloadCreateInfo; 28 struct DownloadCreateInfo;
29 } 29 }
30 30
31 class MockDownloadManagerService : public DownloadManagerService { 31 class MockDownloadManagerService : public DownloadManagerService {
32 public: 32 public:
33 MockDownloadManagerService() 33 MockDownloadManagerService() : DownloadManagerService() {
34 : DownloadManagerService(base::android::AttachCurrentThread(), nullptr) {
35 ON_CALL(manager_, GetDownloadByGuid(_)).WillByDefault( 34 ON_CALL(manager_, GetDownloadByGuid(_)).WillByDefault(
36 ::testing::Invoke(this, 35 ::testing::Invoke(this,
37 &MockDownloadManagerService::GetDownloadByGuid)); 36 &MockDownloadManagerService::GetDownloadByGuid));
38 } 37 }
39 38
40 void CreateDownloadItem(bool can_resume) { 39 void CreateDownloadItem(bool can_resume) {
41 download_.reset(new content::MockDownloadItem()); 40 download_.reset(new content::MockDownloadItem());
42 ON_CALL(*download_, CanResume()).WillByDefault( 41 ON_CALL(*download_, CanResume()).WillByDefault(
43 ::testing::Return(can_resume)); 42 ::testing::Return(can_resume));
44 } 43 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 StartDownload("0000"); 101 StartDownload("0000");
103 EXPECT_TRUE(success_); 102 EXPECT_TRUE(success_);
104 } 103 }
105 104
106 // Test that resumption fails if the target download item is not resumable. 105 // Test that resumption fails if the target download item is not resumable.
107 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) { 106 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) {
108 service_->CreateDownloadItem(false); 107 service_->CreateDownloadItem(false);
109 StartDownload("0000"); 108 StartDownload("0000");
110 EXPECT_FALSE(success_); 109 EXPECT_FALSE(success_);
111 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/android/download/download_manager_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698