| 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 #include "remoting/host/chromeos/clipboard_aura.h" | 5 #include "remoting/host/chromeos/clipboard_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 clipboard_->SetPollingIntervalForTesting(kTestOverridePollingInterval); | 77 clipboard_->SetPollingIntervalForTesting(kTestOverridePollingInterval); |
| 78 | 78 |
| 79 clipboard_->Start(make_scoped_ptr(client_clipboard_)); | 79 clipboard_->Start(make_scoped_ptr(client_clipboard_)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void ClipboardAuraTest::TearDown() { | 82 void ClipboardAuraTest::TearDown() { |
| 83 ui::Clipboard::DestroyClipboardForCurrentThread(); | 83 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void ClipboardAuraTest::StopAndResetClipboard() { | 86 void ClipboardAuraTest::StopAndResetClipboard() { |
| 87 clipboard_->Stop(); | |
| 88 clipboard_.reset(); | 87 clipboard_.reset(); |
| 89 } | 88 } |
| 90 | 89 |
| 91 TEST_F(ClipboardAuraTest, WriteToClipboard) { | 90 TEST_F(ClipboardAuraTest, WriteToClipboard) { |
| 92 protocol::ClipboardEvent event; | 91 protocol::ClipboardEvent event; |
| 93 event.set_mime_type(kMimeTypeTextUtf8); | 92 event.set_mime_type(kMimeTypeTextUtf8); |
| 94 event.set_data("Test data."); | 93 event.set_data("Test data."); |
| 95 | 94 |
| 96 clipboard_->InjectClipboardEvent(event); | 95 clipboard_->InjectClipboardEvent(event); |
| 97 StopAndResetClipboard(); | 96 StopAndResetClipboard(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 FROM_HERE, base::Bind(&ClipboardAuraTest_MonitorClipboardChanges_Test:: | 122 FROM_HERE, base::Bind(&ClipboardAuraTest_MonitorClipboardChanges_Test:: |
| 124 StopAndResetClipboard, | 123 StopAndResetClipboard, |
| 125 base::Unretained(this)), | 124 base::Unretained(this)), |
| 126 TestTimeouts::tiny_timeout()); | 125 TestTimeouts::tiny_timeout()); |
| 127 message_loop_.PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), | 126 message_loop_.PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), |
| 128 TestTimeouts::tiny_timeout()); | 127 TestTimeouts::tiny_timeout()); |
| 129 run_loop.Run(); | 128 run_loop.Run(); |
| 130 } | 129 } |
| 131 | 130 |
| 132 } // namespace remoting | 131 } // namespace remoting |
| OLD | NEW |