| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void RecordEnum(sample::Enum* storage, | 78 void RecordEnum(sample::Enum* storage, |
| 79 const base::Closure& closure, | 79 const base::Closure& closure, |
| 80 sample::Enum value) { | 80 sample::Enum value) { |
| 81 *storage = value; | 81 *storage = value; |
| 82 closure.Run(); | 82 closure.Run(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 class RequestResponseTest : public testing::Test { | 85 class RequestResponseTest : public testing::Test { |
| 86 public: | 86 public: |
| 87 RequestResponseTest() {} | 87 RequestResponseTest() {} |
| 88 ~RequestResponseTest() override { loop_.RunUntilIdle(); } | 88 ~RequestResponseTest() override { base::RunLoop().RunUntilIdle(); } |
| 89 | 89 |
| 90 void PumpMessages() { loop_.RunUntilIdle(); } | 90 void PumpMessages() { base::RunLoop().RunUntilIdle(); } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 base::MessageLoop loop_; | 93 base::MessageLoop loop_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 TEST_F(RequestResponseTest, EchoString) { | 96 TEST_F(RequestResponseTest, EchoString) { |
| 97 sample::ProviderPtr provider; | 97 sample::ProviderPtr provider; |
| 98 ProviderImpl provider_impl(GetProxy(&provider)); | 98 ProviderImpl provider_impl(GetProxy(&provider)); |
| 99 | 99 |
| 100 std::string buf; | 100 std::string buf; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 provider->EchoEnum(sample::Enum::VALUE, | 149 provider->EchoEnum(sample::Enum::VALUE, |
| 150 base::Bind(&RecordEnum, &value, run_loop.QuitClosure())); | 150 base::Bind(&RecordEnum, &value, run_loop.QuitClosure())); |
| 151 run_loop.Run(); | 151 run_loop.Run(); |
| 152 | 152 |
| 153 EXPECT_EQ(sample::Enum::VALUE, value); | 153 EXPECT_EQ(sample::Enum::VALUE, value); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace | 156 } // namespace |
| 157 } // namespace test | 157 } // namespace test |
| 158 } // namespace mojo | 158 } // namespace mojo |
| OLD | NEW |