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

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

Issue 625113002: replace OVERRIDE and FINAL with override and final in chrome/browser/[a-i]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix newly added OVERRIDEs 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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/download/download_history.h" 10 #include "chrome/browser/download/download_history.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 public: 66 public:
67 FakeHistoryAdapter() 67 FakeHistoryAdapter()
68 : DownloadHistory::HistoryAdapter(NULL), 68 : DownloadHistory::HistoryAdapter(NULL),
69 slow_create_download_(false), 69 slow_create_download_(false),
70 fail_create_download_(false) { 70 fail_create_download_(false) {
71 } 71 }
72 72
73 virtual ~FakeHistoryAdapter() {} 73 virtual ~FakeHistoryAdapter() {}
74 74
75 virtual void QueryDownloads( 75 virtual void QueryDownloads(
76 const HistoryService::DownloadQueryCallback& callback) OVERRIDE { 76 const HistoryService::DownloadQueryCallback& callback) override {
77 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 77 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
78 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 78 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
79 base::Bind(&FakeHistoryAdapter::QueryDownloadsDone, 79 base::Bind(&FakeHistoryAdapter::QueryDownloadsDone,
80 base::Unretained(this), callback)); 80 base::Unretained(this), callback));
81 } 81 }
82 82
83 void QueryDownloadsDone( 83 void QueryDownloadsDone(
84 const HistoryService::DownloadQueryCallback& callback) { 84 const HistoryService::DownloadQueryCallback& callback) {
85 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 85 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
86 CHECK(expect_query_downloads_.get()); 86 CHECK(expect_query_downloads_.get());
87 callback.Run(expect_query_downloads_.Pass()); 87 callback.Run(expect_query_downloads_.Pass());
88 } 88 }
89 89
90 void set_slow_create_download(bool slow) { slow_create_download_ = slow; } 90 void set_slow_create_download(bool slow) { slow_create_download_ = slow; }
91 91
92 virtual void CreateDownload( 92 virtual void CreateDownload(
93 const history::DownloadRow& info, 93 const history::DownloadRow& info,
94 const HistoryService::DownloadCreateCallback& callback) OVERRIDE { 94 const HistoryService::DownloadCreateCallback& callback) override {
95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
96 create_download_info_ = info; 96 create_download_info_ = info;
97 // Must not call CreateDownload() again before FinishCreateDownload()! 97 // Must not call CreateDownload() again before FinishCreateDownload()!
98 DCHECK(create_download_callback_.is_null()); 98 DCHECK(create_download_callback_.is_null());
99 create_download_callback_ = base::Bind(callback, !fail_create_download_); 99 create_download_callback_ = base::Bind(callback, !fail_create_download_);
100 fail_create_download_ = false; 100 fail_create_download_ = false;
101 if (!slow_create_download_) 101 if (!slow_create_download_)
102 FinishCreateDownload(); 102 FinishCreateDownload();
103 } 103 }
104 104
105 void FinishCreateDownload() { 105 void FinishCreateDownload() {
106 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 106 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
107 create_download_callback_.Run(); 107 create_download_callback_.Run();
108 create_download_callback_.Reset(); 108 create_download_callback_.Reset();
109 } 109 }
110 110
111 virtual void UpdateDownload( 111 virtual void UpdateDownload(
112 const history::DownloadRow& info) OVERRIDE { 112 const history::DownloadRow& info) override {
113 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 113 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
114 update_download_ = info; 114 update_download_ = info;
115 } 115 }
116 116
117 virtual void RemoveDownloads(const IdSet& ids) OVERRIDE { 117 virtual void RemoveDownloads(const IdSet& ids) override {
118 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 118 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
119 for (IdSet::const_iterator it = ids.begin(); 119 for (IdSet::const_iterator it = ids.begin();
120 it != ids.end(); ++it) { 120 it != ids.end(); ++it) {
121 remove_downloads_.insert(*it); 121 remove_downloads_.insert(*it);
122 } 122 }
123 } 123 }
124 124
125 void ExpectWillQueryDownloads(scoped_ptr<InfoVector> infos) { 125 void ExpectWillQueryDownloads(scoped_ptr<InfoVector> infos) {
126 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 126 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
127 expect_query_downloads_ = infos.Pass(); 127 expect_query_downloads_ = infos.Pass();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 : ui_thread_(content::BrowserThread::UI, &loop_), 202 : ui_thread_(content::BrowserThread::UI, &loop_),
203 manager_(new content::MockDownloadManager()), 203 manager_(new content::MockDownloadManager()),
204 history_(NULL), 204 history_(NULL),
205 manager_observer_(NULL), 205 manager_observer_(NULL),
206 download_created_index_(0) {} 206 download_created_index_(0) {}
207 virtual ~DownloadHistoryTest() { 207 virtual ~DownloadHistoryTest() {
208 STLDeleteElements(&items_); 208 STLDeleteElements(&items_);
209 } 209 }
210 210
211 protected: 211 protected:
212 virtual void TearDown() OVERRIDE { 212 virtual void TearDown() override {
213 download_history_.reset(); 213 download_history_.reset();
214 } 214 }
215 215
216 content::MockDownloadManager& manager() { return *manager_.get(); } 216 content::MockDownloadManager& manager() { return *manager_.get(); }
217 content::MockDownloadItem& item(size_t index) { return *items_[index]; } 217 content::MockDownloadItem& item(size_t index) { return *items_[index]; }
218 DownloadHistory* download_history() { return download_history_.get(); } 218 DownloadHistory* download_history() { return download_history_.get(); }
219 219
220 void SetManagerObserver( 220 void SetManagerObserver(
221 content::DownloadManager::Observer* manager_observer) { 221 content::DownloadManager::Observer* manager_observer) {
222 manager_observer_ = manager_observer; 222 manager_observer_ = manager_observer;
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 FinishCreateDownload(); 862 FinishCreateDownload();
863 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); 863 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0)));
864 864
865 // ItemAdded should call OnDownloadUpdated, which should detect that the item 865 // ItemAdded should call OnDownloadUpdated, which should detect that the item
866 // changed while it was being added and call UpdateDownload immediately. 866 // changed while it was being added and call UpdateDownload immediately.
867 info.opened = true; 867 info.opened = true;
868 ExpectDownloadUpdated(info); 868 ExpectDownloadUpdated(info);
869 } 869 }
870 870
871 } // anonymous namespace 871 } // anonymous namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_history.h ('k') | chrome/browser/download/download_path_reservation_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698