Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: content/shell/renderer/test_runner/mock_web_midi_accessor.cc

Issue 419823002: test_runner: Migrate MockWebMIDIAccessor to Chromium C++ style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/renderer/test_runner/mock_web_midi_accessor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
34 DISALLOW_COPY_AND_ASSIGN(DidStartSessionTask);
35 };
36
37 } // namespace
38
39 MockWebMIDIAccessor::MockWebMIDIAccessor(blink::WebMIDIAccessorClient* client,
40 TestInterfaces* interfaces)
41 : client_(client), interfaces_(interfaces) {
42 }
43
44 MockWebMIDIAccessor::~MockWebMIDIAccessor() {
45 }
46
47 void MockWebMIDIAccessor::startSession() {
48 // Add a mock input and output port.
49 client_->didAddInputPort("MockInputID",
50 "MockInputManufacturer",
51 "MockInputName",
52 "MockInputVersion");
53 client_->didAddOutputPort("MockOutputID",
54 "MockOutputManufacturer",
55 "MockOutputName",
56 "MockOutputVersion");
57 interfaces_->delegate()->postTask(new DidStartSessionTask(
58 this, client_, interfaces_->testRunner()->midiAccessorResult()));
59 }
60
61 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/mock_web_midi_accessor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698