Index: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc |
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc |
index aff625116863453f96ab36e88f1ed968336703bb..cf898973a672f6aa82f71632174120b13e3b407a 100644 |
--- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc |
+++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc |
@@ -59,6 +59,10 @@ class MathCalculatorUI { |
: calculator_(std::move(calculator)), |
output_(0.0) {} |
+ bool WaitForIncomingResponse() { |
+ return calculator_.WaitForIncomingResponse(); |
+ } |
+ |
bool encountered_error() const { return calculator_.encountered_error(); } |
void set_connection_error_handler(const base::Closure& closure) { |
calculator_.set_connection_error_handler(closure); |
@@ -191,9 +195,9 @@ class IntegerAccessorImpl : public sample::IntegerAccessor { |
class InterfacePtrTest : public testing::Test { |
public: |
InterfacePtrTest() {} |
- ~InterfacePtrTest() override { base::RunLoop().RunUntilIdle(); } |
+ ~InterfacePtrTest() override { loop_.RunUntilIdle(); } |
- void PumpMessages() { base::RunLoop().RunUntilIdle(); } |
+ void PumpMessages() { loop_.RunUntilIdle(); } |
private: |
base::MessageLoop loop_; |
@@ -247,18 +251,16 @@ TEST_F(InterfacePtrTest, EndToEnd_Synchronous) { |
EXPECT_EQ(0.0, calculator_ui.GetOutput()); |
- base::RunLoop run_loop; |
- calculator_ui.Add(2.0, run_loop.QuitClosure()); |
+ calculator_ui.Add(2.0, base::Closure()); |
EXPECT_EQ(0.0, calculator_ui.GetOutput()); |
calc_impl.WaitForIncomingMethodCall(); |
- run_loop.Run(); |
+ calculator_ui.WaitForIncomingResponse(); |
EXPECT_EQ(2.0, calculator_ui.GetOutput()); |
- base::RunLoop run_loop2; |
- calculator_ui.Multiply(5.0, run_loop2.QuitClosure()); |
+ calculator_ui.Multiply(5.0, base::Closure()); |
EXPECT_EQ(2.0, calculator_ui.GetOutput()); |
calc_impl.WaitForIncomingMethodCall(); |
- run_loop2.Run(); |
+ calculator_ui.WaitForIncomingResponse(); |
EXPECT_EQ(10.0, calculator_ui.GetOutput()); |
} |