| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_BASE_TEST_TEST_CLIPBOARD_H_ | 5 #ifndef UI_BASE_TEST_TEST_CLIPBOARD_H_ |
| 6 #define UI_BASE_TEST_TEST_CLIPBOARD_H_ | 6 #define UI_BASE_TEST_TEST_CLIPBOARD_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 #include "ui/base/clipboard/clipboard.h" | 15 #include "ui/base/clipboard/clipboard.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 class TestClipboard : public Clipboard { | 19 class TestClipboard : public Clipboard { |
| 20 public: | 20 public: |
| 21 TestClipboard(); | 21 TestClipboard(); |
| 22 ~TestClipboard() override; | 22 ~TestClipboard() override; |
| 23 | 23 |
| 24 // Creates and associates a TestClipboard with the current thread. When no | 24 // Creates and associates a TestClipboard with the current thread. When no |
| 25 // longer needed, the returned clipboard must be freed by calling | 25 // longer needed, the returned clipboard must be freed by calling |
| 26 // Clipboard::DestroyClipboardForCurrentThread() on the same thread. | 26 // Clipboard::DestroyClipboardForCurrentThread() on the same thread. |
| 27 static Clipboard* CreateForCurrentThread(); | 27 static Clipboard* CreateForCurrentThread(); |
| 28 | 28 |
| 29 // Sets the time to be returned by GetClipboardLastModifiedTime(); | 29 // Sets the time to be returned by GetLastModifiedTime(); |
| 30 void SetClipboardLastModifiedTime(const base::Time& time); | 30 void SetLastModifiedTime(const base::Time& time); |
| 31 | 31 |
| 32 // Clipboard overrides. | 32 // Clipboard overrides. |
| 33 void OnPreShutdown() override; | 33 void OnPreShutdown() override; |
| 34 uint64_t GetSequenceNumber(ClipboardType type) const override; | 34 uint64_t GetSequenceNumber(ClipboardType type) const override; |
| 35 bool IsFormatAvailable(const FormatType& format, | 35 bool IsFormatAvailable(const FormatType& format, |
| 36 ClipboardType type) const override; | 36 ClipboardType type) const override; |
| 37 void Clear(ClipboardType type) override; | 37 void Clear(ClipboardType type) override; |
| 38 void ReadAvailableTypes(ClipboardType type, | 38 void ReadAvailableTypes(ClipboardType type, |
| 39 std::vector<base::string16>* types, | 39 std::vector<base::string16>* types, |
| 40 bool* contains_filenames) const override; | 40 bool* contains_filenames) const override; |
| 41 void ReadText(ClipboardType type, base::string16* result) const override; | 41 void ReadText(ClipboardType type, base::string16* result) const override; |
| 42 void ReadAsciiText(ClipboardType type, std::string* result) const override; | 42 void ReadAsciiText(ClipboardType type, std::string* result) const override; |
| 43 void ReadHTML(ClipboardType type, | 43 void ReadHTML(ClipboardType type, |
| 44 base::string16* markup, | 44 base::string16* markup, |
| 45 std::string* src_url, | 45 std::string* src_url, |
| 46 uint32_t* fragment_start, | 46 uint32_t* fragment_start, |
| 47 uint32_t* fragment_end) const override; | 47 uint32_t* fragment_end) const override; |
| 48 void ReadRTF(ClipboardType type, std::string* result) const override; | 48 void ReadRTF(ClipboardType type, std::string* result) const override; |
| 49 SkBitmap ReadImage(ClipboardType type) const override; | 49 SkBitmap ReadImage(ClipboardType type) const override; |
| 50 void ReadCustomData(ClipboardType clipboard_type, | 50 void ReadCustomData(ClipboardType clipboard_type, |
| 51 const base::string16& type, | 51 const base::string16& type, |
| 52 base::string16* result) const override; | 52 base::string16* result) const override; |
| 53 void ReadBookmark(base::string16* title, std::string* url) const override; | 53 void ReadBookmark(base::string16* title, std::string* url) const override; |
| 54 void ReadData(const FormatType& format, std::string* result) const override; | 54 void ReadData(const FormatType& format, std::string* result) const override; |
| 55 base::Time GetClipboardLastModifiedTime() const override; | 55 base::Time GetLastModifiedTime() const override; |
| 56 void ClearLastModifiedTime() override; |
| 56 void WriteObjects(ClipboardType type, const ObjectMap& objects) override; | 57 void WriteObjects(ClipboardType type, const ObjectMap& objects) override; |
| 57 void WriteText(const char* text_data, size_t text_len) override; | 58 void WriteText(const char* text_data, size_t text_len) override; |
| 58 void WriteHTML(const char* markup_data, | 59 void WriteHTML(const char* markup_data, |
| 59 size_t markup_len, | 60 size_t markup_len, |
| 60 const char* url_data, | 61 const char* url_data, |
| 61 size_t url_len) override; | 62 size_t url_len) override; |
| 62 void WriteRTF(const char* rtf_data, size_t data_len) override; | 63 void WriteRTF(const char* rtf_data, size_t data_len) override; |
| 63 void WriteBookmark(const char* title_data, | 64 void WriteBookmark(const char* title_data, |
| 64 size_t title_len, | 65 size_t title_len, |
| 65 const char* url_data, | 66 const char* url_data, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 92 ClipboardType default_store_type_; | 93 ClipboardType default_store_type_; |
| 93 mutable std::map<ClipboardType, DataStore> stores_; | 94 mutable std::map<ClipboardType, DataStore> stores_; |
| 94 base::Time last_modified_time_; | 95 base::Time last_modified_time_; |
| 95 | 96 |
| 96 DISALLOW_COPY_AND_ASSIGN(TestClipboard); | 97 DISALLOW_COPY_AND_ASSIGN(TestClipboard); |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 } // namespace ui | 100 } // namespace ui |
| 100 | 101 |
| 101 #endif // UI_BASE_TEST_TEST_CLIPBOARD_H_ | 102 #endif // UI_BASE_TEST_TEST_CLIPBOARD_H_ |
| OLD | NEW |