| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "platform/utils.h" |
| 6 #include "vm/globals.h" | 7 #include "vm/globals.h" |
| 7 #include "vm/os.h" | 8 #include "vm/os.h" |
| 8 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
| 9 #include "vm/utils.h" | |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 UNIT_TEST_CASE(Sleep) { | 13 UNIT_TEST_CASE(Sleep) { |
| 14 int64_t start_time = OS::GetCurrentTimeMillis(); | 14 int64_t start_time = OS::GetCurrentTimeMillis(); |
| 15 int64_t sleep_time = 702; | 15 int64_t sleep_time = 702; |
| 16 OS::Sleep(sleep_time); | 16 OS::Sleep(sleep_time); |
| 17 int64_t delta = OS::GetCurrentTimeMillis() - start_time; | 17 int64_t delta = OS::GetCurrentTimeMillis() - start_time; |
| 18 const int kAcceptableSleepWakeupJitter = 100; // Measured in milliseconds. | 18 const int kAcceptableSleepWakeupJitter = 100; // Measured in milliseconds. |
| 19 EXPECT_GE(delta, sleep_time - kAcceptableSleepWakeupJitter); | 19 EXPECT_GE(delta, sleep_time - kAcceptableSleepWakeupJitter); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 UNIT_TEST_CASE(OsFuncs) { | 41 UNIT_TEST_CASE(OsFuncs) { |
| 42 EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment())); | 42 EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment())); |
| 43 EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment())); | 43 EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment())); |
| 44 int procs = OS::NumberOfAvailableProcessors(); | 44 int procs = OS::NumberOfAvailableProcessors(); |
| 45 EXPECT_LE(1, procs); | 45 EXPECT_LE(1, procs); |
| 46 EXPECT_LT(0U, OS::GetStackSizeLimit()); | 46 EXPECT_LT(0U, OS::GetStackSizeLimit()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace dart | 49 } // namespace dart |
| OLD | NEW |