| Index: content/test/layout_tests/runner/MockColorChooser.cpp
|
| diff --git a/third_party/tcmalloc/vendor/src/base/thread_lister.c b/content/test/layout_tests/runner/MockColorChooser.cpp
|
| similarity index 50%
|
| copy from third_party/tcmalloc/vendor/src/base/thread_lister.c
|
| copy to content/test/layout_tests/runner/MockColorChooser.cpp
|
| index bc180dba7a9f2ba3b8261009c8af85f0b1d4a023..5b60af53ccc81f7a5c840b746a03e32946b19e16 100644
|
| --- a/third_party/tcmalloc/vendor/src/base/thread_lister.c
|
| +++ b/content/test/layout_tests/runner/MockColorChooser.cpp
|
| @@ -1,5 +1,9 @@
|
| -/* Copyright (c) 2005-2007, Google Inc.
|
| - * All rights reserved.
|
| +// 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.
|
| +
|
| +/*
|
| + * Copyright (C) 2013 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -26,52 +30,59 @@
|
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| - *
|
| - * ---
|
| - * Author: Markus Gutschke
|
| */
|
|
|
| -#include "config.h"
|
| -#include <stdio.h> /* needed for NULL on some powerpc platforms (?!) */
|
| -#ifdef HAVE_SYS_PRCTL
|
| -# include <sys/prctl.h>
|
| -#endif
|
| -#include "base/thread_lister.h"
|
| -#include "base/linuxthreads.h"
|
| -/* Include other thread listers here that define THREADS macro
|
| - * only when they can provide a good implementation.
|
| - */
|
| +#include "content/test/layout_tests/runner/MockColorChooser.h"
|
|
|
| -#ifndef THREADS
|
| +#include "content/public/test/layout_tests/WebTestDelegate.h"
|
| +#include "content/public/test/layout_tests/WebTestProxy.h"
|
|
|
| -/* Default trivial thread lister for single-threaded applications,
|
| - * or if the multi-threading code has not been ported, yet.
|
| - */
|
| +using namespace blink;
|
| +using namespace std;
|
|
|
| -int ListAllProcessThreads(void *parameter,
|
| - ListAllProcessThreadsCallBack callback, ...) {
|
| - int rc;
|
| - va_list ap;
|
| - pid_t pid;
|
| +namespace WebTestRunner {
|
| +
|
| +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() { (m_object->*m_callback)(); }
|
| +
|
| +private:
|
| + CallbackMethodType m_callback;
|
| +};
|
| +}
|
|
|
| -#ifdef HAVE_SYS_PRCTL
|
| - int dumpable = prctl(PR_GET_DUMPABLE, 0);
|
| - if (!dumpable)
|
| - prctl(PR_SET_DUMPABLE, 1);
|
| -#endif
|
| - va_start(ap, callback);
|
| - pid = getpid();
|
| - rc = callback(parameter, 1, &pid, ap);
|
| - va_end(ap);
|
| -#ifdef HAVE_SYS_PRCTL
|
| - if (!dumpable)
|
| - prctl(PR_SET_DUMPABLE, 0);
|
| -#endif
|
| - return rc;
|
| +MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client, WebTestDelegate* delegate, WebTestProxyBase* proxy)
|
| + : m_client(client)
|
| + , m_delegate(delegate)
|
| + , m_proxy(proxy)
|
| +{
|
| + m_proxy->didOpenChooser();
|
| }
|
|
|
| -int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) {
|
| - return 1;
|
| +MockColorChooser::~MockColorChooser()
|
| +{
|
| + m_proxy->didCloseChooser();
|
| }
|
|
|
| -#endif /* ifndef THREADS */
|
| +void MockColorChooser::setSelectedColor(const blink::WebColor)
|
| +{
|
| +}
|
| +
|
| +void MockColorChooser::endChooser()
|
| +{
|
| + m_delegate->postDelayedTask(new HostMethodTask(this, &MockColorChooser::invokeDidEndChooser), 0);
|
| +}
|
| +
|
| +void MockColorChooser::invokeDidEndChooser()
|
| +{
|
| + m_client->didEndChooser();
|
| +}
|
| +
|
| +}
|
|
|