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

Unified Diff: content/shell/renderer/test_runner/MockColorChooser.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/MockColorChooser.cpp
diff --git a/content/shell/renderer/test_runner/MockColorChooser.cpp b/content/shell/renderer/test_runner/MockColorChooser.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7b88a5a274e562dd1a1e11cf81188a9c5aab0535
--- /dev/null
+++ b/content/shell/renderer/test_runner/MockColorChooser.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/MockColorChooser.h"
+
+#include "content/shell/renderer/test_runner/WebTestDelegate.h"
+#include "content/shell/renderer/test_runner/WebTestProxy.h"
+
+using namespace blink;
+using namespace std;
+
+namespace WebTestRunner {
+
+namespace {
+class HostMethodTask : public WebMethodTask<MockColorChooser> {
+public:
+ typedef void (MockColorChooser::*CallbackMethodType)();
+ HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
+ : WebMethodTask<MockColorChooser>(object)
+ , m_callback(callback)
+ { }
+
+ virtual void runIfValid() { (m_object->*m_callback)(); }
+
+private:
+ CallbackMethodType m_callback;
+};
+}
+
+MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client, WebTestDelegate* delegate, WebTestProxyBase* proxy)
+ : m_client(client)
+ , m_delegate(delegate)
+ , m_proxy(proxy)
+{
+ m_proxy->didOpenChooser();
+}
+
+MockColorChooser::~MockColorChooser()
+{
+ m_proxy->didCloseChooser();
+}
+
+void MockColorChooser::setSelectedColor(const blink::WebColor)
+{
+}
+
+void MockColorChooser::endChooser()
+{
+ m_delegate->postDelayedTask(new HostMethodTask(this, &MockColorChooser::invokeDidEndChooser), 0);
+}
+
+void MockColorChooser::invokeDidEndChooser()
+{
+ m_client->didEndChooser();
+}
+
+}
« no previous file with comments | « content/shell/renderer/test_runner/MockColorChooser.h ('k') | content/shell/renderer/test_runner/MockConstraints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698