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/utility/run_loop.h" | 5 #include "mojo/public/cpp/utility/run_loop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "mojo/public/cpp/system/core.h" | 9 #include "mojo/public/cpp/system/core.h" |
10 #include "mojo/public/cpp/test_support/test_utils.h" | 10 #include "mojo/public/cpp/test_support/test_utils.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 TEST_F(RunLoopTest, Current) { | 184 TEST_F(RunLoopTest, Current) { |
185 EXPECT_TRUE(RunLoop::current() == NULL); | 185 EXPECT_TRUE(RunLoop::current() == NULL); |
186 { | 186 { |
187 RunLoop run_loop; | 187 RunLoop run_loop; |
188 EXPECT_EQ(&run_loop, RunLoop::current()); | 188 EXPECT_EQ(&run_loop, RunLoop::current()); |
189 } | 189 } |
190 EXPECT_TRUE(RunLoop::current() == NULL); | 190 EXPECT_TRUE(RunLoop::current() == NULL); |
191 } | 191 } |
192 | 192 |
193 | |
194 class NestingRunLoopHandler : public TestRunLoopHandler { | 193 class NestingRunLoopHandler : public TestRunLoopHandler { |
195 public: | 194 public: |
196 static const size_t kDepthLimit; | 195 static const size_t kDepthLimit; |
197 static const char kSignalMagic; | 196 static const char kSignalMagic; |
198 | 197 |
199 NestingRunLoopHandler() | 198 NestingRunLoopHandler() |
200 : run_loop_(NULL), | 199 : run_loop_(NULL), |
201 pipe_(NULL), | 200 pipe_(NULL), |
202 depth_(0), | 201 depth_(0), |
203 reached_depth_limit_(false) {} | 202 reached_depth_limit_(false) {} |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 279 |
281 EXPECT_TRUE(handler.reached_depth_limit()); | 280 EXPECT_TRUE(handler.reached_depth_limit()); |
282 // Got MOJO_RESULT_DEADLINE_EXCEEDED once then removed from the | 281 // Got MOJO_RESULT_DEADLINE_EXCEEDED once then removed from the |
283 // RunLoop's handler list. | 282 // RunLoop's handler list. |
284 EXPECT_EQ(handler.error_count(), 1); | 283 EXPECT_EQ(handler.error_count(), 1); |
285 EXPECT_EQ(handler.last_error_result(), MOJO_RESULT_DEADLINE_EXCEEDED); | 284 EXPECT_EQ(handler.last_error_result(), MOJO_RESULT_DEADLINE_EXCEEDED); |
286 } | 285 } |
287 | 286 |
288 } // namespace | 287 } // namespace |
289 } // namespace mojo | 288 } // namespace mojo |
OLD | NEW |