OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "content/shell/renderer/test_runner/mock_web_midi_accessor.h" | |
6 | |
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/test_runner.h" | |
10 #include "content/shell/renderer/test_runner/web_test_runner.h" | |
11 #include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h" | |
12 | |
13 namespace content { | |
14 | |
15 namespace { | |
16 | |
17 class DidStartSessionTask : public WebMethodTask<MockWebMIDIAccessor> { | |
18 public: | |
19 DidStartSessionTask(MockWebMIDIAccessor* object, | |
20 blink::WebMIDIAccessorClient* client, | |
21 bool result) | |
22 : WebMethodTask<MockWebMIDIAccessor>(object), | |
23 client_(client), | |
24 result_(result) {} | |
25 | |
26 virtual void runIfValid() OVERRIDE { | |
27 client_->didStartSession(result_, "InvalidStateError", ""); | |
28 } | |
29 | |
30 private: | |
31 blink::WebMIDIAccessorClient* client_; | |
32 bool result_; | |
33 }; | |
jochen (gone - plz use gerrit)
2014/07/28 09:22:28
nit. DISALLOW_COPY_AND_ASSIGN(DidStartSessionTask)
Abhishek
2014/07/28 10:32:37
Done.
| |
34 | |
35 } // namespace | |
36 | |
37 MockWebMIDIAccessor::MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client, | |
38 TestInterfaces* interfaces) | |
39 : client_(client), interfaces_(interfaces) { | |
40 } | |
41 | |
42 MockWebMIDIAccessor::~MockWebMIDIAccessor() { | |
43 } | |
44 | |
45 void MockWebMIDIAccessor::startSession() { | |
46 // Add a mock input and output port. | |
47 client_->didAddInputPort("MockInputID", | |
48 "MockInputManufacturer", | |
49 "MockInputName", | |
50 "MockInputVersion"); | |
51 client_->didAddOutputPort("MockOutputID", | |
52 "MockOutputManufacturer", | |
53 "MockOutputName", | |
54 "MockOutputVersion"); | |
55 interfaces_->delegate()->postTask(new DidStartSessionTask( | |
56 this, client_, interfaces_->testRunner()->midiAccessorResult())); | |
57 } | |
58 | |
59 } // namespace content | |
OLD | NEW |