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

Unified Diff: content/shell/renderer/test_runner/MockWebMIDIAccessor.cpp

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/renderer/test_runner/MockWebMIDIAccessor.cpp
diff --git a/content/shell/renderer/test_runner/MockWebMIDIAccessor.cpp b/content/shell/renderer/test_runner/MockWebMIDIAccessor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..21a4501a238efea2896b4f4cd056505c696a1af4
--- /dev/null
+++ b/content/shell/renderer/test_runner/MockWebMIDIAccessor.cpp
@@ -0,0 +1,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/TestRunner.h"
+#include "content/shell/renderer/test_runner/WebTestDelegate.h"
+#include "content/shell/renderer/test_runner/WebTestRunner.h"
+#include "third_party/WebKit/public/platform/WebMIDIAccessorClient.h"
+
+using namespace blink;
+
+namespace {
+
+class DidStartSessionTask : public WebTestRunner::WebMethodTask<WebTestRunner::MockWebMIDIAccessor> {
+public:
+ DidStartSessionTask(WebTestRunner::MockWebMIDIAccessor* object, blink::WebMIDIAccessorClient* client, bool result)
+ : WebMethodTask<WebTestRunner::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
+
+namespace WebTestRunner {
+
+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 WebTestRunner

Powered by Google App Engine
This is Rietveld 408576698