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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
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/MockColorChooser.h"
6
7 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
8 #include "content/shell/renderer/test_runner/WebTestProxy.h"
9
10 using namespace blink;
11 using namespace std;
12
13 namespace WebTestRunner {
14
15 namespace {
16 class HostMethodTask : public WebMethodTask<MockColorChooser> {
17 public:
18 typedef void (MockColorChooser::*CallbackMethodType)();
19 HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
20 : WebMethodTask<MockColorChooser>(object)
21 , m_callback(callback)
22 { }
23
24 virtual void runIfValid() { (m_object->*m_callback)(); }
25
26 private:
27 CallbackMethodType m_callback;
28 };
29 }
30
31 MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client, WebTest Delegate* delegate, WebTestProxyBase* proxy)
32 : m_client(client)
33 , m_delegate(delegate)
34 , m_proxy(proxy)
35 {
36 m_proxy->didOpenChooser();
37 }
38
39 MockColorChooser::~MockColorChooser()
40 {
41 m_proxy->didCloseChooser();
42 }
43
44 void MockColorChooser::setSelectedColor(const blink::WebColor)
45 {
46 }
47
48 void MockColorChooser::endChooser()
49 {
50 m_delegate->postDelayedTask(new HostMethodTask(this, &MockColorChooser::invo keDidEndChooser), 0);
51 }
52
53 void MockColorChooser::invokeDidEndChooser()
54 {
55 m_client->didEndChooser();
56 }
57
58 }
OLDNEW
« 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