Bug 1688354 [wpt PR 27298] - Treat 'rem' as an absolute unit for font size, a=testonly
[gecko.git] / dom / midi / TestMIDIPlatformService.h
blob984afce032dac7a593899a64010cd89d891e3068
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_TestMIDIPlatformService_h
8 #define mozilla_dom_TestMIDIPlatformService_h
10 #include "mozilla/dom/MIDIPlatformService.h"
11 #include "mozilla/dom/MIDITypes.h"
13 class nsIThread;
15 namespace mozilla {
16 namespace dom {
18 class MIDIPortInterface;
20 /**
21 * Platform service implementation used for mochitests. Emulates what a real
22 * platform service should look like, including using an internal IO thread for
23 * message IO.
26 class TestMIDIPlatformService : public MIDIPlatformService {
27 public:
28 TestMIDIPlatformService();
29 virtual void Init() override;
30 virtual void Open(MIDIPortParent* aPort) override;
31 virtual void Stop() override;
32 virtual void ScheduleSend(const nsAString& aPort) override;
33 virtual void ScheduleClose(MIDIPortParent* aPort) override;
34 // MIDI Service simulation function. Can take specially formed sysex messages
35 // in order to trigger device connection events and state changes,
36 // interrupting messages for high priority sysex sends, etc...
37 void ProcessMessages(const nsAString& aPort);
39 private:
40 virtual ~TestMIDIPlatformService();
41 // Convenience object for sending runnables to the background thread. All
42 // runnables are pushed to the background thread, and check for existence of a
43 // manager object on the thread before running.
44 nsCOMPtr<nsIThread> mBackgroundThread;
45 // Port that takes test control messages
46 MIDIPortInfo mControlInputPort;
47 // Port that returns test status messages
48 MIDIPortInfo mControlOutputPort;
49 // Used for testing input connection/disconnection
50 MIDIPortInfo mStateTestInputPort;
51 // Used for testing output connection/disconnection
52 MIDIPortInfo mStateTestOutputPort;
53 // Used for testing open() call failures
54 MIDIPortInfo mAlwaysClosedTestOutputPort;
55 // IO Simulation thread. Runs all instances of ProcessMessages().
56 nsCOMPtr<nsIThread> mClientThread;
57 // True if server has been brought up already.
58 bool mIsInitialized;
61 } // namespace dom
62 } // namespace mozilla
64 #endif // mozilla_dom_TestMIDIPlatformService_h