Don't preload rarely seen large images
[chromium-blink-merge.git] / components / test_runner / mock_color_chooser.cc
blob55d586b3580f82a2fe62b5df7eeaf8d4e89c965d
1 // Copyright 2014 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 "components/test_runner/mock_color_chooser.h"
7 #include "components/test_runner/web_test_delegate.h"
8 #include "components/test_runner/web_test_proxy.h"
10 namespace test_runner {
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) {}
20 void RunIfValid() override { (object_->*callback_)(); }
22 private:
23 CallbackMethodType callback_;
26 } // namespace
28 MockColorChooser::MockColorChooser(blink::WebColorChooserClient* client,
29 WebTestDelegate* delegate,
30 WebTestProxyBase* proxy)
31 : client_(client),
32 delegate_(delegate),
33 proxy_(proxy) {
34 proxy_->DidOpenChooser();
37 MockColorChooser::~MockColorChooser() {
38 proxy_->DidCloseChooser();
41 void MockColorChooser::setSelectedColor(const blink::WebColor color) {}
43 void MockColorChooser::endChooser() {
44 delegate_->PostDelayedTask(
45 new HostMethodTask(this, &MockColorChooser::InvokeDidEndChooser), 0);
48 void MockColorChooser::InvokeDidEndChooser() {
49 client_->didEndChooser();
52 } // namespace test_runner