| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file mocks out just enough of the WebClipboard API for running the | 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 | 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 | 7 // clipboard, which allows for running them in parallel and having the tests |
| 8 // not interact with actual user actions. | 8 // not interact with actual user actions. |
| 9 | 9 |
| 10 #ifndef CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ | 10 #ifndef CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ |
| 11 #define CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ | 11 #define CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ |
| 12 | 12 |
| 13 #include <map> | 13 #include <map> |
| 14 | 14 |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "third_party/WebKit/public/platform/WebClipboard.h" | 16 #include "third_party/WebKit/public/platform/WebClipboard.h" |
| 17 #include "third_party/WebKit/public/platform/WebDragData.h" | 17 #include "third_party/WebKit/public/platform/WebDragData.h" |
| 18 #include "third_party/WebKit/public/platform/WebImage.h" | 18 #include "third_party/WebKit/public/platform/WebImage.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class MockWebClipboardImpl : public WebKit::WebClipboard { | 22 class MockWebClipboardImpl : public blink::WebClipboard { |
| 23 public: | 23 public: |
| 24 MockWebClipboardImpl(); | 24 MockWebClipboardImpl(); |
| 25 virtual ~MockWebClipboardImpl(); | 25 virtual ~MockWebClipboardImpl(); |
| 26 | 26 |
| 27 virtual bool isFormatAvailable(WebKit::WebClipboard::Format format, | 27 virtual bool isFormatAvailable(blink::WebClipboard::Format format, |
| 28 WebKit::WebClipboard::Buffer buffer); | 28 blink::WebClipboard::Buffer buffer); |
| 29 virtual WebKit::WebVector<WebKit::WebString> readAvailableTypes( | 29 virtual blink::WebVector<blink::WebString> readAvailableTypes( |
| 30 WebKit::WebClipboard::Buffer buffer, bool* containsFilenames); | 30 blink::WebClipboard::Buffer buffer, bool* containsFilenames); |
| 31 | 31 |
| 32 virtual WebKit::WebString readPlainText(WebKit::WebClipboard::Buffer buffer); | 32 virtual blink::WebString readPlainText(blink::WebClipboard::Buffer buffer); |
| 33 virtual WebKit::WebString readHTML(WebKit::WebClipboard::Buffer buffer, | 33 virtual blink::WebString readHTML(blink::WebClipboard::Buffer buffer, |
| 34 WebKit::WebURL* url, | 34 blink::WebURL* url, |
| 35 unsigned* fragmentStart, | 35 unsigned* fragmentStart, |
| 36 unsigned* fragmentEnd); | 36 unsigned* fragmentEnd); |
| 37 virtual WebKit::WebData readImage(WebKit::WebClipboard::Buffer buffer); | 37 virtual blink::WebData readImage(blink::WebClipboard::Buffer buffer); |
| 38 virtual WebKit::WebString readCustomData(WebKit::WebClipboard::Buffer buffer, | 38 virtual blink::WebString readCustomData(blink::WebClipboard::Buffer buffer, |
| 39 const WebKit::WebString& type); | 39 const blink::WebString& type); |
| 40 | 40 |
| 41 virtual void writePlainText(const WebKit::WebString& plain_text); | 41 virtual void writePlainText(const blink::WebString& plain_text); |
| 42 virtual void writeHTML( | 42 virtual void writeHTML( |
| 43 const WebKit::WebString& htmlText, const WebKit::WebURL& url, | 43 const blink::WebString& htmlText, const blink::WebURL& url, |
| 44 const WebKit::WebString& plainText, bool writeSmartPaste); | 44 const blink::WebString& plainText, bool writeSmartPaste); |
| 45 virtual void writeURL( | 45 virtual void writeURL( |
| 46 const WebKit::WebURL& url, const WebKit::WebString& title); | 46 const blink::WebURL& url, const blink::WebString& title); |
| 47 virtual void writeImage( | 47 virtual void writeImage( |
| 48 const WebKit::WebImage& image, const WebKit::WebURL& url, | 48 const blink::WebImage& image, const blink::WebURL& url, |
| 49 const WebKit::WebString& title); | 49 const blink::WebString& title); |
| 50 virtual void writeDataObject(const WebKit::WebDragData& data); | 50 virtual void writeDataObject(const blink::WebDragData& data); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 void clear(); | 53 void clear(); |
| 54 | 54 |
| 55 WebKit::WebString m_plainText; | 55 blink::WebString m_plainText; |
| 56 WebKit::WebString m_htmlText; | 56 blink::WebString m_htmlText; |
| 57 WebKit::WebImage m_image; | 57 blink::WebImage m_image; |
| 58 std::map<base::string16, base::string16> m_customData; | 58 std::map<base::string16, base::string16> m_customData; |
| 59 bool m_writeSmartPaste; | 59 bool m_writeSmartPaste; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace content | 62 } // namespace content |
| 63 | 63 |
| 64 #endif // CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ | 64 #endif // CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ |
| OLD | NEW |