| 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 "components/test_runner/web_task.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" | 12 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 class WebMIDIAccessorClient; | 15 class WebMIDIAccessorClient; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace test_runner { | 18 namespace test_runner { |
| 19 | 19 |
| 20 class TestInterfaces; | 20 class TestInterfaces; |
| 21 | 21 |
| 22 class MockWebMIDIAccessor : public blink::WebMIDIAccessor { | 22 class MockWebMIDIAccessor : public blink::WebMIDIAccessor { |
| 23 public: | 23 public: |
| 24 explicit MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, | 24 explicit MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, |
| 25 TestInterfaces* interfaces); | 25 TestInterfaces* interfaces); |
| 26 ~MockWebMIDIAccessor() override; | 26 ~MockWebMIDIAccessor() override; |
| 27 | 27 |
| 28 // blink::WebMIDIAccessor implementation. | 28 // blink::WebMIDIAccessor implementation. |
| 29 void startSession() override; | 29 void startSession() override; |
| 30 void sendMIDIData(unsigned port_index, | 30 void sendMIDIData(unsigned port_index, |
| 31 const unsigned char* data, | 31 const unsigned char* data, |
| 32 size_t length, | 32 size_t length, |
| 33 double timestamp) override; | 33 double timestamp) override; |
| 34 | 34 |
| 35 // WebTask related methods | 35 private: |
| 36 WebTaskList* mutable_task_list() { return &task_list_; } | 36 void ReportStartedSession(bool success); |
| 37 | 37 |
| 38 private: | |
| 39 blink::WebMIDIAccessorClient* client_; | 38 blink::WebMIDIAccessorClient* client_; |
| 40 WebTaskList task_list_; | |
| 41 TestInterfaces* interfaces_; | 39 TestInterfaces* interfaces_; |
| 42 | 40 |
| 41 base::WeakPtrFactory<MockWebMIDIAccessor> weak_factory_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(MockWebMIDIAccessor); | 43 DISALLOW_COPY_AND_ASSIGN(MockWebMIDIAccessor); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace test_runner | 46 } // namespace test_runner |
| 47 | 47 |
| 48 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_ | 48 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_MIDI_ACCESSOR_H_ |
| OLD | NEW |