| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MOCK_SIMPLE_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MOCK_SIMPLE_DISPATCHER_H_ |
| 6 #define MOJO_EDK_SYSTEM_MOCK_SIMPLE_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_MOCK_SIMPLE_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "mojo/edk/system/handle_signals_state.h" | 8 #include "mojo/edk/system/handle_signals_state.h" |
| 9 #include "mojo/edk/system/simple_dispatcher.h" | 9 #include "mojo/edk/system/simple_dispatcher.h" |
| 10 #include "mojo/edk/util/thread_annotations.h" | 10 #include "mojo/edk/util/thread_annotations.h" |
| 11 #include "mojo/public/c/system/handle.h" | 11 #include "mojo/public/c/system/handle.h" |
| 12 #include "mojo/public/cpp/system/macros.h" | 12 #include "mojo/public/cpp/system/macros.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace system { | 15 namespace system { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 // This is a "simple" dispatcher to be used in tests. The state of its signals | 18 // This is a "simple" dispatcher to be used in tests. The state of its signals |
| 19 // can be set "manually", if desired. | 19 // can be set "manually", if desired. |
| 20 class MockSimpleDispatcher final : public SimpleDispatcher { | 20 class MockSimpleDispatcher final : public SimpleDispatcher { |
| 21 public: | 21 public: |
| 22 // Note: Use |MakeRefCounted<MockSimpleDispatcher>()|. | 22 // Note: Use |MakeRefCounted<MockSimpleDispatcher>()|. |
| 23 | 23 |
| 24 Type GetType() const override; | 24 Type GetType() const override; |
| 25 bool SupportsEntrypointClass(EntrypointClass entrypoint_class) const override; |
| 25 | 26 |
| 26 void SetSatisfiedSignals(MojoHandleSignals new_satisfied_signals); | 27 void SetSatisfiedSignals(MojoHandleSignals new_satisfied_signals); |
| 27 void SetSatisfiableSignals(MojoHandleSignals new_satisfiable_signals); | 28 void SetSatisfiableSignals(MojoHandleSignals new_satisfiable_signals); |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 FRIEND_MAKE_REF_COUNTED(MockSimpleDispatcher); | 31 FRIEND_MAKE_REF_COUNTED(MockSimpleDispatcher); |
| 31 | 32 |
| 32 MockSimpleDispatcher( | 33 MockSimpleDispatcher( |
| 33 MojoHandleSignals satisfied_signals = MOJO_HANDLE_SIGNAL_NONE, | 34 MojoHandleSignals satisfied_signals = MOJO_HANDLE_SIGNAL_NONE, |
| 34 MojoHandleSignals satisfiable_signals = MOJO_HANDLE_SIGNAL_READABLE | | 35 MojoHandleSignals satisfiable_signals = MOJO_HANDLE_SIGNAL_READABLE | |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 HandleSignalsState state_ MOJO_GUARDED_BY(mutex()); | 46 HandleSignalsState state_ MOJO_GUARDED_BY(mutex()); |
| 46 | 47 |
| 47 MOJO_DISALLOW_COPY_AND_ASSIGN(MockSimpleDispatcher); | 48 MOJO_DISALLOW_COPY_AND_ASSIGN(MockSimpleDispatcher); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace test | 51 } // namespace test |
| 51 } // namespace system | 52 } // namespace system |
| 52 } // namespace mojo | 53 } // namespace mojo |
| 53 | 54 |
| 54 #endif // MOJO_EDK_SYSTEM_MOCK_SIMPLE_DISPATCHER_H_ | 55 #endif // MOJO_EDK_SYSTEM_MOCK_SIMPLE_DISPATCHER_H_ |
| OLD | NEW |