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

Unified Diff: ui/views/mus/clipboard_unittest.cc

Issue 2011833003: Implement ui::ClipboardMus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: base::string16 in interfaces. >:( Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/mus/clipboard_unittest.cc
diff --git a/ui/views/mus/clipboard_unittest.cc b/ui/views/mus/clipboard_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..188690f1edd8d3c4b1774d383e86bd84a2715c89
--- /dev/null
+++ b/ui/views/mus/clipboard_unittest.cc
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/mus/clipboard_mus.h"
+
+#include "base/message_loop/message_loop.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/events/platform/platform_event_source.h"
+#include "ui/views/mus/window_manager_connection.h"
+#include "ui/views/test/scoped_views_test_helper.h"
+
+namespace ui {
+
+struct PlatformClipboardTraits {
+ static std::unique_ptr<PlatformEventSource> GetEventSource() {
+ return std::unique_ptr<PlatformEventSource>();
+ }
+
+ static Clipboard* Create() {
+ EXPECT_FALSE(test_helper.get());
+
+ // We need to set up enough of views so that it reaches out to mus for a
+ // window manager connection.
+ test_helper.reset(new views::ScopedViewsTestHelper);
+
+ // If we don't have a window manager connection, we will get the default
+ // platform clipboard instead.
+ EXPECT_TRUE(views::WindowManagerConnection::Exists());
+
+ return Clipboard::GetForCurrentThread();
+ }
+
+ static void Destroy(Clipboard* clipboard) {
+ ASSERT_EQ(Clipboard::GetForCurrentThread(), clipboard);
+ Clipboard::DestroyClipboardForCurrentThread();
+
+ test_helper.reset();
+ }
+
+ static std::unique_ptr<views::ScopedViewsTestHelper> test_helper;
+};
+
+std::unique_ptr<views::ScopedViewsTestHelper>
+ PlatformClipboardTraits::test_helper;
+
+typedef PlatformClipboardTraits TypesToTest;
+
+} // namespace ui
+
+#include "ui/base/clipboard/clipboard_test_template.h"

Powered by Google App Engine
This is Rietveld 408576698