| Index: mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
|
| index f691085eff0382858715f2a586a73b4f4d2c992e..f7ba6b3549868278c7130c8ded04d9c607202f3f 100644
|
| --- a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "base/bind.h"
|
| #include "base/macros.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| @@ -77,6 +78,27 @@ WTFMap<WTF::String, WTF::String> ConstructStringMap() {
|
| return str_map;
|
| }
|
|
|
| +void ExpectString(const WTF::String& expected_string,
|
| + const base::Closure& closure,
|
| + const WTF::String& string) {
|
| + EXPECT_EQ(expected_string, string);
|
| + closure.Run();
|
| +}
|
| +
|
| +void ExpectStringArray(WTFArray<WTF::String> expected_arr,
|
| + const base::Closure& closure,
|
| + WTFArray<WTF::String> arr) {
|
| + EXPECT_TRUE(expected_arr.Equals(arr));
|
| + closure.Run();
|
| +}
|
| +
|
| +void ExpectStringMap(WTFMap<WTF::String, WTF::String> expected_map,
|
| + const base::Closure& closure,
|
| + WTFMap<WTF::String, WTF::String> map) {
|
| + EXPECT_TRUE(expected_map.Equals(map));
|
| + closure.Run();
|
| +}
|
| +
|
| } // namespace
|
|
|
| TEST_F(WTFTypesTest, Serialization_WTFArrayToWTFArray) {
|
| @@ -218,10 +240,8 @@ TEST_F(WTFTypesTest, SendString) {
|
| // - deserialized as mojo::String;
|
| // - serialized;
|
| // - deserialized as WTF::String.
|
| - ptr->EchoString(strs[i], [&loop, &strs, &i](const WTF::String& str) {
|
| - EXPECT_EQ(strs[i], str);
|
| - loop.Quit();
|
| - });
|
| + ptr->EchoString(strs[i],
|
| + base::Bind(&ExpectString, strs[i], loop.QuitClosure()));
|
| loop.Run();
|
| }
|
| }
|
| @@ -245,11 +265,10 @@ TEST_F(WTFTypesTest, SendStringArray) {
|
| // - deserialized as mojo::Array<mojo::String>;
|
| // - serialized;
|
| // - deserialized as mojo::WTFArray<WTF::String>.
|
| - ptr->EchoStringArray(std::move(arrs[i]),
|
| - [&loop, &expected_arr](WTFArray<WTF::String> arr) {
|
| - EXPECT_TRUE(expected_arr.Equals(arr));
|
| - loop.Quit();
|
| - });
|
| + ptr->EchoStringArray(
|
| + std::move(arrs[i]),
|
| + base::Bind(&ExpectStringArray, base::Passed(&expected_arr),
|
| + loop.QuitClosure()));
|
| loop.Run();
|
| }
|
| }
|
| @@ -275,10 +294,8 @@ TEST_F(WTFTypesTest, SendStringMap) {
|
| // - deserialized as mojo::WTFMap<WTF::String, WTF::String>.
|
| ptr->EchoStringMap(
|
| std::move(maps[i]),
|
| - [&loop, &expected_map](WTFMap<WTF::String, WTF::String> map) {
|
| - EXPECT_TRUE(expected_map.Equals(map));
|
| - loop.Quit();
|
| - });
|
| + base::Bind(&ExpectStringMap, base::Passed(&expected_map),
|
| + loop.QuitClosure()));
|
| loop.Run();
|
| }
|
| }
|
|
|