1 // Copyright 2013 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.
5 #include "content/shell/renderer/test_runner/MockWebMIDIAccessor.h"
7 #include "content/shell/renderer/test_runner/TestInterfaces.h"
8 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
9 #include "content/shell/renderer/test_runner/WebTestRunner.h"
10 #include "content/shell/renderer/test_runner/test_runner.h"
11 #include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h"
13 using namespace blink
;
17 class DidStartSessionTask
: public WebTestRunner::WebMethodTask
<WebTestRunner::MockWebMIDIAccessor
> {
19 DidStartSessionTask(WebTestRunner::MockWebMIDIAccessor
* object
, blink::WebMIDIAccessorClient
* client
, bool result
)
20 : WebMethodTask
<WebTestRunner::MockWebMIDIAccessor
>(object
)
26 virtual void runIfValid() OVERRIDE
28 m_client
->didStartSession(m_result
);
32 blink::WebMIDIAccessorClient
* m_client
;
38 namespace WebTestRunner
{
40 MockWebMIDIAccessor::MockWebMIDIAccessor(blink::WebMIDIAccessorClient
* client
, TestInterfaces
* interfaces
)
42 , m_interfaces(interfaces
)
46 MockWebMIDIAccessor::~MockWebMIDIAccessor()
50 void MockWebMIDIAccessor::startSession()
52 // Add a mock input and output port.
53 m_client
->didAddInputPort("MockInputID", "MockInputManufacturer", "MockInputName", "MockInputVersion");
54 m_client
->didAddOutputPort("MockOutputID", "MockOutputManufacturer", "MockOutputName", "MockOutputVersion");
55 m_interfaces
->delegate()->postTask(new DidStartSessionTask(this, m_client
, m_interfaces
->testRunner()->midiAccessorResult()));
58 } // namespace WebTestRunner