OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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. | |
4 // | |
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. | |
9 | |
10 #ifndef WEBKIT_SUPPORT_MOCK_WEBCLIPBOARD_IMPL_H_ | |
11 #define WEBKIT_SUPPORT_MOCK_WEBCLIPBOARD_IMPL_H_ | |
12 | |
13 #include <map> | |
14 | |
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" | |
19 | |
20 class MockWebClipboardImpl : public WebKit::WebClipboard { | |
21 public: | |
22 MockWebClipboardImpl(); | |
23 virtual ~MockWebClipboardImpl(); | |
24 | |
25 virtual bool isFormatAvailable(WebKit::WebClipboard::Format format, | |
26 WebKit::WebClipboard::Buffer buffer); | |
27 virtual WebKit::WebVector<WebKit::WebString> readAvailableTypes( | |
28 WebKit::WebClipboard::Buffer buffer, bool* containsFilenames); | |
29 | |
30 virtual WebKit::WebString readPlainText(WebKit::WebClipboard::Buffer buffer); | |
31 virtual WebKit::WebString readHTML(WebKit::WebClipboard::Buffer buffer, | |
32 WebKit::WebURL* url, | |
33 unsigned* fragmentStart, | |
34 unsigned* fragmentEnd); | |
35 virtual WebKit::WebData readImage(WebKit::WebClipboard::Buffer buffer); | |
36 virtual WebKit::WebString readCustomData(WebKit::WebClipboard::Buffer buffer, | |
37 const WebKit::WebString& type); | |
38 | |
39 virtual void writePlainText(const WebKit::WebString& plain_text); | |
40 virtual void writeHTML( | |
41 const WebKit::WebString& htmlText, const WebKit::WebURL& url, | |
42 const WebKit::WebString& plainText, bool writeSmartPaste); | |
43 virtual void writeURL( | |
44 const WebKit::WebURL& url, const WebKit::WebString& title); | |
45 virtual void writeImage( | |
46 const WebKit::WebImage& image, const WebKit::WebURL& url, | |
47 const WebKit::WebString& title); | |
48 virtual void writeDataObject(const WebKit::WebDragData& data); | |
49 | |
50 private: | |
51 void clear(); | |
52 | |
53 WebKit::WebString m_plainText; | |
54 WebKit::WebString m_htmlText; | |
55 WebKit::WebImage m_image; | |
56 std::map<base::string16, base::string16> m_customData; | |
57 bool m_writeSmartPaste; | |
58 }; | |
59 | |
60 #endif // WEBKIT_SUPPORT_MOCK_WEBCLIPBOARD_IMPL_H_ | |
OLD | NEW |