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..e3f5cccec6013f2c2c33668858699607ea8e2f0c 100644 |
--- a/chrome/browser/download/download_manager_unittest.cc |
+++ b/chrome/browser/download/download_manager_unittest.cc |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
#include <string> |
+#include <tr1/functional> |
#include "base/string_util.h" |
#include "build/build_config.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,9 +209,11 @@ class MockDownloadFile : public DownloadFile { |
TEST_F(DownloadManagerTest, DownloadRenameTest) { |
using ::testing::_; |
- using ::testing::CreateFunctor; |
using ::testing::Invoke; |
using ::testing::Return; |
+ using ::std::tr1::bind; |
+ using ::std::tr1::placeholders::_1; |
+ using ::std::tr1::placeholders::_2; |
BrowserThread file_thread(BrowserThread::FILE, &message_loop_); |
@@ -235,13 +237,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( |
+ bind(&MockDownloadFile::TestMultipleRename, |
+ download, 1, false, crdownload, _1, _2)))) |
+ .WillOnce(testing::WithArgs<0, 1>(Invoke( |
+ bind(&MockDownloadFile::TestMultipleRename, |
+ download, 2, true, new_path, _1, _2)))); |
} |
if (kDownloadRenameCases[i].will_delete_crdownload) |