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

Unified Diff: content/browser/download/download_item_impl_unittest.cc

Issue 2435863004: Remove stl_util's deletion function use from content/. (Closed)
Patch Set: minus service worker 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
Index: content/browser/download/download_item_impl_unittest.cc
diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc
index 8d3093ac3690c2425b6363e455cb3dbcbe04e26c..4f84f66dfe6a49dddbb3aa677460d08ceb629da6 100644
--- a/content/browser/download/download_item_impl_unittest.cc
+++ b/content/browser/download/download_item_impl_unittest.cc
@@ -7,14 +7,16 @@
#include <stdint.h>
#include <iterator>
+#include <map>
+#include <memory>
#include <queue>
#include <utility>
#include "base/callback.h"
#include "base/feature_list.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
-#include "base/stl_util.h"
#include "base/threading/thread.h"
#include "content/browser/byte_stream.h"
#include "content/browser/download/download_create_info.h"
@@ -254,7 +256,6 @@ class DownloadItemTest : public testing::Test {
~DownloadItemTest() {
RunAllPendingInMessageLoops();
- base::STLDeleteElements(&allocated_downloads_);
}
DownloadItemImpl* CreateDownloadItemWithCreateInfo(
@@ -262,7 +263,7 @@ class DownloadItemTest : public testing::Test {
DownloadItemImpl* download =
new DownloadItemImpl(&delegate_, next_download_id_++, *(info.get()),
net::NetLogWithSource());
- allocated_downloads_.insert(download);
+ allocated_downloads_[download] = base::WrapUnique(download);
return download;
}
@@ -274,7 +275,7 @@ class DownloadItemTest : public testing::Test {
DownloadItemImpl* download =
new DownloadItemImpl(&delegate_, create_info_->download_id,
*create_info_, net::NetLogWithSource());
- allocated_downloads_.insert(download);
+ allocated_downloads_[download] = base::WrapUnique(download);
return download;
}
@@ -376,7 +377,6 @@ class DownloadItemTest : public testing::Test {
// Destroy a previously created download item.
void DestroyDownloadItem(DownloadItem* item) {
allocated_downloads_.erase(item);
- delete item;
}
void RunAllPendingInMessageLoops() { base::RunLoop().RunUntilIdle(); }
@@ -397,7 +397,7 @@ class DownloadItemTest : public testing::Test {
private:
TestBrowserThreadBundle thread_bundle_;
StrictMock<MockDelegate> delegate_;
- std::set<DownloadItem*> allocated_downloads_;
+ std::map<DownloadItem*, std::unique_ptr<DownloadItem>> allocated_downloads_;
std::unique_ptr<DownloadCreateInfo> create_info_;
uint32_t next_download_id_ = DownloadItem::kInvalidId + 1;
TestBrowserContext browser_context_;
« no previous file with comments | « content/browser/devtools/protocol/tethering_handler.cc ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698