Commit 8894a3f3 authored by Chris Mumford's avatar Chris Mumford Committed by Commit Bot

it2me: Switch from testing::CreateFunctor to lambda.

This change switches from using testing::CreateFunctor
when calling testing::Invoke() to a C++ lambda. This
improves test readibility and makes easier an upcoming
changes to gmock_mutant.h (switch away from base::Bind()).

Bug: 1007833, 806952
Change-Id: I73784234ade2a344c0a329615ca17d586f962da9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1874192Reviewed-by: default avatarGary Kacmarcik <garykac@chromium.org>
Commit-Queue: Chris Mumford <cmumford@google.com>
Cr-Commit-Position: refs/heads/master@{#708334}
parent 1d08eff8
...@@ -13,11 +13,9 @@ ...@@ -13,11 +13,9 @@
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gmock_mutant.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using ::testing::InvokeWithoutArgs; using ::testing::InvokeWithoutArgs;
using ::testing::CreateFunctor;
namespace remoting { namespace remoting {
...@@ -136,13 +134,11 @@ It2MeConfirmationDialogProxyTest::~It2MeConfirmationDialogProxyTest() = default; ...@@ -136,13 +134,11 @@ It2MeConfirmationDialogProxyTest::~It2MeConfirmationDialogProxyTest() = default;
TEST_F(It2MeConfirmationDialogProxyTest, Show) { TEST_F(It2MeConfirmationDialogProxyTest, Show) {
ResultCallbackTarget callback_target(main_task_runner()); ResultCallbackTarget callback_target(main_task_runner());
StubIt2MeConfirmationDialog* confirm_dialog = dialog();
EXPECT_CALL(*dialog(), OnShow()) EXPECT_CALL(*dialog(), OnShow())
.WillOnce( .WillOnce(InvokeWithoutArgs([confirm_dialog]() {
InvokeWithoutArgs( confirm_dialog->ReportResult(It2MeConfirmationDialog::Result::CANCEL);
CreateFunctor( }));
&StubIt2MeConfirmationDialog::ReportResult,
base::Unretained(dialog()),
It2MeConfirmationDialog::Result::CANCEL)));
EXPECT_CALL(callback_target, EXPECT_CALL(callback_target,
OnDialogResult(It2MeConfirmationDialog::Result::CANCEL)) OnDialogResult(It2MeConfirmationDialog::Result::CANCEL))
......
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