test_runner: Migrate MockColorChooser to Chromium C++ style.

Changes:
1) Run clang-format through source and header files.
2) Rename data member variables to use unix_hacker_ style.
3) Rename methods to use CamelCase style.
4) Rename file name to mock_color_chooser.

BUG=331299

Review URL: https://codereview.chromium.org/404373002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284689 0039d316-1c4b-4281-b951-d872f2087c98
parent 184799df
......@@ -172,8 +172,6 @@
'shell/renderer/shell_render_process_observer.h',
'shell/renderer/shell_render_view_observer.cc',
'shell/renderer/shell_render_view_observer.h',
'shell/renderer/test_runner/MockColorChooser.cpp',
'shell/renderer/test_runner/MockColorChooser.h',
'shell/renderer/test_runner/MockSpellCheck.cpp',
'shell/renderer/test_runner/MockSpellCheck.h',
'shell/renderer/test_runner/MockWebMIDIAccessor.cpp',
......@@ -203,6 +201,8 @@
'shell/renderer/test_runner/event_sender.h',
'shell/renderer/test_runner/gamepad_controller.cc',
'shell/renderer/test_runner/gamepad_controller.h',
'shell/renderer/test_runner/mock_color_chooser.cc',
'shell/renderer/test_runner/mock_color_chooser.h',
'shell/renderer/test_runner/mock_constraints.cc',
'shell/renderer/test_runner/mock_constraints.h',
'shell/renderer/test_runner/mock_grammar_check.cc',
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/renderer/test_runner/MockColorChooser.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/web_test_proxy.h"
using namespace blink;
namespace content {
namespace {
class HostMethodTask : public WebMethodTask<MockColorChooser> {
public:
typedef void (MockColorChooser::*CallbackMethodType)();
HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
: WebMethodTask<MockColorChooser>(object)
, m_callback(callback)
{ }
virtual void runIfValid() OVERRIDE { (m_object->*m_callback)(); }
private:
CallbackMethodType m_callback;
};
}
MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client, WebTestDelegate* delegate, WebTestProxyBase* proxy)
: m_client(client)
, m_delegate(delegate)
, m_proxy(proxy)
{
m_proxy->DidOpenChooser();
}
MockColorChooser::~MockColorChooser()
{
m_proxy->DidCloseChooser();
}
void MockColorChooser::setSelectedColor(const blink::WebColor)
{
}
void MockColorChooser::endChooser()
{
m_delegate->postDelayedTask(new HostMethodTask(this, &MockColorChooser::invokeDidEndChooser), 0);
}
void MockColorChooser::invokeDidEndChooser()
{
m_client->didEndChooser();
}
} // namespace content
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/renderer/test_runner/mock_color_chooser.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "content/shell/renderer/test_runner/web_test_proxy.h"
namespace content {
namespace {
class HostMethodTask : public WebMethodTask<MockColorChooser> {
public:
typedef void (MockColorChooser::*CallbackMethodType)();
HostMethodTask(MockColorChooser* object, CallbackMethodType callback)
: WebMethodTask<MockColorChooser>(object),
callback_(callback) {}
virtual void runIfValid() OVERRIDE { (m_object->*callback_)(); }
private:
CallbackMethodType callback_;
};
} // namespace
MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client,
WebTestDelegate* delegate,
WebTestProxyBase* proxy)
: client_(client),
delegate_(delegate),
proxy_(proxy) {
proxy_->DidOpenChooser();
}
MockColorChooser::~MockColorChooser() {
proxy_->DidCloseChooser();
}
void MockColorChooser::setSelectedColor(const blink::WebColor color) {}
void MockColorChooser::endChooser() {
delegate_->postDelayedTask(new HostMethodTask(this, &MockColorChooser::InvokeDidEndChooser), 0);
}
void MockColorChooser::InvokeDidEndChooser() {
client_->didEndChooser();
}
} // namespace content
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKCOLORCHOOSER_H_
#define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKCOLORCHOOSER_H_
#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_COLOR_CHOOSER_H_
#define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_COLOR_CHOOSER_H_
#include "base/basictypes.h"
#include "content/shell/renderer/test_runner/TestCommon.h"
......@@ -18,25 +18,27 @@ class WebTestProxyBase;
class MockColorChooser : public blink::WebColorChooser {
public:
MockColorChooser(blink::WebColorChooserClient*, WebTestDelegate*, WebTestProxyBase*);
MockColorChooser(blink::WebColorChooserClient* client,
WebTestDelegate* delegate,
WebTestProxyBase* proxy);
virtual ~MockColorChooser();
// blink::WebColorChooser implementation.
virtual void setSelectedColor(const blink::WebColor) OVERRIDE;
virtual void setSelectedColor(const blink::WebColor color) OVERRIDE;
virtual void endChooser() OVERRIDE;
void invokeDidEndChooser();
WebTaskList* mutable_task_list() { return &m_taskList; }
void InvokeDidEndChooser();
WebTaskList* mutable_task_list() { return &task_list_; }
private:
blink::WebColorChooserClient* m_client;
WebTestDelegate* m_delegate;
WebTestProxyBase* m_proxy;
WebTaskList m_taskList;
blink::WebColorChooserClient* client_;
WebTestDelegate* delegate_;
WebTestProxyBase* proxy_;
WebTaskList task_list_;
DISALLOW_COPY_AND_ASSIGN(MockColorChooser);
};
} // namespace content
#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKCOLORCHOOSER_H_
#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_COLOR_CHOOSER_H_
......@@ -9,7 +9,6 @@
#include "base/callback_helpers.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "content/shell/renderer/test_runner/MockColorChooser.h"
#include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h"
#include "content/shell/renderer/test_runner/SpellCheckClient.h"
#include "content/shell/renderer/test_runner/TestCommon.h"
......@@ -19,6 +18,7 @@
#include "content/shell/renderer/test_runner/WebTestInterfaces.h"
#include "content/shell/renderer/test_runner/accessibility_controller.h"
#include "content/shell/renderer/test_runner/event_sender.h"
#include "content/shell/renderer/test_runner/mock_color_chooser.h"
#include "content/shell/renderer/test_runner/mock_screen_orientation_client.h"
#include "content/shell/renderer/test_runner/mock_web_push_client.h"
#include "content/shell/renderer/test_runner/mock_web_user_media_client.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment