Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: ui/base/test/test_clipboard.cc

Issue 2011833003: Implement ui::ClipboardMus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static in test by creating forwarding clipboard subclass. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/base/test/test_clipboard.h" 5 #include "ui/base/test/test_clipboard.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include "base/memory/ptr_util.h"
8 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
10 11
11 namespace ui { 12 namespace ui {
12 13
13 TestClipboard::TestClipboard() 14 TestClipboard::TestClipboard()
14 : default_store_type_(CLIPBOARD_TYPE_COPY_PASTE) { 15 : default_store_type_(CLIPBOARD_TYPE_COPY_PASTE) {
15 } 16 }
16 17
17 TestClipboard::~TestClipboard() { 18 TestClipboard::~TestClipboard() {
18 } 19 }
19 20
20 Clipboard* TestClipboard::CreateForCurrentThread() { 21 Clipboard* TestClipboard::CreateForCurrentThread() {
21 base::AutoLock lock(Clipboard::clipboard_map_lock_.Get()); 22 base::AutoLock lock(Clipboard::clipboard_map_lock_.Get());
22 Clipboard* clipboard = new TestClipboard; 23 Clipboard* clipboard = new TestClipboard;
23 Clipboard::clipboard_map_.Get()[base::PlatformThread::CurrentId()] = 24 Clipboard::clipboard_map_.Get()[base::PlatformThread::CurrentId()] =
24 clipboard; 25 base::WrapUnique(clipboard);
25 return clipboard; 26 return clipboard;
26 } 27 }
27 28
28 uint64_t TestClipboard::GetSequenceNumber(ClipboardType type) const { 29 uint64_t TestClipboard::GetSequenceNumber(ClipboardType type) const {
29 return GetStore(type).sequence_number; 30 return GetStore(type).sequence_number;
30 } 31 }
31 32
32 bool TestClipboard::IsFormatAvailable(const FormatType& format, 33 bool TestClipboard::IsFormatAvailable(const FormatType& format,
33 ClipboardType type) const { 34 ClipboardType type) const {
34 const DataStore& store = GetStore(type); 35 const DataStore& store = GetStore(type);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 210
210 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const { 211 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const {
211 return GetStore(default_store_type_); 212 return GetStore(default_store_type_);
212 } 213 }
213 214
214 TestClipboard::DataStore& TestClipboard::GetDefaultStore() { 215 TestClipboard::DataStore& TestClipboard::GetDefaultStore() {
215 return GetStore(default_store_type_); 216 return GetStore(default_store_type_);
216 } 217 }
217 218
218 } // namespace ui 219 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/dragdrop/os_exchange_data_provider_aurax11.cc ('k') | ui/base/test/test_clipboard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698