| 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.h" | 7 #include "base/message_loop.h" | 
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" | 
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" | 
| 10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" | 
|  | 11 #include "ui/aura/desktop_ui_controls.h" | 
| 11 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" | 
| 12 #include "ui/aura/focus_manager.h" | 13 #include "ui/aura/focus_manager.h" | 
| 13 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" | 
| 14 #include "ui/aura/test/test_activation_client.h" | 15 #include "ui/aura/test/test_activation_client.h" | 
| 15 #include "ui/aura/test/test_screen.h" | 16 #include "ui/aura/test/test_screen.h" | 
| 16 #include "ui/aura/test/test_stacking_client.h" | 17 #include "ui/aura/test/test_stacking_client.h" | 
| 17 #include "ui/aura/ui_controls_aura.h" |  | 
| 18 #include "ui/base/test/dummy_input_method.h" | 18 #include "ui/base/test/dummy_input_method.h" | 
| 19 #include "ui/compositor/layer_animator.h" | 19 #include "ui/compositor/layer_animator.h" | 
| 20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" | 
| 21 #include "ui/ui_controls/ui_controls.h" | 21 #include "ui/ui_controls/ui_controls.h" | 
| 22 | 22 | 
| 23 namespace aura { | 23 namespace aura { | 
| 24 namespace test { | 24 namespace test { | 
| 25 | 25 | 
| 26 AuraTestHelper::AuraTestHelper(MessageLoopForUI* message_loop) | 26 AuraTestHelper::AuraTestHelper(MessageLoopForUI* message_loop) | 
| 27     : setup_called_(false), | 27     : setup_called_(false), | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 39   CHECK(teardown_called_) | 39   CHECK(teardown_called_) | 
| 40       << "You have overridden TearDown but never called super class's TearDown"; | 40       << "You have overridden TearDown but never called super class's TearDown"; | 
| 41 } | 41 } | 
| 42 | 42 | 
| 43 void AuraTestHelper::SetUp() { | 43 void AuraTestHelper::SetUp() { | 
| 44   setup_called_ = true; | 44   setup_called_ = true; | 
| 45   aura::Env::GetInstance(); | 45   aura::Env::GetInstance(); | 
| 46   test_screen_.reset(new TestScreen()); | 46   test_screen_.reset(new TestScreen()); | 
| 47   gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 47   gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 
| 48   root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); | 48   root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); | 
| 49   ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); | 49   ui_controls::UIControls::SetUIControlsInstance( | 
|  | 50       ui_controls::UI_CONTROLS_TYPE_NATIVE, | 
|  | 51       CreateDesktopUIControls(root_window_.get())); | 
| 50 | 52 | 
| 51   focus_manager_.reset(new FocusManager); | 53   focus_manager_.reset(new FocusManager); | 
| 52   root_window_->set_focus_manager(focus_manager_.get()); | 54   root_window_->set_focus_manager(focus_manager_.get()); | 
| 53   stacking_client_.reset(new TestStackingClient(root_window_.get())); | 55   stacking_client_.reset(new TestStackingClient(root_window_.get())); | 
| 54   test_activation_client_.reset( | 56   test_activation_client_.reset( | 
| 55       new test::TestActivationClient(root_window_.get())); | 57       new test::TestActivationClient(root_window_.get())); | 
| 56   capture_client_.reset(new client::DefaultCaptureClient(root_window_.get())); | 58   capture_client_.reset(new client::DefaultCaptureClient(root_window_.get())); | 
| 57   test_input_method_.reset(new ui::test::DummyInputMethod); | 59   test_input_method_.reset(new ui::test::DummyInputMethod); | 
| 58   root_window_->SetProperty( | 60   root_window_->SetProperty( | 
| 59       aura::client::kRootWindowInputMethodKey, | 61       aura::client::kRootWindowInputMethodKey, | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 81 #if !defined(OS_MACOSX) | 83 #if !defined(OS_MACOSX) | 
| 82   // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 84   // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 
| 83   //              use run_loop.QuitClosure(). | 85   //              use run_loop.QuitClosure(). | 
| 84   base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); | 86   base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); | 
| 85   run_loop.RunUntilIdle(); | 87   run_loop.RunUntilIdle(); | 
| 86 #endif | 88 #endif | 
| 87 } | 89 } | 
| 88 | 90 | 
| 89 }  // namespace test | 91 }  // namespace test | 
| 90 }  // namespace aura | 92 }  // namespace aura | 
| OLD | NEW | 
|---|