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

Side by Side Diff: mojo/system/core_test_base.h

Issue 621153003: Move mojo edk into mojo/edk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix checkdeps Created 6 years, 2 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/system/core.cc ('k') | mojo/system/core_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SYSTEM_CORE_TEST_BASE_H_
6 #define MOJO_SYSTEM_CORE_TEST_BASE_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "base/synchronization/lock.h"
11 #include "mojo/public/c/system/types.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace mojo {
15 namespace system {
16
17 class Core;
18
19 namespace test {
20
21 class CoreTestBase_MockHandleInfo;
22
23 class CoreTestBase : public testing::Test {
24 public:
25 typedef CoreTestBase_MockHandleInfo MockHandleInfo;
26
27 CoreTestBase();
28 virtual ~CoreTestBase();
29
30 virtual void SetUp() override;
31 virtual void TearDown() override;
32
33 protected:
34 // |info| must remain alive until the returned handle is closed.
35 MojoHandle CreateMockHandle(MockHandleInfo* info);
36
37 Core* core() { return core_; }
38
39 private:
40 Core* core_;
41
42 DISALLOW_COPY_AND_ASSIGN(CoreTestBase);
43 };
44
45 class CoreTestBase_MockHandleInfo {
46 public:
47 CoreTestBase_MockHandleInfo();
48 ~CoreTestBase_MockHandleInfo();
49
50 unsigned GetCtorCallCount() const;
51 unsigned GetDtorCallCount() const;
52 unsigned GetCloseCallCount() const;
53 unsigned GetWriteMessageCallCount() const;
54 unsigned GetReadMessageCallCount() const;
55 unsigned GetWriteDataCallCount() const;
56 unsigned GetBeginWriteDataCallCount() const;
57 unsigned GetEndWriteDataCallCount() const;
58 unsigned GetReadDataCallCount() const;
59 unsigned GetBeginReadDataCallCount() const;
60 unsigned GetEndReadDataCallCount() const;
61 unsigned GetAddWaiterCallCount() const;
62 unsigned GetRemoveWaiterCallCount() const;
63 unsigned GetCancelAllWaitersCallCount() const;
64
65 // For use by |MockDispatcher|:
66 void IncrementCtorCallCount();
67 void IncrementDtorCallCount();
68 void IncrementCloseCallCount();
69 void IncrementWriteMessageCallCount();
70 void IncrementReadMessageCallCount();
71 void IncrementWriteDataCallCount();
72 void IncrementBeginWriteDataCallCount();
73 void IncrementEndWriteDataCallCount();
74 void IncrementReadDataCallCount();
75 void IncrementBeginReadDataCallCount();
76 void IncrementEndReadDataCallCount();
77 void IncrementAddWaiterCallCount();
78 void IncrementRemoveWaiterCallCount();
79 void IncrementCancelAllWaitersCallCount();
80
81 private:
82 mutable base::Lock lock_; // Protects the following members.
83 unsigned ctor_call_count_;
84 unsigned dtor_call_count_;
85 unsigned close_call_count_;
86 unsigned write_message_call_count_;
87 unsigned read_message_call_count_;
88 unsigned write_data_call_count_;
89 unsigned begin_write_data_call_count_;
90 unsigned end_write_data_call_count_;
91 unsigned read_data_call_count_;
92 unsigned begin_read_data_call_count_;
93 unsigned end_read_data_call_count_;
94 unsigned add_waiter_call_count_;
95 unsigned remove_waiter_call_count_;
96 unsigned cancel_all_waiters_call_count_;
97
98 DISALLOW_COPY_AND_ASSIGN(CoreTestBase_MockHandleInfo);
99 };
100
101 } // namespace test
102 } // namespace system
103 } // namespace mojo
104
105 #endif // MOJO_SYSTEM_CORE_TEST_BASE_H_
OLDNEW
« no previous file with comments | « mojo/system/core.cc ('k') | mojo/system/core_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698