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

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

Issue 1426343002: EDK: Move mutex.*, cond_var.*, and thread_annotations.h to //mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: oops Created 5 years, 1 month 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/waiter.cc ('k') | mojo/edk/test/multiprocess_test_helper.h » ('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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to
7 // increase tolerance and reduce observed flakiness (though doing so reduces the 7 // increase tolerance and reduce observed flakiness (though doing so reduces the
8 // meaningfulness of the test). 8 // meaningfulness of the test).
9 9
10 #include "mojo/edk/system/waiter.h" 10 #include "mojo/edk/system/waiter.h"
11 11
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include "mojo/edk/system/mutex.h"
15 #include "mojo/edk/system/test/simple_test_thread.h" 14 #include "mojo/edk/system/test/simple_test_thread.h"
16 #include "mojo/edk/system/test/sleep.h" 15 #include "mojo/edk/system/test/sleep.h"
17 #include "mojo/edk/system/test/stopwatch.h" 16 #include "mojo/edk/system/test/stopwatch.h"
18 #include "mojo/edk/system/test/timeouts.h" 17 #include "mojo/edk/system/test/timeouts.h"
18 #include "mojo/edk/util/mutex.h"
19 #include "mojo/public/cpp/system/macros.h" 19 #include "mojo/public/cpp/system/macros.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 using mojo::util::Mutex;
23 using mojo::util::MutexLocker;
24
22 namespace mojo { 25 namespace mojo {
23 namespace system { 26 namespace system {
24 namespace { 27 namespace {
25 28
26 const unsigned kPollTimeMs = 10; 29 const unsigned kPollTimeMs = 10;
27 30
28 class WaitingThread : public test::SimpleTestThread { 31 class WaitingThread : public test::SimpleTestThread {
29 public: 32 public:
30 explicit WaitingThread(MojoDeadline deadline) 33 explicit WaitingThread(MojoDeadline deadline)
31 : deadline_(deadline), 34 : deadline_(deadline),
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); 293 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
291 EXPECT_EQ(7u, context); 294 EXPECT_EQ(7u, context);
292 EXPECT_GT(elapsed, (1 - 1) * test::EpsilonTimeout()); 295 EXPECT_GT(elapsed, (1 - 1) * test::EpsilonTimeout());
293 EXPECT_LT(elapsed, (1 + 1) * test::EpsilonTimeout()); 296 EXPECT_LT(elapsed, (1 + 1) * test::EpsilonTimeout());
294 } 297 }
295 } 298 }
296 299
297 } // namespace 300 } // namespace
298 } // namespace system 301 } // namespace system
299 } // namespace mojo 302 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/waiter.cc ('k') | mojo/edk/test/multiprocess_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698