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

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

Issue 1903003002: mus/views: Fix creating gfx::Display in high-dpi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
« no previous file with comments | « no previous file | ui/views/mus/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 env_ = aura::Env::CreateInstance(); 60 env_ = aura::Env::CreateInstance();
61 Env::GetInstance()->set_context_factory(context_factory); 61 Env::GetInstance()->set_context_factory(context_factory);
62 // Unit tests generally don't want to query the system, rather use the state 62 // Unit tests generally don't want to query the system, rather use the state
63 // from RootWindow. 63 // from RootWindow.
64 EnvTestHelper env_helper(Env::GetInstance()); 64 EnvTestHelper env_helper(Env::GetInstance());
65 env_helper.SetInputStateLookup(nullptr); 65 env_helper.SetInputStateLookup(nullptr);
66 env_helper.ResetEventState(); 66 env_helper.ResetEventState();
67 67
68 ui::InitializeInputMethodForTesting(); 68 ui::InitializeInputMethodForTesting();
69 69
70 gfx::Size host_size(800, 600); 70 gfx::Screen* screen = gfx::Screen::GetScreen();
71 gfx::Size host_size(screen ? screen->GetPrimaryDisplay().GetSizeInPixel()
72 : gfx::Size(800, 600));
71 test_screen_.reset(TestScreen::Create(host_size)); 73 test_screen_.reset(TestScreen::Create(host_size));
72 gfx::Screen::SetScreenInstance(test_screen_.get()); 74 if (!screen)
75 gfx::Screen::SetScreenInstance(test_screen_.get());
73 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); 76 host_.reset(test_screen_->CreateHostForPrimaryDisplay());
74 77
75 focus_client_.reset(new TestFocusClient); 78 focus_client_.reset(new TestFocusClient);
76 client::SetFocusClient(root_window(), focus_client_.get()); 79 client::SetFocusClient(root_window(), focus_client_.get());
77 stacking_client_.reset(new TestWindowTreeClient(root_window())); 80 stacking_client_.reset(new TestWindowTreeClient(root_window()));
78 capture_client_.reset(new client::DefaultCaptureClient(root_window())); 81 capture_client_.reset(new client::DefaultCaptureClient(root_window()));
79 82
80 root_window()->Show(); 83 root_window()->Show();
81 // Ensure width != height so tests won't confuse them. 84 // Ensure width != height so tests won't confuse them.
82 host()->SetBounds(gfx::Rect(host_size)); 85 host()->SetBounds(gfx::Rect(host_size));
(...skipping 22 matching lines...) Expand all
105 108
106 void AuraTestHelper::RunAllPendingInMessageLoop() { 109 void AuraTestHelper::RunAllPendingInMessageLoop() {
107 // 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
108 // use run_loop.QuitClosure(). 111 // use run_loop.QuitClosure().
109 base::RunLoop run_loop; 112 base::RunLoop run_loop;
110 run_loop.RunUntilIdle(); 113 run_loop.RunUntilIdle();
111 } 114 }
112 115
113 } // namespace test 116 } // namespace test
114 } // namespace aura 117 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698