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

Unified Diff: components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc

Issue 2062333002: mojo::Callback -> base::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
« no previous file with comments | « components/arc/arc_bridge_service.cc ('k') | components/filesystem/files_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc b/components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc
index 70c2cd0d6329ce6b51d3cf59878f7294f3c5fee9..4cb0d63231a654583e9fadc0b886395102c5ff10 100644
--- a/components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc
+++ b/components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc
@@ -69,6 +69,36 @@ class AutofillTypeTraitsTestImpl : public testing::Test,
mojo::BindingSet<TypeTraitsTest> bindings_;
};
+void ExpectFormFieldData(const FormFieldData& expected,
+ const base::Closure& closure,
+ const FormFieldData& passed) {
+ EXPECT_TRUE(expected.SameFieldAs(passed));
+ EXPECT_EQ(expected.option_values, passed.option_values);
+ EXPECT_EQ(expected.option_contents, passed.option_contents);
+ closure.Run();
+}
+
+void ExpectFormData(const FormData& expected,
+ const base::Closure& closure,
+ const FormData& passed) {
+ EXPECT_TRUE(expected.SameFormAs(passed));
+ closure.Run();
+}
+
+void ExpectFormFieldDataPredictions(const FormFieldDataPredictions& expected,
+ const base::Closure& closure,
+ const FormFieldDataPredictions& passed) {
+ EXPECT_EQ(expected, passed);
+ closure.Run();
+}
+
+void ExpectFormDataPredictions(const FormDataPredictions& expected,
+ const base::Closure& closure,
+ const FormDataPredictions& passed) {
+ EXPECT_EQ(expected, passed);
+ closure.Run();
+}
+
TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) {
FormFieldData input;
test::CreateTestSelectField("TestLabel", "TestName", "TestValue", kOptions,
@@ -76,12 +106,8 @@ TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) {
base::RunLoop loop;
mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
- proxy->PassFormFieldData(input, [&input, &loop](const FormFieldData& passed) {
- EXPECT_TRUE(input.SameFieldAs(passed));
- EXPECT_EQ(input.option_values, passed.option_values);
- EXPECT_EQ(input.option_contents, passed.option_contents);
- loop.Quit();
- });
+ proxy->PassFormFieldData(
+ input, base::Bind(&ExpectFormFieldData, input, loop.QuitClosure()));
loop.Run();
}
@@ -91,10 +117,8 @@ TEST_F(AutofillTypeTraitsTestImpl, PassFormData) {
base::RunLoop loop;
mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
- proxy->PassFormData(input, [&input, &loop](const FormData& passed) {
- EXPECT_TRUE(input.SameFormAs(passed));
- loop.Quit();
- });
+ proxy->PassFormData(
+ input, base::Bind(&ExpectFormData, input, loop.QuitClosure()));
loop.Run();
}
@@ -105,10 +129,8 @@ TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldDataPredictions) {
base::RunLoop loop;
mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
proxy->PassFormFieldDataPredictions(
- input, [&input, &loop](const FormFieldDataPredictions& passed) {
- EXPECT_TRUE(input == passed);
- loop.Quit();
- });
+ input,
+ base::Bind(&ExpectFormFieldDataPredictions, input, loop.QuitClosure()));
loop.Run();
}
@@ -128,10 +150,8 @@ TEST_F(AutofillTypeTraitsTestImpl, PassFormDataPredictions) {
base::RunLoop loop;
mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
proxy->PassFormDataPredictions(
- input, [&input, &loop](const FormDataPredictions& passed) {
- EXPECT_TRUE(input == passed);
- loop.Quit();
- });
+ input,
+ base::Bind(&ExpectFormDataPredictions, input, loop.QuitClosure()));
loop.Run();
}
« no previous file with comments | « components/arc/arc_bridge_service.cc ('k') | components/filesystem/files_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698