| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_ | |
| 6 #define COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "media/midi/midi_service.mojom.h" | |
| 13 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 class WebMIDIAccessorClient; | |
| 17 } | |
| 18 | |
| 19 namespace test_runner { | |
| 20 | |
| 21 class TestInterfaces; | |
| 22 | |
| 23 class MockWebMIDIAccessor : public blink::WebMIDIAccessor { | |
| 24 public: | |
| 25 MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, | |
| 26 TestInterfaces* interfaces); | |
| 27 ~MockWebMIDIAccessor() override; | |
| 28 | |
| 29 // blink::WebMIDIAccessor implementation. | |
| 30 void startSession() override; | |
| 31 void sendMIDIData(unsigned port_index, | |
| 32 const unsigned char* data, | |
| 33 size_t length, | |
| 34 double timestamp) override; | |
| 35 | |
| 36 private: | |
| 37 void addInputPort(midi::mojom::PortState state); | |
| 38 void addOutputPort(midi::mojom::PortState state); | |
| 39 void reportStartedSession(midi::mojom::Result result); | |
| 40 | |
| 41 blink::WebMIDIAccessorClient* client_; | |
| 42 TestInterfaces* interfaces_; | |
| 43 unsigned next_input_port_index_; | |
| 44 unsigned next_output_port_index_; | |
| 45 | |
| 46 base::WeakPtrFactory<MockWebMIDIAccessor> weak_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(MockWebMIDIAccessor); | |
| 49 }; | |
| 50 | |
| 51 } // namespace test_runner | |
| 52 | |
| 53 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_ | |
| OLD | NEW |