Index: ui/wm/test/wm_test_helper.cc |
diff --git a/ui/wm/test/wm_test_helper.cc b/ui/wm/test/wm_test_helper.cc |
index 83166be9aad299bf55f6cd06a027acfae24242e0..46085686bda8c4072bb43051aed1f4a69f9cde2f 100644 |
--- a/ui/wm/test/wm_test_helper.cc |
+++ b/ui/wm/test/wm_test_helper.cc |
@@ -4,38 +4,123 @@ |
#include "ui/wm/test/wm_test_helper.h" |
+#include "base/run_loop.h" |
#include "ui/aura/client/default_capture_client.h" |
#include "ui/aura/env.h" |
-#include "ui/aura/test/test_focus_client.h" |
#include "ui/aura/window.h" |
#include "ui/wm/core/compound_event_filter.h" |
#include "ui/wm/core/default_activation_client.h" |
+#include "ui/wm/core/default_screen_position_client.h" |
+#include "ui/wm/public/dispatcher_client.h" |
+ |
+#if defined(OS_ANDROID) && defined(USE_AURA) |
+//#include "ui/wm/android/android_focus_rules.h" |
+//#include "ui/wm/core/base_focus_rules.h" |
+//#include "ui/wm/core/focus_controller.h" |
+#else |
+#include "ui/aura/test/test_focus_client.h" |
+#endif |
namespace wm { |
+//namespace { |
+//class TestDispatcherClient : public aura::client::DispatcherClient { |
+// public: |
+// TestDispatcherClient() : dispatcher_(nullptr) {} |
+// ~TestDispatcherClient() override {} |
+// |
+// base::MessagePumpDispatcher* dispatcher() { |
+// return dispatcher_; |
+// } |
+// |
+// // aura::client::DispatcherClient: |
+// void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher, |
+// base::Closure* run_closure, |
+// base::Closure* quit_closure) override { |
+// scoped_ptr<base::RunLoop> run_loop(new base::RunLoop()); |
+// *quit_closure = run_loop->QuitClosure(); |
+// *run_closure = base::Bind(&TestDispatcherClient::RunNestedDispatcher, |
+// base::Unretained(this), |
+// base::Passed(&run_loop), |
+// dispatcher); |
+// } |
+// |
+// private: |
+// void RunNestedDispatcher(scoped_ptr<base::RunLoop> run_loop, |
+// base::MessagePumpDispatcher* dispatcher) { |
+// base::AutoReset<base::MessagePumpDispatcher*> reset_dispatcher(&dispatcher_, |
+// dispatcher); |
+// base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
+// base::MessageLoop::ScopedNestableTaskAllower allow(loop); |
+// run_loop->Run(); |
+// } |
+// |
+// base::MessagePumpDispatcher* dispatcher_; |
+// |
+// DISALLOW_COPY_AND_ASSIGN(TestDispatcherClient); |
+//}; |
+//} // namespace |
+ |
WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, |
ui::ContextFactory* context_factory) { |
aura::Env::CreateInstance(true); |
aura::Env::GetInstance()->set_context_factory(context_factory); |
+ LOG(ERROR) << "auraclank: WMTestHelper ctor: context_factory=" |
+ << context_factory; |
+ |
host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); |
+ LOG(ERROR) << "auraclank: Before InitHost"; |
host_->InitHost(); |
+ LOG(ERROR) << "auraclank: After InitHost"; |
+// host_->Show(); |
aura::client::SetWindowTreeClient(host_->window(), this); |
+ // NativeWidgetAndroid creates its own FocusClient |
+#if !defined(OS_ANDROID) |
focus_client_.reset(new aura::test::TestFocusClient); |
aura::client::SetFocusClient(host_->window(), focus_client_.get()); |
+#endif |
+ |
root_window_event_filter_.reset(new wm::CompoundEventFilter); |
host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
new wm::DefaultActivationClient(host_->window()); |
- capture_client_.reset( |
- new aura::client::DefaultCaptureClient(host_->window())); |
+ |
+// capture_client_.reset( |
+// new aura::client::DefaultCaptureClient(host_->window())); |
+// screen_position_client_.reset(new DefaultScreenPositionClient); |
+// aura::client::SetScreenPositionClient(host_->window(), |
+// screen_position_client_.get()); |
+// dispatcher_client_.reset(new TestDispatcherClient); |
+// aura::client::SetDispatcherClient(host_->window(), |
+// dispatcher_client_.get()); |
} |
WMTestHelper::~WMTestHelper() { |
} |
+void WMTestHelper::Init() { |
+// LOG(ERROR) << "auraclank: Before InitHost"; |
+// host_->InitHost(); |
+// LOG(ERROR) << "auraclank: After InitHost"; |
+//// host_->Show(); |
+// aura::client::SetWindowTreeClient(host_->window(), this); |
+// |
+// // NativeWidgetAndroid creates its own FocusClient |
+//#if !defined(OS_ANDROID) |
+// focus_client_.reset(new aura::test::TestFocusClient); |
+// aura::client::SetFocusClient(host_->window(), focus_client_.get()); |
+//#endif |
+// |
+// |
+// root_window_event_filter_.reset(new wm::CompoundEventFilter); |
+// host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
+// |
+// new wm::DefaultActivationClient(host_->window()); |
+} |
+ |
aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, |
aura::Window* window, |
const gfx::Rect& bounds) { |