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
;
17 class HostMethodTask
: public WebMethodTask
<MockColorChooser
> {
19 typedef void (MockColorChooser::*CallbackMethodType
)();
20 HostMethodTask(MockColorChooser
* object
, CallbackMethodType callback
)
21 : WebMethodTask
<MockColorChooser
>(object
)
22 , m_callback(callback
)
25 virtual void runIfValid() OVERRIDE
{ (m_object
->*m_callback
)(); }
28 CallbackMethodType m_callback
;
32 MockColorChooser::MockColorChooser(blink::WebColorChooserClient
* client
, WebTestDelegate
* delegate
, WebTestProxyBase
* proxy
)
34 , m_delegate(delegate
)
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