1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/renderer/test_runner/MockWebMIDIAccessor.h"
#include "content/shell/renderer/test_runner/TestInterfaces.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/WebTestRunner.h"
#include "content/shell/renderer/test_runner/test_runner.h"
#include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h"
using namespace blink;
namespace content {
namespace {
class DidStartSessionTask : public WebMethodTask<MockWebMIDIAccessor> {
public:
DidStartSessionTask(MockWebMIDIAccessor* object, blink::WebMIDIAccessorClient* client, bool result)
: WebMethodTask<MockWebMIDIAccessor>(object)
, m_client(client)
, m_result(result)
{
}
virtual void runIfValid() OVERRIDE
{
m_client->didStartSession(m_result);
}
private:
blink::WebMIDIAccessorClient* m_client;
bool m_result;
};
} // namespace
MockWebMIDIAccessor::MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, TestInterfaces* interfaces)
: m_client(client)
, m_interfaces(interfaces)
{
}
MockWebMIDIAccessor::~MockWebMIDIAccessor()
{
}
void MockWebMIDIAccessor::startSession()
{
// Add a mock input and output port.
m_client->didAddInputPort("MockInputID", "MockInputManufacturer", "MockInputName", "MockInputVersion");
m_client->didAddOutputPort("MockOutputID", "MockOutputManufacturer", "MockOutputName", "MockOutputVersion");
m_interfaces->delegate()->postTask(new DidStartSessionTask(this, m_client, m_interfaces->testRunner()->midiAccessorResult()));
}
} // namespace content
|