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

Side by Side Diff: ui/aura/test/aura_test_helper.cc

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: fixes Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/test/aura_test_helper.h" 5 #include "ui/aura/test/aura_test_helper.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "ui/aura/client/default_capture_client.h" 9 #include "ui/aura/client/default_capture_client.h"
10 #include "ui/aura/client/focus_client.h" 10 #include "ui/aura/client/focus_client.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Unit tests generally don't want to query the system, rather use the state 65 // Unit tests generally don't want to query the system, rather use the state
66 // from RootWindow. 66 // from RootWindow.
67 EnvTestHelper env_helper(Env::GetInstance()); 67 EnvTestHelper env_helper(Env::GetInstance());
68 env_helper.SetInputStateLookup(nullptr); 68 env_helper.SetInputStateLookup(nullptr);
69 env_helper.ResetEventState(); 69 env_helper.ResetEventState();
70 70
71 ui::InitializeInputMethodForTesting(); 71 ui::InitializeInputMethodForTesting();
72 72
73 gfx::Size host_size(800, 600); 73 gfx::Size host_size(800, 600);
74 test_screen_.reset(TestScreen::Create(host_size)); 74 test_screen_.reset(TestScreen::Create(host_size));
75 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 75 gfx::Screen::SetScreenInstance(test_screen_.get());
76 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); 76 host_.reset(test_screen_->CreateHostForPrimaryDisplay());
77 77
78 focus_client_.reset(new TestFocusClient); 78 focus_client_.reset(new TestFocusClient);
79 client::SetFocusClient(root_window(), focus_client_.get()); 79 client::SetFocusClient(root_window(), focus_client_.get());
80 stacking_client_.reset(new TestWindowTreeClient(root_window())); 80 stacking_client_.reset(new TestWindowTreeClient(root_window()));
81 capture_client_.reset(new client::DefaultCaptureClient(root_window())); 81 capture_client_.reset(new client::DefaultCaptureClient(root_window()));
82 82
83 root_window()->Show(); 83 root_window()->Show();
84 // Ensure width != height so tests won't confuse them. 84 // Ensure width != height so tests won't confuse them.
85 host()->SetBounds(gfx::Rect(host_size)); 85 host()->SetBounds(gfx::Rect(host_size));
86 } 86 }
87 87
88 void AuraTestHelper::TearDown() { 88 void AuraTestHelper::TearDown() {
89 teardown_called_ = true; 89 teardown_called_ = true;
90 stacking_client_.reset(); 90 stacking_client_.reset();
91 capture_client_.reset(); 91 capture_client_.reset();
92 focus_client_.reset(); 92 focus_client_.reset();
93 client::SetFocusClient(root_window(), NULL); 93 client::SetFocusClient(root_window(), NULL);
94 host_.reset(); 94 host_.reset();
95 ui::GestureRecognizer::Reset(); 95 ui::GestureRecognizer::Reset();
96 test_screen_.reset(); 96 test_screen_.reset();
97 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); 97 gfx::Screen::SetScreenInstance(NULL);
98 98
99 #if defined(USE_X11) 99 #if defined(USE_X11)
100 ui::test::ResetXCursorCache(); 100 ui::test::ResetXCursorCache();
101 #endif 101 #endif
102 102
103 ui::ShutdownInputMethodForTesting(); 103 ui::ShutdownInputMethodForTesting();
104 104
105 if (env_created_) 105 if (env_created_)
106 Env::DeleteInstance(); 106 Env::DeleteInstance();
107 } 107 }
108 108
109 void AuraTestHelper::RunAllPendingInMessageLoop() { 109 void AuraTestHelper::RunAllPendingInMessageLoop() {
110 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 110 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
111 // use run_loop.QuitClosure(). 111 // use run_loop.QuitClosure().
112 base::RunLoop run_loop; 112 base::RunLoop run_loop;
113 run_loop.RunUntilIdle(); 113 run_loop.RunUntilIdle();
114 } 114 }
115 115
116 } // namespace test 116 } // namespace test
117 } // namespace aura 117 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698