OLD | NEW |
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 #ifndef MOJO_EDK_SYSTEM_TEST_UTILS_H_ | 5 #ifndef MOJO_EDK_SYSTEM_TEST_UTILS_H_ |
6 #define MOJO_EDK_SYSTEM_TEST_UTILS_H_ | 6 #define MOJO_EDK_SYSTEM_TEST_UTILS_H_ |
7 | 7 |
8 #include "base/test/test_io_thread.h" | |
9 #include "base/time/time.h" | 8 #include "base/time/time.h" |
10 #include "mojo/edk/test/scoped_ipc_support.h" | |
11 #include "mojo/public/c/system/types.h" | 9 #include "mojo/public/c/system/types.h" |
12 #include "mojo/public/cpp/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
14 | 12 |
15 namespace mojo { | 13 namespace mojo { |
16 namespace edk { | 14 namespace edk { |
17 namespace test { | 15 namespace test { |
18 | 16 |
19 MojoDeadline DeadlineFromMilliseconds(unsigned milliseconds); | 17 MojoDeadline DeadlineFromMilliseconds(unsigned milliseconds); |
20 | 18 |
(...skipping 26 matching lines...) Expand all Loading... |
47 // Returns the amount of time elapsed since the last call to |Start()| (in | 45 // Returns the amount of time elapsed since the last call to |Start()| (in |
48 // microseconds). | 46 // microseconds). |
49 MojoDeadline Elapsed(); | 47 MojoDeadline Elapsed(); |
50 | 48 |
51 private: | 49 private: |
52 base::TimeTicks start_time_; | 50 base::TimeTicks start_time_; |
53 | 51 |
54 MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch); | 52 MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch); |
55 }; | 53 }; |
56 | 54 |
57 // A base class which initializes and shuts down the necessary objects so that | |
58 // Mojo system calls can be made. | |
59 class MojoSystemTest : public testing::Test { | |
60 public: | |
61 MojoSystemTest(); | |
62 ~MojoSystemTest() override; | |
63 | |
64 base::TestIOThread* test_io_thread() { return &test_io_thread_; } | |
65 | |
66 private: | |
67 base::MessageLoop message_loop_; | |
68 base::TestIOThread test_io_thread_; | |
69 test::ScopedIPCSupport ipc_support_; | |
70 | |
71 MOJO_DISALLOW_COPY_AND_ASSIGN(MojoSystemTest); | |
72 }; | |
73 | |
74 } // namespace test | 55 } // namespace test |
75 } // namespace edk | 56 } // namespace edk |
76 } // namespace mojo | 57 } // namespace mojo |
77 | 58 |
78 #endif // MOJO_EDK_SYSTEM_TEST_UTILS_H_ | 59 #endif // MOJO_EDK_SYSTEM_TEST_UTILS_H_ |
OLD | NEW |