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/system/waiter.h" | 10 #include "mojo/system/waiter.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 base::PlatformThread::Sleep( | 56 base::PlatformThread::Sleep( |
57 base::TimeDelta::FromMicroseconds(kPollTimeMicros)); | 57 base::TimeDelta::FromMicroseconds(kPollTimeMicros)); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 Waiter* waiter() { return &waiter_; } | 61 Waiter* waiter() { return &waiter_; } |
62 | 62 |
63 private: | 63 private: |
64 virtual void Run() OVERRIDE { | 64 virtual void Run() override { |
65 test::Stopwatch stopwatch; | 65 test::Stopwatch stopwatch; |
66 MojoResult result; | 66 MojoResult result; |
67 uint32_t context = static_cast<uint32_t>(-1); | 67 uint32_t context = static_cast<uint32_t>(-1); |
68 base::TimeDelta elapsed; | 68 base::TimeDelta elapsed; |
69 | 69 |
70 stopwatch.Start(); | 70 stopwatch.Start(); |
71 result = waiter_.Wait(deadline_, &context); | 71 result = waiter_.Wait(deadline_, &context); |
72 elapsed = stopwatch.Elapsed(); | 72 elapsed = stopwatch.Elapsed(); |
73 | 73 |
74 { | 74 { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); | 293 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); |
294 EXPECT_EQ(7u, context); | 294 EXPECT_EQ(7u, context); |
295 EXPECT_GT(elapsed, (1 - 1) * test::EpsilonTimeout()); | 295 EXPECT_GT(elapsed, (1 - 1) * test::EpsilonTimeout()); |
296 EXPECT_LT(elapsed, (1 + 1) * test::EpsilonTimeout()); | 296 EXPECT_LT(elapsed, (1 + 1) * test::EpsilonTimeout()); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 } // namespace | 300 } // namespace |
301 } // namespace system | 301 } // namespace system |
302 } // namespace mojo | 302 } // namespace mojo |
OLD | NEW |