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

Side by Side Diff: trunk/src/ui/wm/test/wm_test_helper.cc

Issue 213033002: Revert 259580 "Move wm/public into wm target" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/ui/wm/test/wm_test_helper.h ('k') | trunk/src/ui/wm/wm.gyp » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/test/wm_test_helper.h" 5 #include "ui/wm/test/wm_test_helper.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "ui/aura/client/default_activation_client.h"
8 #include "ui/aura/client/default_capture_client.h"
9 #include "ui/aura/env.h"
10 #include "ui/aura/test/test_focus_client.h"
8 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
9 #include "ui/wm/core/default_activation_client.h" 12 #include "ui/wm/core/compound_event_filter.h"
13 #include "ui/wm/core/input_method_event_filter.h"
10 14
11 namespace wm { 15 namespace wm {
12 16
13 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size) 17 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size) {
14 : aura::test::AuraTestHelper(base::MessageLoopForUI::current()) { 18 aura::Env::CreateInstance();
15 default_window_size_ = default_window_size; 19 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size)));
16 } 20 host_->InitHost();
21 aura::client::SetWindowTreeClient(host_->window(), this);
17 22
18 WMTestHelper::WMTestHelper() 23 focus_client_.reset(new aura::test::TestFocusClient);
19 : aura::test::AuraTestHelper(base::MessageLoopForUI::current()) { 24 aura::client::SetFocusClient(host_->window(), focus_client_.get());
25
26 root_window_event_filter_ = new wm::CompoundEventFilter;
27 // Pass ownership of the filter to the root_window.
28 host_->window()->SetEventFilter(root_window_event_filter_);
29
30 input_method_filter_.reset(new wm::InputMethodEventFilter(
31 host_->GetAcceleratedWidget()));
32 input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window());
33 root_window_event_filter_->AddHandler(input_method_filter_.get());
34
35 activation_client_.reset(
36 new aura::client::DefaultActivationClient(host_->window()));
37
38 capture_client_.reset(
39 new aura::client::DefaultCaptureClient(host_->window()));
20 } 40 }
21 41
22 WMTestHelper::~WMTestHelper() { 42 WMTestHelper::~WMTestHelper() {
43 root_window_event_filter_->RemoveHandler(input_method_filter_.get());
23 } 44 }
24 45
25 //////////////////////////////////////////////////////////////////////////////// 46 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context,
26 // WMTestHelper, AuraTestHelper overrides: 47 aura::Window* window,
27 48 const gfx::Rect& bounds) {
28 void WMTestHelper::SetUp() { 49 return host_->window();
29 aura::test::AuraTestHelper::SetUp();
30 activation_client_.reset(
31 new aura::client::DefaultActivationClient(root_window()));
32 } 50 }
33 51
34 void WMTestHelper::TearDown() {
35 activation_client_.reset();
36 aura::test::AuraTestHelper::TearDown();
37 }
38
39
40 } // namespace wm 52 } // namespace wm
OLDNEW
« no previous file with comments | « trunk/src/ui/wm/test/wm_test_helper.h ('k') | trunk/src/ui/wm/wm.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698