Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: mojo/public/cpp/bindings/tests/synchronous_interface_ptr_unittest.cc

Issue 1997473005: Remove requirement that mojo::Environment be instantiated. (Closed) Base URL: https://github.com/domokit/mojo.git@work797_no_utility_tls
Patch Set: SetDefaultAsyncWaiter Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/lib/synchronous_connector.h" 5 #include "mojo/public/cpp/bindings/lib/synchronous_connector.h"
6 6
7 #include <thread> 7 #include <thread>
8 #include <utility> 8 #include <utility>
9 9
10 #include "mojo/public/cpp/bindings/binding.h" 10 #include "mojo/public/cpp/bindings/binding.h"
11 #include "mojo/public/cpp/bindings/interface_request.h" 11 #include "mojo/public/cpp/bindings/interface_request.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
13 #include "mojo/public/cpp/bindings/synchronous_interface_ptr.h" 13 #include "mojo/public/cpp/bindings/synchronous_interface_ptr.h"
14 #include "mojo/public/cpp/environment/environment.h"
15 #include "mojo/public/cpp/utility/run_loop.h" 14 #include "mojo/public/cpp/utility/run_loop.h"
16 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom-sync.h" 15 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom-sync.h"
17 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h" 16 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
18 #include "mojo/public/interfaces/bindings/tests/scoping.mojom-sync.h" 17 #include "mojo/public/interfaces/bindings/tests/scoping.mojom-sync.h"
19 #include "mojo/public/interfaces/bindings/tests/scoping.mojom.h" 18 #include "mojo/public/interfaces/bindings/tests/scoping.mojom.h"
20 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
21 20
22 namespace mojo { 21 namespace mojo {
23 namespace test { 22 namespace test {
24 namespace { 23 namespace {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // own RunLoop! 61 // own RunLoop!
63 static void StartMathCalculator(InterfaceRequest<math::Calculator> server) { 62 static void StartMathCalculator(InterfaceRequest<math::Calculator> server) {
64 // Runloop is thread-local, and this is what the MathCalculatorImpl will end 63 // Runloop is thread-local, and this is what the MathCalculatorImpl will end
65 // up using. 64 // up using.
66 RunLoop loop; 65 RunLoop loop;
67 MathCalculatorImpl calc_impl(std::move(server)); 66 MathCalculatorImpl calc_impl(std::move(server));
68 loop.Run(); 67 loop.Run();
69 } 68 }
70 69
71 private: 70 private:
72 Environment env_;
73 RunLoop loop_; 71 RunLoop loop_;
74 }; 72 };
75 73
76 TEST_F(SynchronousInterfacePtrTest, IsBound) { 74 TEST_F(SynchronousInterfacePtrTest, IsBound) {
77 SynchronousInterfacePtr<math::Calculator> calc; 75 SynchronousInterfacePtr<math::Calculator> calc;
78 EXPECT_FALSE(calc.is_bound()); 76 EXPECT_FALSE(calc.is_bound());
79 EXPECT_FALSE(calc); 77 EXPECT_FALSE(calc);
80 78
81 MathCalculatorImpl calc_impl(GetSynchronousProxy(&calc)); 79 MathCalculatorImpl calc_impl(GetSynchronousProxy(&calc));
82 EXPECT_TRUE(calc.is_bound()); 80 EXPECT_TRUE(calc.is_bound());
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // While B & C have fallen out of scope, the service-side endpoints of the 216 // While B & C have fallen out of scope, the service-side endpoints of the
219 // pipes will remain until they are flushed. 217 // pipes will remain until they are flushed.
220 EXPECT_FALSE(a_impl.d_called()); 218 EXPECT_FALSE(a_impl.d_called());
221 PumpMessages(); 219 PumpMessages();
222 EXPECT_TRUE(a_impl.d_called()); 220 EXPECT_TRUE(a_impl.d_called());
223 } 221 }
224 222
225 } // namespace 223 } // namespace
226 } // namespace test 224 } // namespace test
227 } // namespace mojo 225 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/synchronous_connector_unittest.cc ('k') | mojo/public/cpp/bindings/tests/union_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698