Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: components/test_runner/mock_web_midi_accessor.h

Issue 2487113002: Web MIDI: fix a regression of r430234 (Closed)
Patch Set: fix a bug that was discussed offline Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/midi/midi_service.mojom.h"
13 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" 13 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h"
14 14
15 namespace blink { 15 namespace blink {
16 class WebMIDIAccessorClient; 16 class WebMIDIAccessorClient;
17 } 17 }
18 18
19 namespace test_runner { 19 namespace test_runner {
20 20
21 class TestInterfaces; 21 class TestInterfaces;
22 22
23 class MockWebMIDIAccessor : public blink::WebMIDIAccessor { 23 class MockWebMIDIAccessor : public blink::WebMIDIAccessor {
24 public: 24 public:
25 explicit MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, 25 MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client,
26 TestInterfaces* interfaces); 26 TestInterfaces* interfaces);
27 ~MockWebMIDIAccessor() override; 27 ~MockWebMIDIAccessor() override;
28 28
29 // blink::WebMIDIAccessor implementation. 29 // blink::WebMIDIAccessor implementation.
30 void startSession() override; 30 void startSession() override;
31 void sendMIDIData(unsigned port_index, 31 void sendMIDIData(unsigned port_index,
32 const unsigned char* data, 32 const unsigned char* data,
33 size_t length, 33 size_t length,
34 double timestamp) override; 34 double timestamp) override;
35 35
36 private: 36 private:
37 void ReportStartedSession(midi::mojom::Result result); 37 void addInputPort(midi::mojom::PortState state);
38 void addOutputPort(midi::mojom::PortState state);
39 void reportStartedSession(midi::mojom::Result result);
38 40
39 blink::WebMIDIAccessorClient* client_; 41 blink::WebMIDIAccessorClient* client_;
40 TestInterfaces* interfaces_; 42 TestInterfaces* interfaces_;
43 unsigned next_input_port_index_;
44 unsigned next_output_port_index_;
41 45
42 base::WeakPtrFactory<MockWebMIDIAccessor> weak_factory_; 46 base::WeakPtrFactory<MockWebMIDIAccessor> weak_factory_;
43 47
44 DISALLOW_COPY_AND_ASSIGN(MockWebMIDIAccessor); 48 DISALLOW_COPY_AND_ASSIGN(MockWebMIDIAccessor);
45 }; 49 };
46 50
47 } // namespace test_runner 51 } // namespace test_runner
48 52
49 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_ 53 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_
OLDNEW
« no previous file with comments | « no previous file | components/test_runner/mock_web_midi_accessor.cc » ('j') | components/test_runner/mock_web_midi_accessor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698