[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / content / shell / renderer / test_runner / MockColorChooser.cpp
blobc9321fc6d73e5af6d7cd1e2dbf518731447c95a3
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.
5 #include "content/shell/renderer/test_runner/MockColorChooser.h"
7 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
8 #include "content/shell/renderer/test_runner/WebTestProxy.h"
10 using namespace WebTestRunner;
11 using namespace blink;
12 using namespace std;
14 namespace content {
16 namespace {
17 class HostMethodTask : public WebMethodTask<MockColorChooser> {
18 public:
19 typedef void (MockColorChooser::*CallbackMethodType)();
20 HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
21 : WebMethodTask<MockColorChooser>(object)
22 , m_callback(callback)
23 { }
25 virtual void runIfValid() OVERRIDE { (m_object->*m_callback)(); }
27 private:
28 CallbackMethodType m_callback;
32 MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client, WebTestDelegate* delegate, WebTestProxyBase* proxy)
33 : m_client(client)
34 , m_delegate(delegate)
35 , m_proxy(proxy)
37 m_proxy->didOpenChooser();
40 MockColorChooser::~MockColorChooser()
42 m_proxy->didCloseChooser();
45 void MockColorChooser::setSelectedColor(const blink::WebColor)
49 void MockColorChooser::endChooser()
51 m_delegate->postDelayedTask(new HostMethodTask(this, &MockColorChooser::invokeDidEndChooser), 0);
54 void MockColorChooser::invokeDidEndChooser()
56 m_client->didEndChooser();
59 } // namespace content