Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: runtime/vm/os_test.cc

Issue 12330139: Increase timeout jitter (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "platform/utils.h"
7 #include "vm/globals.h" 7 #include "vm/globals.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 #include "vm/unit_test.h" 9 #include "vm/unit_test.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 = 200; // Measured in milliseconds.
19 EXPECT_GE(delta, sleep_time - kAcceptableSleepWakeupJitter); 19 EXPECT_GE(delta, sleep_time - kAcceptableSleepWakeupJitter);
20 EXPECT_LE(delta, sleep_time + kAcceptableSleepWakeupJitter); 20 EXPECT_LE(delta, sleep_time + kAcceptableSleepWakeupJitter);
21 } 21 }
22 22
23 23
24 UNIT_TEST_CASE(SNPrint) { 24 UNIT_TEST_CASE(SNPrint) {
25 char buffer[256]; 25 char buffer[256];
26 int length; 26 int length;
27 length = OS::SNPrint(buffer, 10, "%s", "foo"); 27 length = OS::SNPrint(buffer, 10, "%s", "foo");
28 EXPECT_EQ(3, length); 28 EXPECT_EQ(3, length);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 EXPECT((reinterpret_cast<intptr_t>(p6) & 15) == 0); 72 EXPECT((reinterpret_cast<intptr_t>(p6) & 15) == 0);
73 OS::AlignedFree(p1); 73 OS::AlignedFree(p1);
74 OS::AlignedFree(p2); 74 OS::AlignedFree(p2);
75 OS::AlignedFree(p3); 75 OS::AlignedFree(p3);
76 OS::AlignedFree(p4); 76 OS::AlignedFree(p4);
77 OS::AlignedFree(p5); 77 OS::AlignedFree(p5);
78 OS::AlignedFree(p6); 78 OS::AlignedFree(p6);
79 } 79 }
80 80
81 } // namespace dart 81 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698