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

Side by Side Diff: mojo/system/waiter_list_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_list.h" 9 #include "mojo/system/waiter_list.h"
10 10
11 #include "base/threading/platform_thread.h" // For |Sleep()|. 11 #include "base/threading/platform_thread.h" // For |Sleep()|.
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "mojo/system/waiter.h" 13 #include "mojo/system/waiter.h"
14 #include "mojo/system/waiter_test_utils.h" 14 #include "mojo/system/waiter_test_utils.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 namespace system { 18 namespace system {
19 namespace { 19 namespace {
20 20
21 const int64_t kMicrosPerMs = 1000; 21 const int64_t kMicrosPerMs = 1000;
22 const int64_t kEpsilonMicros = 15 * kMicrosPerMs; // 15 ms. 22 const int64_t kEpsilonMicros = 30 * kMicrosPerMs; // 15 ms.
23 23
24 TEST(WaiterListTest, BasicCancel) { 24 TEST(WaiterListTest, BasicCancel) {
25 MojoResult result; 25 MojoResult result;
26 26
27 // Cancel immediately after thread start. 27 // Cancel immediately after thread start.
28 { 28 {
29 WaiterList waiter_list; 29 WaiterList waiter_list;
30 test::SimpleWaiterThread thread(&result); 30 test::SimpleWaiterThread thread(&result);
31 waiter_list.AddWaiter(thread.waiter(), MOJO_WAIT_FLAG_READABLE, 0); 31 waiter_list.AddWaiter(thread.waiter(), MOJO_WAIT_FLAG_READABLE, 0);
32 thread.Start(); 32 thread.Start();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } // Join threads. 257 } // Join threads.
258 EXPECT_EQ(6, result1); 258 EXPECT_EQ(6, result1);
259 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result2); 259 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result2);
260 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result3); 260 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result3);
261 EXPECT_EQ(MOJO_RESULT_CANCELLED, result4); 261 EXPECT_EQ(MOJO_RESULT_CANCELLED, result4);
262 } 262 }
263 263
264 } // namespace 264 } // namespace
265 } // namespace system 265 } // namespace system
266 } // namespace mojo 266 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698