| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::Screen* screen = gfx::Screen::GetScreen(); | 70 display::Screen* screen = display::Screen::GetScreen(); |
| 71 gfx::Size host_size(screen ? screen->GetPrimaryDisplay().GetSizeInPixel() | 71 gfx::Size host_size(screen ? screen->GetPrimaryDisplay().GetSizeInPixel() |
| 72 : gfx::Size(800, 600)); | 72 : gfx::Size(800, 600)); |
| 73 test_screen_.reset(TestScreen::Create(host_size)); | 73 test_screen_.reset(TestScreen::Create(host_size)); |
| 74 if (!screen) | 74 if (!screen) |
| 75 gfx::Screen::SetScreenInstance(test_screen_.get()); | 75 display::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)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 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 |
| OLD | NEW |