Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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::Size host_size(800, 600); |
| 71 test_screen_.reset(TestScreen::Create(host_size)); | 71 test_screen_.reset(TestScreen::Create(host_size)); |
| 72 gfx::Screen::SetScreenInstance(test_screen_.get()); | 72 if (!gfx::Screen::GetScreen()) |
| 73 gfx::Screen::SetScreenInstance(test_screen_.get()); | |
| 73 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); | 74 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); |
|
sky
2016/04/20 14:40:10
If there is a screen will creating host_ at a diff
sadrul
2016/04/20 14:53:17
Not sure; the trybots seem happy. But changed this
| |
| 74 | 75 |
| 75 focus_client_.reset(new TestFocusClient); | 76 focus_client_.reset(new TestFocusClient); |
| 76 client::SetFocusClient(root_window(), focus_client_.get()); | 77 client::SetFocusClient(root_window(), focus_client_.get()); |
| 77 stacking_client_.reset(new TestWindowTreeClient(root_window())); | 78 stacking_client_.reset(new TestWindowTreeClient(root_window())); |
| 78 capture_client_.reset(new client::DefaultCaptureClient(root_window())); | 79 capture_client_.reset(new client::DefaultCaptureClient(root_window())); |
| 79 | 80 |
| 80 root_window()->Show(); | 81 root_window()->Show(); |
| 81 // Ensure width != height so tests won't confuse them. | 82 // Ensure width != height so tests won't confuse them. |
| 82 host()->SetBounds(gfx::Rect(host_size)); | 83 host()->SetBounds(gfx::Rect(host_size)); |
| 83 } | 84 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 105 | 106 |
| 106 void AuraTestHelper::RunAllPendingInMessageLoop() { | 107 void AuraTestHelper::RunAllPendingInMessageLoop() { |
| 107 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 108 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
| 108 // use run_loop.QuitClosure(). | 109 // use run_loop.QuitClosure(). |
| 109 base::RunLoop run_loop; | 110 base::RunLoop run_loop; |
| 110 run_loop.RunUntilIdle(); | 111 run_loop.RunUntilIdle(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 } // namespace test | 114 } // namespace test |
| 114 } // namespace aura | 115 } // namespace aura |
| OLD | NEW |