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/edk/system/waiter.h" |
11 | 11 |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/threading/platform_thread.h" // For |Sleep()|. | 16 #include "base/threading/platform_thread.h" // For |Sleep()|. |
17 #include "base/threading/simple_thread.h" | 17 #include "base/threading/simple_thread.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "mojo/system/test_utils.h" | 19 #include "mojo/edk/system/test_utils.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 namespace system { | 23 namespace system { |
24 namespace { | 24 namespace { |
25 | 25 |
26 const int64_t kMicrosPerMs = 1000; | 26 const int64_t kMicrosPerMs = 1000; |
27 const int64_t kPollTimeMicros = 10 * kMicrosPerMs; // 10 ms. | 27 const int64_t kPollTimeMicros = 10 * kMicrosPerMs; // 10 ms. |
28 | 28 |
29 class WaitingThread : public base::SimpleThread { | 29 class WaitingThread : public base::SimpleThread { |
(...skipping 263 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 |