| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/public/cpp/bindings/binding.h" | 5 #include "mojo/public/cpp/bindings/binding.h" |
| 6 #include "mojo/public/cpp/environment/environment.h" | |
| 7 #include "mojo/public/cpp/test_support/test_utils.h" | 6 #include "mojo/public/cpp/test_support/test_utils.h" |
| 8 #include "mojo/public/cpp/utility/run_loop.h" | 7 #include "mojo/public/cpp/utility/run_loop.h" |
| 9 #include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h" | 8 #include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h" |
| 10 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" | 9 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 namespace mojo { | 12 namespace mojo { |
| 14 namespace test { | 13 namespace test { |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 std::string text_; | 82 std::string text_; |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 class RequestResponseTest : public testing::Test { | 85 class RequestResponseTest : public testing::Test { |
| 87 public: | 86 public: |
| 88 ~RequestResponseTest() override { loop_.RunUntilIdle(); } | 87 ~RequestResponseTest() override { loop_.RunUntilIdle(); } |
| 89 | 88 |
| 90 void PumpMessages() { loop_.RunUntilIdle(); } | 89 void PumpMessages() { loop_.RunUntilIdle(); } |
| 91 | 90 |
| 92 private: | 91 private: |
| 93 Environment env_; | |
| 94 RunLoop loop_; | 92 RunLoop loop_; |
| 95 }; | 93 }; |
| 96 | 94 |
| 97 TEST_F(RequestResponseTest, EchoString) { | 95 TEST_F(RequestResponseTest, EchoString) { |
| 98 sample::ProviderPtr provider; | 96 sample::ProviderPtr provider; |
| 99 ProviderImpl provider_impl(GetProxy(&provider)); | 97 ProviderImpl provider_impl(GetProxy(&provider)); |
| 100 | 98 |
| 101 std::string buf; | 99 std::string buf; |
| 102 provider->EchoString(String::From("hello"), StringRecorder(&buf)); | 100 provider->EchoString(String::From("hello"), StringRecorder(&buf)); |
| 103 | 101 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 provider->EchoEnum(sample::Enum::VALUE, EnumRecorder(&value)); | 141 provider->EchoEnum(sample::Enum::VALUE, EnumRecorder(&value)); |
| 144 | 142 |
| 145 PumpMessages(); | 143 PumpMessages(); |
| 146 | 144 |
| 147 EXPECT_EQ(sample::Enum::VALUE, value); | 145 EXPECT_EQ(sample::Enum::VALUE, value); |
| 148 } | 146 } |
| 149 | 147 |
| 150 } // namespace | 148 } // namespace |
| 151 } // namespace test | 149 } // namespace test |
| 152 } // namespace mojo | 150 } // namespace mojo |
| OLD | NEW |