Commit c0ca109d authored by Chris Mumford's avatar Chris Mumford Committed by Commit Bot

Stopped using CreateFunctor in DownloadUIController_HistoryDownload.

Switching from testing::CreateFunctor to a C++ lambda is
slightly easier to understand, but allows the deletion of
an upcoming CL to delete gmock_mutant.h.

Bug: 1007833, 806952
Change-Id: Ib210a0c92090ca330f99b695a3256c981f7f14e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1887661Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Commit-Queue: Chris Mumford <cmumford@google.com>
Cr-Commit-Position: refs/heads/master@{#710424}
parent 8b8ecebb
......@@ -27,7 +27,6 @@
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/navigation_simulator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gmock_mutant.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::MockDownloadManager;
......@@ -36,7 +35,6 @@ using history::HistoryService;
using testing::_;
using testing::AnyNumber;
using testing::Assign;
using testing::CreateFunctor;
using testing::Return;
using testing::ReturnRef;
using testing::ReturnRefOfCopy;
......@@ -360,14 +358,16 @@ TEST_F(DownloadUIControllerTest, DownloadUIController_HistoryDownload) {
// is called, we need to first invoke the OnDownloadCreated callback for
// DownloadHistory before returning the DownloadItem since that's the
// sequence of events expected by DownloadHistory.
base::Closure history_on_created_callback =
base::Bind(&content::DownloadManager::Observer::OnDownloadCreated,
base::Unretained(download_history_manager_observer()),
manager(),
item.get());
content::DownloadManager::Observer* observer =
download_history_manager_observer();
MockDownloadManager* download_manager = manager();
MockDownloadItem* download_item = item.get();
EXPECT_CALL(*manager(), MockCreateDownloadItem(_))
.WillOnce(testing::DoAll(testing::InvokeWithoutArgs(CreateFunctor(
history_on_created_callback)),
.WillOnce(testing::DoAll(
testing::InvokeWithoutArgs(
[observer, download_manager, download_item]() {
observer->OnDownloadCreated(download_manager, download_item);
}),
Return(item.get())));
EXPECT_CALL(mock_function, Call());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment