DevTools: kill codeschool extension from whitelist
[chromium-blink-merge.git] / ui / base / test / test_clipboard.h
blob58fa5075fa613abe76ea593552769cdf26013da6
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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_TEST_TEST_CLIPBOARD_H_
6 #define UI_BASE_TEST_TEST_CLIPBOARD_H_
8 #include <map>
9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/base/clipboard/clipboard.h"
12 namespace ui {
14 class TestClipboard : public Clipboard {
15 public:
16 TestClipboard();
17 ~TestClipboard() override;
19 // Creates and associates a TestClipboard with the current thread. When no
20 // longer needed, the returned clipboard must be freed by calling
21 // Clipboard::DestroyClipboardForCurrentThread() on the same thread.
22 static Clipboard* CreateForCurrentThread();
24 // Clipboard overrides.
25 uint64 GetSequenceNumber(ClipboardType type) const override;
26 bool IsFormatAvailable(const FormatType& format,
27 ClipboardType type) const override;
28 void Clear(ClipboardType type) override;
29 void ReadAvailableTypes(ClipboardType type,
30 std::vector<base::string16>* types,
31 bool* contains_filenames) const override;
32 void ReadText(ClipboardType type, base::string16* result) const override;
33 void ReadAsciiText(ClipboardType type, std::string* result) const override;
34 void ReadHTML(ClipboardType type,
35 base::string16* markup,
36 std::string* src_url,
37 uint32* fragment_start,
38 uint32* fragment_end) const override;
39 void ReadRTF(ClipboardType type, std::string* result) const override;
40 SkBitmap ReadImage(ClipboardType type) const override;
41 void ReadCustomData(ClipboardType clipboard_type,
42 const base::string16& type,
43 base::string16* result) const override;
44 void ReadBookmark(base::string16* title, std::string* url) const override;
45 void ReadData(const FormatType& format, std::string* result) const override;
46 void WriteObjects(ClipboardType type, const ObjectMap& objects) override;
47 void WriteText(const char* text_data, size_t text_len) override;
48 void WriteHTML(const char* markup_data,
49 size_t markup_len,
50 const char* url_data,
51 size_t url_len) override;
52 void WriteRTF(const char* rtf_data, size_t data_len) override;
53 void WriteBookmark(const char* title_data,
54 size_t title_len,
55 const char* url_data,
56 size_t url_len) override;
57 void WriteWebSmartPaste() override;
58 void WriteBitmap(const SkBitmap& bitmap) override;
59 void WriteData(const FormatType& format,
60 const char* data_data,
61 size_t data_len) override;
63 private:
64 struct DataStore {
65 DataStore();
66 ~DataStore();
67 void Clear();
68 uint64 sequence_number;
69 std::map<FormatType, std::string> data;
70 std::string url_title;
71 std::string html_src_url;
72 SkBitmap image;
75 // The non-const versions increment the sequence number as a side effect.
76 const DataStore& GetStore(ClipboardType type) const;
77 const DataStore& GetDefaultStore() const;
78 DataStore& GetStore(ClipboardType type);
79 DataStore& GetDefaultStore();
81 ClipboardType default_store_type_;
82 mutable std::map<ClipboardType, DataStore> stores_;
84 DISALLOW_COPY_AND_ASSIGN(TestClipboard);
87 } // namespace ui
89 #endif // UI_BASE_TEST_TEST_CLIPBOARD_H_