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

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

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/mock_color_chooser.h"
6
7 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
8 #include "content/shell/renderer/test_runner/web_test_proxy.h"
9
10 namespace content {
11
12 namespace {
13 class HostMethodTask : public WebMethodTask<MockColorChooser> {
14 public:
15 typedef void (MockColorChooser::*CallbackMethodType)();
16 HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
17 : WebMethodTask<MockColorChooser>(object),
18 callback_(callback) {}
19
20 virtual void runIfValid() OVERRIDE { (m_object->*callback_)(); }
21
22 private:
23 CallbackMethodType callback_;
24 };
25
26 } // namespace
27
28 MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client,
29 WebTestDelegate* delegate,
30 WebTestProxyBase* proxy)
31 : client_(client),
32 delegate_(delegate),
33 proxy_(proxy) {
34 proxy_->DidOpenChooser();
35 }
36
37 MockColorChooser::~MockColorChooser() {
38 proxy_->DidCloseChooser();
39 }
40
41 void MockColorChooser::setSelectedColor(const blink::WebColor color) {}
42
43 void MockColorChooser::endChooser() {
44 delegate_->postDelayedTask(new HostMethodTask(this, &MockColorChooser::InvokeD idEndChooser), 0);
45 }
46
47 void MockColorChooser::InvokeDidEndChooser() {
48 client_->didEndChooser();
49 }
50
51 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/mock_color_chooser.h ('k') | content/shell/renderer/test_runner/web_test_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698