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 // This file mocks out just enough of the WebClipboard API for running the
6 // webkit tests. This is so we can run webkit tests without them sharing a
7 // clipboard, which allows for running them in parallel and having the tests
8 // not interact with actual user actions.
10 #ifndef CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_
11 #define CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_
15 #include "base/strings/string16.h"
16 #include "third_party/WebKit/public/platform/WebClipboard.h"
17 #include "third_party/WebKit/public/platform/WebDragData.h"
18 #include "third_party/WebKit/public/platform/WebImage.h"
22 class MockWebClipboardImpl
: public blink::WebClipboard
{
24 MockWebClipboardImpl();
25 virtual ~MockWebClipboardImpl();
27 virtual bool isFormatAvailable(blink::WebClipboard::Format format
,
28 blink::WebClipboard::Buffer buffer
);
29 virtual blink::WebVector
<blink::WebString
> readAvailableTypes(
30 blink::WebClipboard::Buffer buffer
, bool* containsFilenames
);
32 virtual blink::WebString
readPlainText(blink::WebClipboard::Buffer buffer
);
33 virtual blink::WebString
readHTML(blink::WebClipboard::Buffer buffer
,
35 unsigned* fragmentStart
,
36 unsigned* fragmentEnd
);
37 virtual blink::WebData
readImage(blink::WebClipboard::Buffer buffer
);
38 virtual blink::WebString
readCustomData(blink::WebClipboard::Buffer buffer
,
39 const blink::WebString
& type
);
41 virtual void writePlainText(const blink::WebString
& plain_text
);
42 virtual void writeHTML(
43 const blink::WebString
& htmlText
, const blink::WebURL
& url
,
44 const blink::WebString
& plainText
, bool writeSmartPaste
);
45 virtual void writeURL(
46 const blink::WebURL
& url
, const blink::WebString
& title
);
47 virtual void writeImage(
48 const blink::WebImage
& image
, const blink::WebURL
& url
,
49 const blink::WebString
& title
);
50 virtual void writeDataObject(const blink::WebDragData
& data
);
55 blink::WebString m_plainText
;
56 blink::WebString m_htmlText
;
57 blink::WebImage m_image
;
58 std::map
<base::string16
, base::string16
> m_customData
;
59 bool m_writeSmartPaste
;
62 } // namespace content
64 #endif // CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_