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

Side by Side Diff: ui/views/test/scoped_views_test_helper.cc

Issue 2499303003: Views:: Use TestClipboard in ScopedViewsTestHelper. (Closed)
Patch Set: Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/views/test/scoped_views_test_helper.h" 5 #include "ui/views/test/scoped_views_test_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "ui/base/clipboard/clipboard.h"
11 #include "ui/base/ime/input_method_initializer.h" 12 #include "ui/base/ime/input_method_initializer.h"
13 #include "ui/base/test/test_clipboard.h"
12 #include "ui/compositor/test/context_factories_for_test.h" 14 #include "ui/compositor/test/context_factories_for_test.h"
13 #include "ui/views/test/platform_test_helper.h" 15 #include "ui/views/test/platform_test_helper.h"
14 #include "ui/views/test/test_views_delegate.h" 16 #include "ui/views/test/test_views_delegate.h"
15 #include "ui/views/test/views_test_helper.h" 17 #include "ui/views/test/views_test_helper.h"
16 18
17 #if defined(USE_AURA) 19 #if defined(USE_AURA)
18 #include "ui/aura/env.h" 20 #include "ui/aura/env.h"
19 #endif 21 #endif
20 22
21 namespace views { 23 namespace views {
(...skipping 29 matching lines...) Expand all
51 // WindowTreeHost instance created by TestScreen. After that, the 53 // WindowTreeHost instance created by TestScreen. After that, the
52 // context-factory is used when creating Widgets (to set-up the compositor for 54 // context-factory is used when creating Widgets (to set-up the compositor for
53 // the corresponding ui::Windows). So restore the context-factory (which 55 // the corresponding ui::Windows). So restore the context-factory (which
54 // WindowManagerConnection would have set up), so that NativeWidgetMus 56 // WindowManagerConnection would have set up), so that NativeWidgetMus
55 // installs the correct context-factory that can talk to mus. 57 // installs the correct context-factory that can talk to mus.
56 if (PlatformTestHelper::IsMus()) 58 if (PlatformTestHelper::IsMus())
57 aura::Env::GetInstance()->set_context_factory(old_context_factory); 59 aura::Env::GetInstance()->set_context_factory(old_context_factory);
58 #endif 60 #endif
59 61
60 ui::InitializeInputMethodForTesting(); 62 ui::InitializeInputMethodForTesting();
63 ui::TestClipboard::CreateForCurrentThread();
karandeepb 2016/11/16 04:16:15 sky@: Should this go in ViewsTestBase or is this f
61 } 64 }
62 65
63 ScopedViewsTestHelper::~ScopedViewsTestHelper() { 66 ScopedViewsTestHelper::~ScopedViewsTestHelper() {
67 ui::Clipboard::DestroyClipboardForCurrentThread();
64 ui::ShutdownInputMethodForTesting(); 68 ui::ShutdownInputMethodForTesting();
65 test_helper_->TearDown(); 69 test_helper_->TearDown();
66 test_helper_.reset(); 70 test_helper_.reset();
67 71
68 views_delegate_.reset(); 72 views_delegate_.reset();
69 73
70 // The Mus PlatformTestHelper has state that is deleted by 74 // The Mus PlatformTestHelper has state that is deleted by
71 // ui::TerminateContextFactoryForTests(). 75 // ui::TerminateContextFactoryForTests().
72 platform_test_helper_.reset(); 76 platform_test_helper_.reset();
73 77
74 ui::TerminateContextFactoryForTests(); 78 ui::TerminateContextFactoryForTests();
75 } 79 }
76 80
77 gfx::NativeWindow ScopedViewsTestHelper::GetContext() { 81 gfx::NativeWindow ScopedViewsTestHelper::GetContext() {
78 return test_helper_->GetContext(); 82 return test_helper_->GetContext();
79 } 83 }
80 84
81 } // namespace views 85 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698