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) | |
329 // http://crbug.com/396393 | 328 // http://crbug.com/396393 |
330 #define MAYBE_BasicThreaded DISABLED_BasicThreaded | 329 TEST(SimpleDispatcherTest, DISABLED_BasicThreaded) { |
331 #else | |
332 #define MAYBE_BasicThreaded BasicThreaded | |
333 #endif | |
334 TEST(SimpleDispatcherTest, MAYBE_BasicThreaded) { | |
335 test::Stopwatch stopwatch; | 330 test::Stopwatch stopwatch; |
336 bool did_wait; | 331 bool did_wait; |
337 MojoResult result; | 332 MojoResult result; |
338 uint32_t context; | 333 uint32_t context; |
339 HandleSignalsState hss; | 334 HandleSignalsState hss; |
340 | 335 |
341 // Wait for readable (already readable). | 336 // Wait for readable (already readable). |
342 { | 337 { |
343 scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher()); | 338 scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher()); |
344 { | 339 { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // Since we closed before joining, we can't say much about what each thread | 595 // Since we closed before joining, we can't say much about what each thread |
601 // saw as the state. | 596 // saw as the state. |
602 } | 597 } |
603 } | 598 } |
604 | 599 |
605 // TODO(vtl): Stress test? | 600 // TODO(vtl): Stress test? |
606 | 601 |
607 } // namespace | 602 } // namespace |
608 } // namespace system | 603 } // namespace system |
609 } // namespace mojo | 604 } // namespace mojo |
OLD | NEW |