| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | 11 #include "mojo/public/cpp/bindings/binding_set.h" |
| 12 #include "mojo/public/cpp/bindings/interface_request.h" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
| 13 #include "mojo/public/cpp/bindings/tests/rect_blink.h" | 13 #include "mojo/public/cpp/bindings/tests/rect_blink.h" |
| 14 #include "mojo/public/cpp/bindings/tests/rect_chromium.h" | 14 #include "mojo/public/cpp/bindings/tests/rect_chromium.h" |
| 15 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl.h" | 15 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl.h" |
| 16 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h" | 16 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h" |
| 17 #include "mojo/public/cpp/bindings/tests/variant_test_util.h" | 17 #include "mojo/public/cpp/bindings/tests/variant_test_util.h" |
| 18 #include "mojo/public/cpp/system/wait.h" |
| 18 #include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" | 19 #include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" |
| 19 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-blink.h" | 20 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-blink.h" |
| 20 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom.h" | 21 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 namespace mojo { | 24 namespace mojo { |
| 24 namespace test { | 25 namespace test { |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 template <typename T> | 28 template <typename T> |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 385 |
| 385 ASSERT_TRUE(received.is_valid()); | 386 ASSERT_TRUE(received.is_valid()); |
| 386 | 387 |
| 387 // Verify that the message pipe handle is correctly passed. | 388 // Verify that the message pipe handle is correctly passed. |
| 388 const char kHello[] = "hello"; | 389 const char kHello[] = "hello"; |
| 389 const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); | 390 const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); |
| 390 EXPECT_EQ(MOJO_RESULT_OK, | 391 EXPECT_EQ(MOJO_RESULT_OK, |
| 391 WriteMessageRaw(mp.handle1.get(), kHello, kHelloSize, nullptr, 0, | 392 WriteMessageRaw(mp.handle1.get(), kHello, kHelloSize, nullptr, 0, |
| 392 MOJO_WRITE_MESSAGE_FLAG_NONE)); | 393 MOJO_WRITE_MESSAGE_FLAG_NONE)); |
| 393 | 394 |
| 394 EXPECT_EQ(MOJO_RESULT_OK, Wait(received.get(), MOJO_HANDLE_SIGNAL_READABLE, | 395 EXPECT_EQ(MOJO_RESULT_OK, Wait(received.get(), MOJO_HANDLE_SIGNAL_READABLE)); |
| 395 MOJO_DEADLINE_INDEFINITE, nullptr)); | |
| 396 | 396 |
| 397 char buffer[10] = {0}; | 397 char buffer[10] = {0}; |
| 398 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 398 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
| 399 EXPECT_EQ(MOJO_RESULT_OK, | 399 EXPECT_EQ(MOJO_RESULT_OK, |
| 400 ReadMessageRaw(received.get(), buffer, &buffer_size, nullptr, | 400 ReadMessageRaw(received.get(), buffer, &buffer_size, nullptr, |
| 401 nullptr, MOJO_READ_MESSAGE_FLAG_NONE)); | 401 nullptr, MOJO_READ_MESSAGE_FLAG_NONE)); |
| 402 EXPECT_EQ(kHelloSize, buffer_size); | 402 EXPECT_EQ(kHelloSize, buffer_size); |
| 403 EXPECT_STREQ(kHello, buffer); | 403 EXPECT_STREQ(kHello, buffer); |
| 404 } | 404 } |
| 405 | 405 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 quit_closure.Run(); | 544 quit_closure.Run(); |
| 545 | 545 |
| 546 }, | 546 }, |
| 547 loop.QuitClosure())); | 547 loop.QuitClosure())); |
| 548 loop.Run(); | 548 loop.Run(); |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 } // namespace test | 552 } // namespace test |
| 553 } // namespace mojo | 553 } // namespace mojo |
| OLD | NEW |