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_CORE_TEST_BASE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
6 #define MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ | 6 #define MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 unsigned GetWriteMessageCallCount() const; | 52 unsigned GetWriteMessageCallCount() const; |
53 unsigned GetReadMessageCallCount() const; | 53 unsigned GetReadMessageCallCount() const; |
54 unsigned GetWriteDataCallCount() const; | 54 unsigned GetWriteDataCallCount() const; |
55 unsigned GetBeginWriteDataCallCount() const; | 55 unsigned GetBeginWriteDataCallCount() const; |
56 unsigned GetEndWriteDataCallCount() const; | 56 unsigned GetEndWriteDataCallCount() const; |
57 unsigned GetReadDataCallCount() const; | 57 unsigned GetReadDataCallCount() const; |
58 unsigned GetBeginReadDataCallCount() const; | 58 unsigned GetBeginReadDataCallCount() const; |
59 unsigned GetEndReadDataCallCount() const; | 59 unsigned GetEndReadDataCallCount() const; |
60 unsigned GetAddAwakableCallCount() const; | 60 unsigned GetAddAwakableCallCount() const; |
61 unsigned GetRemoveAwakableCallCount() const; | 61 unsigned GetRemoveAwakableCallCount() const; |
62 unsigned GetCancelAllAwakablesCallCount() const; | |
63 | 62 |
64 size_t GetAddedAwakableSize() const; | 63 size_t GetAddedAwakableSize() const; |
65 Awakable* GetAddedAwakableAt(unsigned i) const; | 64 Awakable* GetAddedAwakableAt(unsigned i) const; |
66 | 65 |
67 // For use by |MockDispatcher|: | 66 // For use by |MockDispatcher|: |
68 void IncrementCtorCallCount(); | 67 void IncrementCtorCallCount(); |
69 void IncrementDtorCallCount(); | 68 void IncrementDtorCallCount(); |
70 void IncrementCloseCallCount(); | 69 void IncrementCloseCallCount(); |
71 void IncrementWriteMessageCallCount(); | 70 void IncrementWriteMessageCallCount(); |
72 void IncrementReadMessageCallCount(); | 71 void IncrementReadMessageCallCount(); |
73 void IncrementWriteDataCallCount(); | 72 void IncrementWriteDataCallCount(); |
74 void IncrementBeginWriteDataCallCount(); | 73 void IncrementBeginWriteDataCallCount(); |
75 void IncrementEndWriteDataCallCount(); | 74 void IncrementEndWriteDataCallCount(); |
76 void IncrementReadDataCallCount(); | 75 void IncrementReadDataCallCount(); |
77 void IncrementBeginReadDataCallCount(); | 76 void IncrementBeginReadDataCallCount(); |
78 void IncrementEndReadDataCallCount(); | 77 void IncrementEndReadDataCallCount(); |
79 void IncrementAddAwakableCallCount(); | 78 void IncrementAddAwakableCallCount(); |
80 void IncrementRemoveAwakableCallCount(); | 79 void IncrementRemoveAwakableCallCount(); |
81 void IncrementCancelAllAwakablesCallCount(); | |
82 | 80 |
83 void AllowAddAwakable(bool alllow); | 81 void AllowAddAwakable(bool alllow); |
84 bool IsAddAwakableAllowed() const; | 82 bool IsAddAwakableAllowed() const; |
85 void AwakableWasAdded(Awakable*); | 83 void AwakableWasAdded(Awakable*); |
86 | 84 |
87 private: | 85 private: |
88 mutable base::Lock lock_; // Protects the following members. | 86 mutable base::Lock lock_; // Protects the following members. |
89 unsigned ctor_call_count_; | 87 unsigned ctor_call_count_; |
90 unsigned dtor_call_count_; | 88 unsigned dtor_call_count_; |
91 unsigned close_call_count_; | 89 unsigned close_call_count_; |
92 unsigned write_message_call_count_; | 90 unsigned write_message_call_count_; |
93 unsigned read_message_call_count_; | 91 unsigned read_message_call_count_; |
94 unsigned write_data_call_count_; | 92 unsigned write_data_call_count_; |
95 unsigned begin_write_data_call_count_; | 93 unsigned begin_write_data_call_count_; |
96 unsigned end_write_data_call_count_; | 94 unsigned end_write_data_call_count_; |
97 unsigned read_data_call_count_; | 95 unsigned read_data_call_count_; |
98 unsigned begin_read_data_call_count_; | 96 unsigned begin_read_data_call_count_; |
99 unsigned end_read_data_call_count_; | 97 unsigned end_read_data_call_count_; |
100 unsigned add_awakable_call_count_; | 98 unsigned add_awakable_call_count_; |
101 unsigned remove_awakable_call_count_; | 99 unsigned remove_awakable_call_count_; |
102 unsigned cancel_all_awakables_call_count_; | |
103 | 100 |
104 bool add_awakable_allowed_; | 101 bool add_awakable_allowed_; |
105 std::vector<Awakable*> added_awakables_; | 102 std::vector<Awakable*> added_awakables_; |
106 | 103 |
107 MOJO_DISALLOW_COPY_AND_ASSIGN(CoreTestBase_MockHandleInfo); | 104 MOJO_DISALLOW_COPY_AND_ASSIGN(CoreTestBase_MockHandleInfo); |
108 }; | 105 }; |
109 | 106 |
110 } // namespace test | 107 } // namespace test |
111 } // namespace edk | 108 } // namespace edk |
112 } // namespace mojo | 109 } // namespace mojo |
113 | 110 |
114 #endif // MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ | 111 #endif // MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_ |
OLD | NEW |