OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "content/shell/renderer/test_runner/MockWebMIDIAccessor.h" | 5 #include "content/shell/renderer/test_runner/MockWebMIDIAccessor.h" |
6 | 6 |
7 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 7 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
9 #include "content/shell/renderer/test_runner/WebTestRunner.h" | 9 #include "content/shell/renderer/test_runner/WebTestRunner.h" |
10 #include "content/shell/renderer/test_runner/test_runner.h" | 10 #include "content/shell/renderer/test_runner/test_runner.h" |
11 #include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h" | 11 #include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h" |
12 | 12 |
13 using namespace blink; | 13 using namespace blink; |
| 14 using WebTestRunner::TestInterfaces; |
| 15 |
| 16 namespace content { |
14 | 17 |
15 namespace { | 18 namespace { |
16 | 19 |
17 class DidStartSessionTask : public WebTestRunner::WebMethodTask<WebTestRunner::M
ockWebMIDIAccessor> { | 20 class DidStartSessionTask : public WebTestRunner::WebMethodTask<MockWebMIDIAcces
sor> { |
18 public: | 21 public: |
19 DidStartSessionTask(WebTestRunner::MockWebMIDIAccessor* object, blink::WebMI
DIAccessorClient* client, bool result) | 22 DidStartSessionTask(MockWebMIDIAccessor* object, blink::WebMIDIAccessorClien
t* client, bool result) |
20 : WebMethodTask<WebTestRunner::MockWebMIDIAccessor>(object) | 23 : WebMethodTask<MockWebMIDIAccessor>(object) |
21 , m_client(client) | 24 , m_client(client) |
22 , m_result(result) | 25 , m_result(result) |
23 { | 26 { |
24 } | 27 } |
25 | 28 |
26 virtual void runIfValid() OVERRIDE | 29 virtual void runIfValid() OVERRIDE |
27 { | 30 { |
28 m_client->didStartSession(m_result); | 31 m_client->didStartSession(m_result); |
29 } | 32 } |
30 | 33 |
31 private: | 34 private: |
32 blink::WebMIDIAccessorClient* m_client; | 35 blink::WebMIDIAccessorClient* m_client; |
33 bool m_result; | 36 bool m_result; |
34 }; | 37 }; |
35 | 38 |
36 } // namespace | 39 } // namespace |
37 | |
38 namespace WebTestRunner { | |
39 | 40 |
40 MockWebMIDIAccessor::MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, T
estInterfaces* interfaces) | 41 MockWebMIDIAccessor::MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, T
estInterfaces* interfaces) |
41 : m_client(client) | 42 : m_client(client) |
42 , m_interfaces(interfaces) | 43 , m_interfaces(interfaces) |
43 { | 44 { |
44 } | 45 } |
45 | 46 |
46 MockWebMIDIAccessor::~MockWebMIDIAccessor() | 47 MockWebMIDIAccessor::~MockWebMIDIAccessor() |
47 { | 48 { |
48 } | 49 } |
49 | 50 |
50 void MockWebMIDIAccessor::startSession() | 51 void MockWebMIDIAccessor::startSession() |
51 { | 52 { |
52 // Add a mock input and output port. | 53 // Add a mock input and output port. |
53 m_client->didAddInputPort("MockInputID", "MockInputManufacturer", "MockInput
Name", "MockInputVersion"); | 54 m_client->didAddInputPort("MockInputID", "MockInputManufacturer", "MockInput
Name", "MockInputVersion"); |
54 m_client->didAddOutputPort("MockOutputID", "MockOutputManufacturer", "MockOu
tputName", "MockOutputVersion"); | 55 m_client->didAddOutputPort("MockOutputID", "MockOutputManufacturer", "MockOu
tputName", "MockOutputVersion"); |
55 m_interfaces->delegate()->postTask(new DidStartSessionTask(this, m_client, m
_interfaces->testRunner()->midiAccessorResult())); | 56 m_interfaces->delegate()->postTask(new DidStartSessionTask(this, m_client, m
_interfaces->testRunner()->midiAccessorResult())); |
56 } | 57 } |
57 | 58 |
58 } // namespace WebTestRunner | 59 } // namespace content |
OLD | NEW |