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

Unified Diff: chrome/browser/download/download_query_unittest.cc

Issue 2457923002: Remove stl_util's deletion function use and ScopedVector from chrome/browser/download/. (Closed)
Patch Set: sky Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_query.cc ('k') | chrome/browser/download/download_status_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_query_unittest.cc
diff --git a/chrome/browser/download/download_query_unittest.cc b/chrome/browser/download/download_query_unittest.cc
index fbdbc0090b24230566d5479f2a43da0121927219..e47034302dc50bf61c01118275514c1288feadd1 100644
--- a/chrome/browser/download/download_query_unittest.cc
+++ b/chrome/browser/download/download_query_unittest.cc
@@ -15,7 +15,7 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -59,11 +59,12 @@ class DownloadQueryTest : public testing::Test {
~DownloadQueryTest() override {}
- void TearDown() override { base::STLDeleteElements(&mocks_); }
+ void TearDown() override {}
void CreateMocks(int count) {
for (int i = 0; i < count; ++i) {
- mocks_.push_back(new content::MockDownloadItem());
+ owned_mocks_.push_back(base::MakeUnique<content::MockDownloadItem>());
+ mocks_.push_back(owned_mocks_.back().get());
EXPECT_CALL(mock(mocks_.size() - 1), GetId()).WillRepeatedly(Return(
mocks_.size() - 1));
}
@@ -101,7 +102,11 @@ class DownloadQueryTest : public testing::Test {
}
private:
+ // These two vectors hold the MockDownloadItems. |mocks_| contains just the
+ // pointers, but is necessary because DownloadQuery processes vectors of
+ // unowned pointers. |owned_mocks_| holds the ownership of the mock objects.
std::vector<content::MockDownloadItem*> mocks_;
+ std::vector<std::unique_ptr<content::MockDownloadItem>> owned_mocks_;
DownloadQuery query_;
DownloadVector results_;
« no previous file with comments | « chrome/browser/download/download_query.cc ('k') | chrome/browser/download/download_status_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698