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 #include "components/test_runner/mock_web_midi_accessor.h" | 5 #include "components/test_runner/mock_web_midi_accessor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/test_runner/test_interfaces.h" | 10 #include "components/test_runner/test_interfaces.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 client_->didAddOutputPort("MockOutputID", | 35 client_->didAddOutputPort("MockOutputID", |
36 "MockOutputManufacturer", | 36 "MockOutputManufacturer", |
37 "MockOutputName", | 37 "MockOutputName", |
38 "MockOutputVersion", | 38 "MockOutputVersion", |
39 state); | 39 state); |
40 interfaces_->GetDelegate()->PostTask(base::Bind( | 40 interfaces_->GetDelegate()->PostTask(base::Bind( |
41 &MockWebMIDIAccessor::ReportStartedSession, weak_factory_.GetWeakPtr(), | 41 &MockWebMIDIAccessor::ReportStartedSession, weak_factory_.GetWeakPtr(), |
42 interfaces_->GetTestRunner()->midiAccessorResult())); | 42 interfaces_->GetTestRunner()->midiAccessorResult())); |
43 } | 43 } |
44 | 44 |
45 void MockWebMIDIAccessor::ReportStartedSession(bool success) { | 45 void MockWebMIDIAccessor::ReportStartedSession(media::midi::Result result) { |
46 client_->didStartSession(success, "InvalidStateError", ""); | 46 client_->didStartSession(result); |
47 } | 47 } |
48 | 48 |
49 void MockWebMIDIAccessor::sendMIDIData(unsigned port_index, | 49 void MockWebMIDIAccessor::sendMIDIData(unsigned port_index, |
50 const unsigned char* data, | 50 const unsigned char* data, |
51 size_t length, | 51 size_t length, |
52 double timestamp) { | 52 double timestamp) { |
53 // Emulate a loopback device for testing. | 53 // Emulate a loopback device for testing. |
54 client_->didReceiveMIDIData(port_index, data, length, timestamp); | 54 client_->didReceiveMIDIData(port_index, data, length, timestamp); |
55 } | 55 } |
56 | 56 |
57 } // namespace test_runner | 57 } // namespace test_runner |
OLD | NEW |