| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "mojo/public/cpp/bindings/binding.h" | 7 #include "mojo/public/cpp/bindings/binding.h" |
| 8 #include "mojo/public/cpp/bindings/strong_binding.h" | 8 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 9 #include "mojo/public/cpp/environment/environment.h" | |
| 10 #include "mojo/public/cpp/test_support/test_utils.h" | 9 #include "mojo/public/cpp/test_support/test_utils.h" |
| 11 #include "mojo/public/cpp/utility/run_loop.h" | 10 #include "mojo/public/cpp/utility/run_loop.h" |
| 12 #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" | 11 #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 13 |
| 15 namespace mojo { | 14 namespace mojo { |
| 16 namespace test { | 15 namespace test { |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 const char kText1[] = "hello"; | 18 const char kText1[] = "hello"; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 Binding<sample::Factory> binding_; | 137 Binding<sample::Factory> binding_; |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 class HandlePassingTest : public testing::Test { | 140 class HandlePassingTest : public testing::Test { |
| 142 public: | 141 public: |
| 143 void TearDown() override { PumpMessages(); } | 142 void TearDown() override { PumpMessages(); } |
| 144 | 143 |
| 145 void PumpMessages() { loop_.RunUntilIdle(); } | 144 void PumpMessages() { loop_.RunUntilIdle(); } |
| 146 | 145 |
| 147 private: | 146 private: |
| 148 Environment env_; | |
| 149 RunLoop loop_; | 147 RunLoop loop_; |
| 150 }; | 148 }; |
| 151 | 149 |
| 152 struct DoStuffCallback { | 150 struct DoStuffCallback { |
| 153 DoStuffCallback(bool* got_response, std::string* got_text_reply) | 151 DoStuffCallback(bool* got_response, std::string* got_text_reply) |
| 154 : got_response(got_response), got_text_reply(got_text_reply) {} | 152 : got_response(got_response), got_text_reply(got_text_reply) {} |
| 155 | 153 |
| 156 void Run(sample::ResponsePtr response, const String& text_reply) const { | 154 void Run(sample::ResponsePtr response, const String& text_reply) const { |
| 157 *got_text_reply = text_reply; | 155 *got_text_reply = text_reply; |
| 158 | 156 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 344 |
| 347 PumpMessages(); // Yield for results. | 345 PumpMessages(); // Yield for results. |
| 348 | 346 |
| 349 EXPECT_EQ(std::string("object1"), name1); | 347 EXPECT_EQ(std::string("object1"), name1); |
| 350 EXPECT_EQ(std::string("object2"), name2); | 348 EXPECT_EQ(std::string("object2"), name2); |
| 351 } | 349 } |
| 352 | 350 |
| 353 } // namespace | 351 } // namespace |
| 354 } // namespace test | 352 } // namespace test |
| 355 } // namespace mojo | 353 } // namespace mojo |
| OLD | NEW |