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

Side by Side Diff: mojo/edk/system/test_utils.cc

Issue 1352913002: Remove Windows support from the EDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « mojo/edk/system/simple_dispatcher_unittest.cc ('k') | mojo/edk/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "mojo/edk/system/test_utils.h" 5 #include "mojo/edk/system/test_utils.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <limits> 10 #include <limits>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
14 #include "base/threading/platform_thread.h" // For |Sleep()|. 14 #include "base/threading/platform_thread.h" // For |Sleep()|.
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 namespace system { 18 namespace system {
19 namespace test { 19 namespace test {
20 20
21 MojoDeadline DeadlineFromMilliseconds(unsigned milliseconds) { 21 MojoDeadline DeadlineFromMilliseconds(unsigned milliseconds) {
22 return static_cast<MojoDeadline>(milliseconds) * 1000; 22 return static_cast<MojoDeadline>(milliseconds) * 1000;
23 } 23 }
24 24
25 MojoDeadline EpsilonDeadline() { 25 MojoDeadline EpsilonDeadline() {
26 // Originally, our epsilon timeout was 10 ms, which was mostly fine but flaky on
27 // some Windows bots. I don't recall ever seeing flakes on other bots. At 30 ms
28 // tests seem reliable on Windows bots, but not at 25 ms. We'd like this timeout
29 // to be as small as possible (see the description in the .h file).
30 //
31 // Currently, |tiny_timeout()| is usually 100 ms (possibly scaled under ASAN, 26 // Currently, |tiny_timeout()| is usually 100 ms (possibly scaled under ASAN,
32 // etc.). Based on this, set it to (usually be) 30 ms on Windows and 20 ms 27 // etc.). Based on this, set it to (usually be) 30 ms on Android and 20 ms
33 // elsewhere. 28 // elsewhere. (We'd like this to be as small as possible, without making things
34 #if defined(OS_WIN) || defined(OS_ANDROID) 29 // flaky)
30 #if defined(OS_ANDROID)
35 return (TinyDeadline() * 3) / 10; 31 return (TinyDeadline() * 3) / 10;
36 #else 32 #else
37 return (TinyDeadline() * 2) / 10; 33 return (TinyDeadline() * 2) / 10;
38 #endif 34 #endif
39 } 35 }
40 36
41 MojoDeadline TinyDeadline() { 37 MojoDeadline TinyDeadline() {
42 return static_cast<MojoDeadline>( 38 return static_cast<MojoDeadline>(
43 TestTimeouts::tiny_timeout().InMicroseconds()); 39 TestTimeouts::tiny_timeout().InMicroseconds());
44 } 40 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 MojoDeadline Stopwatch::Elapsed() { 81 MojoDeadline Stopwatch::Elapsed() {
86 int64_t result = platform_support_.GetTimeTicksNow() - start_time_; 82 int64_t result = platform_support_.GetTimeTicksNow() - start_time_;
87 // |DCHECK_GE|, not |CHECK_GE|, since this may be performance-important. 83 // |DCHECK_GE|, not |CHECK_GE|, since this may be performance-important.
88 DCHECK_GE(result, 0); 84 DCHECK_GE(result, 0);
89 return static_cast<MojoDeadline>(result); 85 return static_cast<MojoDeadline>(result);
90 } 86 }
91 87
92 } // namespace test 88 } // namespace test
93 } // namespace system 89 } // namespace system
94 } // namespace mojo 90 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/simple_dispatcher_unittest.cc ('k') | mojo/edk/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698