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

Side by Side Diff: mojo/system/waiter_unittest.cc

Issue 200353003: Mojo: Increase epsilon in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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 // NOTE(vtl): These tests are inherently flaky (e.g., if run on a heavily-loaded 5 // NOTE(vtl): These tests are inherently flaky (e.g., if run on a heavily-loaded
6 // system). Sorry. |kEpsilonMicros| may be increased to increase tolerance and 6 // system). Sorry. |kEpsilonMicros| may be increased to increase tolerance and
7 // reduce observed flakiness. 7 // reduce observed flakiness.
8 8
9 #include "mojo/system/waiter.h" 9 #include "mojo/system/waiter.h"
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/threading/platform_thread.h" // For |Sleep()|. 14 #include "base/threading/platform_thread.h" // For |Sleep()|.
15 #include "base/threading/simple_thread.h" 15 #include "base/threading/simple_thread.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "mojo/system/test_utils.h" 17 #include "mojo/system/test_utils.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace mojo { 20 namespace mojo {
21 namespace system { 21 namespace system {
22 namespace { 22 namespace {
23 23
24 const int64_t kMicrosPerMs = 1000; 24 const int64_t kMicrosPerMs = 1000;
25 const int64_t kEpsilonMicros = 15 * kMicrosPerMs; // 15 ms. 25 const int64_t kEpsilonMicros = 30 * kMicrosPerMs; // 15 ms.
26 const int64_t kPollTimeMicros = 10 * kMicrosPerMs; // 10 ms. 26 const int64_t kPollTimeMicros = 10 * kMicrosPerMs; // 10 ms.
27 27
28 class WaitingThread : public base::SimpleThread { 28 class WaitingThread : public base::SimpleThread {
29 public: 29 public:
30 explicit WaitingThread(MojoDeadline deadline) 30 explicit WaitingThread(MojoDeadline deadline)
31 : base::SimpleThread("waiting_thread"), 31 : base::SimpleThread("waiting_thread"),
32 deadline_(deadline), 32 deadline_(deadline),
33 done_(false), 33 done_(false),
34 result_(MOJO_RESULT_UNKNOWN), 34 result_(MOJO_RESULT_UNKNOWN),
35 elapsed_micros_(-1) { 35 elapsed_micros_(-1) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 thread.WaitUntilDone(&result, &elapsed_micros); 276 thread.WaitUntilDone(&result, &elapsed_micros);
277 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); 277 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
278 EXPECT_GT(elapsed_micros, (1-1) * kEpsilonMicros); 278 EXPECT_GT(elapsed_micros, (1-1) * kEpsilonMicros);
279 EXPECT_LT(elapsed_micros, (1+1) * kEpsilonMicros); 279 EXPECT_LT(elapsed_micros, (1+1) * kEpsilonMicros);
280 } 280 }
281 } 281 }
282 282
283 } // namespace 283 } // namespace
284 } // namespace system 284 } // namespace system
285 } // namespace mojo 285 } // namespace mojo
OLDNEW
« mojo/system/message_pipe_dispatcher_unittest.cc ('K') | « mojo/system/waiter_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698