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

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

Issue 14593012: BrowserContext should simply own DownloadManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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: chrome/browser/download/download_status_updater_unittest.cc
diff --git a/chrome/browser/download/download_status_updater_unittest.cc b/chrome/browser/download/download_status_updater_unittest.cc
index 06a137dd223c3191a934f57525dc313cef11db58..219374d40954f2a184e88e1f149699905b34d43a 100644
--- a/chrome/browser/download/download_status_updater_unittest.cc
+++ b/chrome/browser/download/download_status_updater_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/stl_util.h"
@@ -79,7 +79,7 @@ class DownloadStatusUpdaterTest : public testing::Test {
for (int i = 0; i < manager_count; ++i) {
content::MockDownloadManager* mgr =
new StrictMock<content::MockDownloadManager>;
- managers_.push_back(make_scoped_refptr(mgr));
+ managers_.push_back(mgr);
}
}
@@ -89,7 +89,7 @@ class DownloadStatusUpdaterTest : public testing::Test {
// Hook the specified manager into the updater.
void LinkManager(int i) {
- content::MockDownloadManager* mgr = managers_[i].get();
+ content::MockDownloadManager* mgr = managers_[i];
manager_observer_index_ = i;
while (manager_observers_.size() <= static_cast<size_t>(i)) {
manager_observers_.push_back(NULL);
@@ -103,7 +103,7 @@ class DownloadStatusUpdaterTest : public testing::Test {
// Add some number of Download items to a particular manager.
void AddItems(int manager_index, int item_count, int in_progress_count) {
DCHECK_GT(managers_.size(), static_cast<size_t>(manager_index));
- content::MockDownloadManager* manager = managers_[manager_index].get();
+ content::MockDownloadManager* manager = managers_[manager_index];
if (manager_items_.size() <= static_cast<size_t>(manager_index))
manager_items_.resize(manager_index+1);
@@ -125,7 +125,7 @@ class DownloadStatusUpdaterTest : public testing::Test {
// Return the specified manager.
content::MockDownloadManager* Manager(int manager_index) {
DCHECK_GT(managers_.size(), static_cast<size_t>(manager_index));
- return managers_[manager_index].get();
+ return managers_[manager_index];
}
// Return the specified item.
@@ -161,16 +161,16 @@ class DownloadStatusUpdaterTest : public testing::Test {
// Verify and clear all mocks expectations.
void VerifyAndClearExpectations() {
- for (std::vector<scoped_refptr<content::MockDownloadManager> >::iterator it
+ for (ScopedVector<content::MockDownloadManager>::iterator it
= managers_.begin(); it != managers_.end(); ++it)
- Mock::VerifyAndClearExpectations(it->get());
+ Mock::VerifyAndClearExpectations(*it);
for (std::vector<Items>::iterator it = manager_items_.begin();
it != manager_items_.end(); ++it)
for (Items::iterator sit = it->begin(); sit != it->end(); ++sit)
Mock::VerifyAndClearExpectations(*sit);
}
- std::vector<scoped_refptr<content::MockDownloadManager> > managers_;
+ ScopedVector<content::MockDownloadManager> managers_;
// DownloadItem so that it can be assigned to the result of SearchDownloads.
typedef std::vector<content::DownloadItem*> Items;
std::vector<Items> manager_items_;
@@ -208,7 +208,7 @@ TEST_F(DownloadStatusUpdaterTest, OneManagerNoItems) {
float progress = -1;
int download_count = -1;
- EXPECT_CALL(*managers_[0].get(), GetAllDownloads(_))
+ EXPECT_CALL(*managers_[0], GetAllDownloads(_))
.WillRepeatedly(SetArgPointee<0>(manager_items_[0]));
EXPECT_TRUE(updater_->GetProgress(&progress, &download_count));
EXPECT_FLOAT_EQ(0.0f, progress);

Powered by Google App Engine
This is Rietveld 408576698