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