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

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

Issue 6094005: Create "Prebind" a wrapper to tr1::bind. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Closure example ported to Prebinds Created 10 years 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_manager_unittest.cc
diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc
index 210788d02f2b805e9302f78b0276fe8357cecb4a..2d2ba5be8eef9eb4549378245ee706c18527dd25 100644
--- a/chrome/browser/download/download_manager_unittest.cc
+++ b/chrome/browser/download/download_manager_unittest.cc
@@ -5,6 +5,7 @@
#include <string>
#include "base/string_util.h"
+#include "base/prebind.h"
#include "build/build_config.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/download/download_file.h"
@@ -18,7 +19,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/testing_profile.h"
#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gmock_mutant.h"
#include "testing/gtest/include/gtest/gtest.h"
class MockDownloadManager : public DownloadManager {
@@ -209,7 +209,6 @@ class MockDownloadFile : public DownloadFile {
TEST_F(DownloadManagerTest, DownloadRenameTest) {
using ::testing::_;
- using ::testing::CreateFunctor;
using ::testing::Invoke;
using ::testing::Return;
@@ -235,13 +234,15 @@ TEST_F(DownloadManagerTest, DownloadRenameTest) {
} else {
ASSERT_EQ(2, kDownloadRenameCases[i].expected_rename_count);
FilePath crdownload(download_util::GetCrDownloadPath(new_path));
+ // Use tr1 bind to replace the "Mutant" calls with gmock. Demonstrates
+ // partial binding using placeholders.
EXPECT_CALL(*download, Rename(_, _))
- .WillOnce(testing::WithArgs<0, 1>(Invoke(CreateFunctor(
- download, &MockDownloadFile::TestMultipleRename,
- 1, false, crdownload))))
- .WillOnce(testing::WithArgs<0, 1>(Invoke(CreateFunctor(
- download, &MockDownloadFile::TestMultipleRename,
- 2, true, new_path))));
+ .WillOnce(testing::WithArgs<0, 1>(Invoke(
+ base::Prebind(&MockDownloadFile::TestMultipleRename,
+ base::Unretained(download), 1, false, crdownload))))
+ .WillOnce(testing::WithArgs<0, 1>(Invoke(
+ base::Prebind(&MockDownloadFile::TestMultipleRename,
+ base::Unretained(download), 2, true, ::std::tr1::ref(new_path)))));
}
if (kDownloadRenameCases[i].will_delete_crdownload)
« base/prebind.h ('K') | « base/worker_pool.h ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698