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

Side by Side Diff: content/shell/renderer/test_runner/MockColorChooser.cpp

Issue 404373002: test_runner: Migrate MockColorChooser to Chromium C++ style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
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/web_test_proxy.h"
9
10 using namespace blink;
11
12 namespace content {
13
14 namespace {
15 class HostMethodTask : public WebMethodTask<MockColorChooser> {
16 public:
17 typedef void (MockColorChooser::*CallbackMethodType)();
18 HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
19 : WebMethodTask<MockColorChooser>(object)
20 , m_callback(callback)
21 { }
22
23 virtual void runIfValid() OVERRIDE { (m_object->*m_callback)(); }
24
25 private:
26 CallbackMethodType m_callback;
27 };
28 }
29
30 MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client, WebTest Delegate* delegate, WebTestProxyBase* proxy)
31 : m_client(client)
32 , m_delegate(delegate)
33 , m_proxy(proxy)
34 {
35 m_proxy->DidOpenChooser();
36 }
37
38 MockColorChooser::~MockColorChooser()
39 {
40 m_proxy->DidCloseChooser();
41 }
42
43 void MockColorChooser::setSelectedColor(const blink::WebColor)
44 {
45 }
46
47 void MockColorChooser::endChooser()
48 {
49 m_delegate->postDelayedTask(new HostMethodTask(this, &MockColorChooser::invo keDidEndChooser), 0);
50 }
51
52 void MockColorChooser::invokeDidEndChooser()
53 {
54 m_client->didEndChooser();
55 }
56
57 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/MockColorChooser.h ('k') | content/shell/renderer/test_runner/mock_color_chooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698