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

Side by Side Diff: content/browser/download/download_item_impl_unittest.cc

Issue 638503002: Replacing the OVERRIDE with override and FINAL with final in content/browser/[download|… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 "base/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "content/browser/byte_stream.h" 10 #include "content/browser/byte_stream.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 MOCK_METHOD2(DetermineDownloadTarget, void( 47 MOCK_METHOD2(DetermineDownloadTarget, void(
48 DownloadItemImpl*, const DownloadTargetCallback&)); 48 DownloadItemImpl*, const DownloadTargetCallback&));
49 MOCK_METHOD2(ShouldCompleteDownload, 49 MOCK_METHOD2(ShouldCompleteDownload,
50 bool(DownloadItemImpl*, const base::Closure&)); 50 bool(DownloadItemImpl*, const base::Closure&));
51 MOCK_METHOD2(ShouldOpenDownload, 51 MOCK_METHOD2(ShouldOpenDownload,
52 bool(DownloadItemImpl*, const ShouldOpenDownloadCallback&)); 52 bool(DownloadItemImpl*, const ShouldOpenDownloadCallback&));
53 MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const base::FilePath&)); 53 MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const base::FilePath&));
54 MOCK_METHOD1(CheckForFileRemoval, void(DownloadItemImpl*)); 54 MOCK_METHOD1(CheckForFileRemoval, void(DownloadItemImpl*));
55 55
56 virtual void ResumeInterruptedDownload( 56 virtual void ResumeInterruptedDownload(
57 scoped_ptr<DownloadUrlParameters> params, uint32 id) OVERRIDE { 57 scoped_ptr<DownloadUrlParameters> params, uint32 id) override {
58 MockResumeInterruptedDownload(params.get(), id); 58 MockResumeInterruptedDownload(params.get(), id);
59 } 59 }
60 MOCK_METHOD2(MockResumeInterruptedDownload, 60 MOCK_METHOD2(MockResumeInterruptedDownload,
61 void(DownloadUrlParameters* params, uint32 id)); 61 void(DownloadUrlParameters* params, uint32 id));
62 62
63 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*()); 63 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*());
64 MOCK_METHOD1(UpdatePersistence, void(DownloadItemImpl*)); 64 MOCK_METHOD1(UpdatePersistence, void(DownloadItemImpl*));
65 MOCK_METHOD1(DownloadOpened, void(DownloadItemImpl*)); 65 MOCK_METHOD1(DownloadOpened, void(DownloadItemImpl*));
66 MOCK_METHOD1(DownloadRemoved, void(DownloadItemImpl*)); 66 MOCK_METHOD1(DownloadRemoved, void(DownloadItemImpl*));
67 MOCK_CONST_METHOD1(AssertStateConsistent, void(DownloadItemImpl*)); 67 MOCK_CONST_METHOD1(AssertStateConsistent, void(DownloadItemImpl*));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 updated_(false), 118 updated_(false),
119 interrupt_count_(0), 119 interrupt_count_(0),
120 resume_count_(0) { 120 resume_count_(0) {
121 item_->AddObserver(this); 121 item_->AddObserver(this);
122 } 122 }
123 123
124 virtual ~MockObserver() { 124 virtual ~MockObserver() {
125 if (item_) item_->RemoveObserver(this); 125 if (item_) item_->RemoveObserver(this);
126 } 126 }
127 127
128 virtual void OnDownloadRemoved(DownloadItem* download) OVERRIDE { 128 virtual void OnDownloadRemoved(DownloadItem* download) override {
129 DVLOG(20) << " " << __FUNCTION__ 129 DVLOG(20) << " " << __FUNCTION__
130 << " download = " << download->DebugString(false); 130 << " download = " << download->DebugString(false);
131 removed_ = true; 131 removed_ = true;
132 } 132 }
133 133
134 virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE { 134 virtual void OnDownloadUpdated(DownloadItem* download) override {
135 DVLOG(20) << " " << __FUNCTION__ 135 DVLOG(20) << " " << __FUNCTION__
136 << " download = " << download->DebugString(false); 136 << " download = " << download->DebugString(false);
137 updated_ = true; 137 updated_ = true;
138 DownloadItem::DownloadState new_state = download->GetState(); 138 DownloadItem::DownloadState new_state = download->GetState();
139 if (last_state_ == DownloadItem::IN_PROGRESS && 139 if (last_state_ == DownloadItem::IN_PROGRESS &&
140 new_state == DownloadItem::INTERRUPTED) { 140 new_state == DownloadItem::INTERRUPTED) {
141 interrupt_count_++; 141 interrupt_count_++;
142 } 142 }
143 if (last_state_ == DownloadItem::INTERRUPTED && 143 if (last_state_ == DownloadItem::INTERRUPTED &&
144 new_state == DownloadItem::IN_PROGRESS) { 144 new_state == DownloadItem::IN_PROGRESS) {
145 resume_count_++; 145 resume_count_++;
146 } 146 }
147 last_state_ = new_state; 147 last_state_ = new_state;
148 } 148 }
149 149
150 virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE { 150 virtual void OnDownloadOpened(DownloadItem* download) override {
151 DVLOG(20) << " " << __FUNCTION__ 151 DVLOG(20) << " " << __FUNCTION__
152 << " download = " << download->DebugString(false); 152 << " download = " << download->DebugString(false);
153 } 153 }
154 154
155 virtual void OnDownloadDestroyed(DownloadItem* download) OVERRIDE { 155 virtual void OnDownloadDestroyed(DownloadItem* download) override {
156 DVLOG(20) << " " << __FUNCTION__ 156 DVLOG(20) << " " << __FUNCTION__
157 << " download = " << download->DebugString(false); 157 << " download = " << download->DebugString(false);
158 destroyed_ = true; 158 destroyed_ = true;
159 item_->RemoveObserver(this); 159 item_->RemoveObserver(this);
160 item_ = NULL; 160 item_ = NULL;
161 } 161 }
162 162
163 bool CheckRemoved() { 163 bool CheckRemoved() {
164 return removed_; 164 return removed_;
165 } 165 }
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 base::Unretained(&returned_path))); 1293 base::Unretained(&returned_path)));
1294 RunAllPendingInMessageLoops(); 1294 RunAllPendingInMessageLoops();
1295 EXPECT_TRUE(returned_path.empty()); 1295 EXPECT_TRUE(returned_path.empty());
1296 } 1296 }
1297 1297
1298 TEST(MockDownloadItem, Compiles) { 1298 TEST(MockDownloadItem, Compiles) {
1299 MockDownloadItem mock_item; 1299 MockDownloadItem mock_item;
1300 } 1300 }
1301 1301
1302 } // namespace content 1302 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698