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/nullable_string16.h" | 15 #include "base/strings/nullable_string16.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "third_party/WebKit/public/platform/WebClipboard.h" | 17 #include "third_party/WebKit/public/platform/WebClipboard.h" |
18 #include "third_party/WebKit/public/platform/WebDragData.h" | 18 #include "third_party/WebKit/public/platform/WebDragData.h" |
19 #include "third_party/WebKit/public/platform/WebImage.h" | 19 #include "third_party/WebKit/public/platform/WebImage.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class MockWebClipboardImpl : public blink::WebClipboard { | 23 class MockWebClipboardImpl : public blink::WebClipboard { |
24 public: | 24 public: |
25 MockWebClipboardImpl(); | 25 MockWebClipboardImpl(); |
26 virtual ~MockWebClipboardImpl(); | 26 virtual ~MockWebClipboardImpl(); |
27 | 27 |
| 28 virtual uint64_t sequenceNumber(Buffer); |
28 virtual bool isFormatAvailable(blink::WebClipboard::Format format, | 29 virtual bool isFormatAvailable(blink::WebClipboard::Format format, |
29 blink::WebClipboard::Buffer buffer); | 30 blink::WebClipboard::Buffer buffer); |
30 virtual blink::WebVector<blink::WebString> readAvailableTypes( | 31 virtual blink::WebVector<blink::WebString> readAvailableTypes( |
31 blink::WebClipboard::Buffer buffer, bool* containsFilenames); | 32 blink::WebClipboard::Buffer buffer, bool* containsFilenames); |
32 | 33 |
33 virtual blink::WebString readPlainText(blink::WebClipboard::Buffer buffer); | 34 virtual blink::WebString readPlainText(blink::WebClipboard::Buffer buffer); |
34 virtual blink::WebString readHTML(blink::WebClipboard::Buffer buffer, | 35 virtual blink::WebString readHTML(blink::WebClipboard::Buffer buffer, |
35 blink::WebURL* url, | 36 blink::WebURL* url, |
36 unsigned* fragmentStart, | 37 unsigned* fragmentStart, |
37 unsigned* fragmentEnd); | 38 unsigned* fragmentEnd); |
38 virtual blink::WebData readImage(blink::WebClipboard::Buffer buffer); | 39 virtual blink::WebData readImage(blink::WebClipboard::Buffer buffer); |
39 virtual blink::WebString readCustomData(blink::WebClipboard::Buffer buffer, | 40 virtual blink::WebString readCustomData(blink::WebClipboard::Buffer buffer, |
40 const blink::WebString& type); | 41 const blink::WebString& type); |
41 | 42 |
42 virtual void writePlainText(const blink::WebString& plain_text); | 43 virtual void writePlainText(const blink::WebString& plain_text); |
43 virtual void writeHTML( | 44 virtual void writeHTML( |
44 const blink::WebString& htmlText, const blink::WebURL& url, | 45 const blink::WebString& htmlText, const blink::WebURL& url, |
45 const blink::WebString& plainText, bool writeSmartPaste); | 46 const blink::WebString& plainText, bool writeSmartPaste); |
46 virtual void writeURL( | 47 virtual void writeURL( |
47 const blink::WebURL& url, const blink::WebString& title); | 48 const blink::WebURL& url, const blink::WebString& title); |
48 virtual void writeImage( | 49 virtual void writeImage( |
49 const blink::WebImage& image, const blink::WebURL& url, | 50 const blink::WebImage& image, const blink::WebURL& url, |
50 const blink::WebString& title); | 51 const blink::WebString& title); |
51 virtual void writeDataObject(const blink::WebDragData& data); | 52 virtual void writeDataObject(const blink::WebDragData& data); |
52 | 53 |
53 private: | 54 private: |
54 void clear(); | 55 void clear(); |
55 | 56 |
| 57 uint64_t m_sequenceNumber; |
56 base::NullableString16 m_plainText; | 58 base::NullableString16 m_plainText; |
57 base::NullableString16 m_htmlText; | 59 base::NullableString16 m_htmlText; |
58 blink::WebImage m_image; | 60 blink::WebImage m_image; |
59 std::map<base::string16, base::string16> m_customData; | 61 std::map<base::string16, base::string16> m_customData; |
60 bool m_writeSmartPaste; | 62 bool m_writeSmartPaste; |
61 }; | 63 }; |
62 | 64 |
63 } // namespace content | 65 } // namespace content |
64 | 66 |
65 #endif // CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ | 67 #endif // CONTENT_TEST_MOCK_WEBCLIPBOARD_IMPL_H_ |
OLD | NEW |