summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/mock_webclipboard_impl.h
blob: 1cfb87767640de61b5d9e5bd32726e7077428232 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2011 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.
//
// This file mocks out just enough of the WebClipboard API for running the
// webkit tests. This is so we can run webkit tests without them sharing a
// clipboard, which allows for running them in parallel and having the tests
// not interact with actual user actions.

#ifndef WEBKIT_TOOLS_TEST_SHELL_MOCK_WEBCLIPBOARD_IMPL_H_
#define WEBKIT_TOOLS_TEST_SHELL_MOCK_WEBCLIPBOARD_IMPL_H_

#include "third_party/WebKit/Source/WebKit/chromium/public/WebClipboard.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h"

class MockWebClipboardImpl : public WebKit::WebClipboard {
 public:
  MockWebClipboardImpl();
  ~MockWebClipboardImpl();

  virtual bool isFormatAvailable(WebKit::WebClipboard::Format,
                                 WebKit::WebClipboard::Buffer);

  virtual WebKit::WebString readPlainText(WebKit::WebClipboard::Buffer);
  virtual WebKit::WebString readHTML(WebKit::WebClipboard::Buffer,
                                     WebKit::WebURL*);
  virtual WebKit::WebData readImage(WebKit::WebClipboard::Buffer);

  virtual void writePlainText(const WebKit::WebString& plain_text);
  virtual void writeHTML(
      const WebKit::WebString& htmlText, const WebKit::WebURL&,
      const WebKit::WebString& plainText, bool writeSmartPaste);
  virtual void writeURL(
      const WebKit::WebURL&, const WebKit::WebString& title);
  virtual void writeImage(
      const WebKit::WebImage&, const WebKit::WebURL&,
      const WebKit::WebString& title);

  virtual WebKit::WebVector<WebKit::WebString> readAvailableTypes(
      WebKit::WebClipboard::Buffer, bool* containsFilenames);

 private:
  WebKit::WebString m_plainText;
  WebKit::WebString m_htmlText;
  WebKit::WebImage m_image;
  bool m_writeSmartPaste;
};

#endif  // WEBKIT_TOOLS_TEST_SHELL_MOCK_WEBCLIPBOARD_IMPL_H_