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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a | 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a |
6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to | 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to |
7 // increase tolerance and reduce observed flakiness (though doing so reduces the | 7 // increase tolerance and reduce observed flakiness (though doing so reduces the |
8 // meaningfulness of the test). | 8 // meaningfulness of the test). |
9 | 9 |
10 #include "mojo/edk/system/simple_dispatcher.h" | 10 #include "mojo/edk/system/simple_dispatcher.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr)); | 318 d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr)); |
319 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); | 319 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); |
320 stopwatch.Start(); | 320 stopwatch.Start(); |
321 EXPECT_EQ(MOJO_RESULT_CANCELLED, | 321 EXPECT_EQ(MOJO_RESULT_CANCELLED, |
322 w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), &context)); | 322 w.Wait(2 * test::EpsilonTimeout().InMicroseconds(), &context)); |
323 EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout()); | 323 EXPECT_LT(stopwatch.Elapsed(), test::EpsilonTimeout()); |
324 EXPECT_EQ(4u, context); | 324 EXPECT_EQ(4u, context); |
325 // Don't need to remove waiters from closed dispatchers. | 325 // Don't need to remove waiters from closed dispatchers. |
326 } | 326 } |
327 | 327 |
| 328 #if defined(OS_WIN) |
328 // http://crbug.com/396393 | 329 // http://crbug.com/396393 |
329 TEST(SimpleDispatcherTest, DISABLED_BasicThreaded) { | 330 #define MAYBE_BasicThreaded DISABLED_BasicThreaded |
| 331 #else |
| 332 #define MAYBE_BasicThreaded BasicThreaded |
| 333 #endif |
| 334 TEST(SimpleDispatcherTest, MAYBE_BasicThreaded) { |
330 test::Stopwatch stopwatch; | 335 test::Stopwatch stopwatch; |
331 bool did_wait; | 336 bool did_wait; |
332 MojoResult result; | 337 MojoResult result; |
333 uint32_t context; | 338 uint32_t context; |
334 HandleSignalsState hss; | 339 HandleSignalsState hss; |
335 | 340 |
336 // Wait for readable (already readable). | 341 // Wait for readable (already readable). |
337 { | 342 { |
338 scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher()); | 343 scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher()); |
339 { | 344 { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 // Since we closed before joining, we can't say much about what each thread | 600 // Since we closed before joining, we can't say much about what each thread |
596 // saw as the state. | 601 // saw as the state. |
597 } | 602 } |
598 } | 603 } |
599 | 604 |
600 // TODO(vtl): Stress test? | 605 // TODO(vtl): Stress test? |
601 | 606 |
602 } // namespace | 607 } // namespace |
603 } // namespace system | 608 } // namespace system |
604 } // namespace mojo | 609 } // namespace mojo |
OLD | NEW |