Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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. | |
| 4 | |
| 5 #include "ui/views/mus/clipboard_mus.h" | |
| 6 | |
| 7 #include "base/message_loop/message_loop.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 #include "ui/events/platform/platform_event_source.h" | |
| 10 #include "ui/views/mus/window_manager_connection.h" | |
| 11 #include "ui/views/test/scoped_views_test_helper.h" | |
| 12 | |
| 13 namespace ui { | |
| 14 | |
| 15 struct PlatformClipboardTraits { | |
| 16 static std::unique_ptr<PlatformEventSource> GetEventSource() { | |
| 17 return std::unique_ptr<PlatformEventSource>(); | |
|
dcheng
2016/06/04 06:14:00
Nit: nullptr
| |
| 18 } | |
| 19 | |
| 20 static Clipboard* Create() { | |
| 21 EXPECT_FALSE(test_helper.get()); | |
|
dcheng
2016/06/04 06:14:01
Nit: EXPECT_FALSE(test_helper)
| |
| 22 | |
| 23 // We need to set up enough of views so that it reaches out to mus for a | |
| 24 // window manager connection. | |
| 25 test_helper.reset(new views::ScopedViewsTestHelper); | |
| 26 | |
| 27 // If we don't have a window manager connection, we will get the default | |
| 28 // platform clipboard instead. | |
| 29 EXPECT_TRUE(views::WindowManagerConnection::Exists()); | |
| 30 | |
| 31 return Clipboard::GetForCurrentThread(); | |
| 32 } | |
| 33 | |
| 34 static bool IsMusTest() { return true; } | |
| 35 | |
| 36 static void Destroy(Clipboard* clipboard) { | |
| 37 ASSERT_EQ(Clipboard::GetForCurrentThread(), clipboard); | |
| 38 Clipboard::DestroyClipboardForCurrentThread(); | |
| 39 | |
| 40 test_helper.reset(); | |
| 41 } | |
| 42 | |
| 43 static std::unique_ptr<views::ScopedViewsTestHelper> test_helper; | |
| 44 }; | |
| 45 | |
| 46 std::unique_ptr<views::ScopedViewsTestHelper> | |
| 47 PlatformClipboardTraits::test_helper; | |
|
dcheng
2016/06/04 06:14:00
I don't think we allow globals of non-POD type.
Elliot Glaysher
2016/06/06 20:10:12
In chrome code. This is in a unit test.
I also do
dcheng
2016/06/07 05:39:00
I don't think the style guide distinguishes betwee
Elliot Glaysher
2016/06/07 17:16:19
Replaced static with a forwarding subclass of ui::
| |
| 48 | |
| 49 typedef PlatformClipboardTraits TypesToTest; | |
|
dcheng
2016/06/04 06:14:00
Nit: using (I guess this is copying the pattern in
| |
| 50 | |
| 51 } // namespace ui | |
| 52 | |
| 53 #include "ui/base/clipboard/clipboard_test_template.h" | |
| OLD | NEW |