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

Side by Side Diff: ui/aura/test/aura_test_helper.cc

Issue 11299219: Rework FocusManager as FocusClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/window.h » ('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 (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/client/focus_client.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/aura/ui_controls_aura.h"
18 #include "ui/base/test/dummy_input_method.h" 19 #include "ui/base/test/dummy_input_method.h"
19 #include "ui/compositor/layer_animator.h" 20 #include "ui/compositor/layer_animator.h"
20 #include "ui/gfx/screen.h" 21 #include "ui/gfx/screen.h"
(...skipping 14 matching lines...) Expand all
35 36
36 AuraTestHelper::~AuraTestHelper() { 37 AuraTestHelper::~AuraTestHelper() {
37 CHECK(setup_called_) 38 CHECK(setup_called_)
38 << "You have overridden SetUp but never called super class's SetUp"; 39 << "You have overridden SetUp but never called super class's SetUp";
39 CHECK(teardown_called_) 40 CHECK(teardown_called_)
40 << "You have overridden TearDown but never called super class's TearDown"; 41 << "You have overridden TearDown but never called super class's TearDown";
41 } 42 }
42 43
43 void AuraTestHelper::SetUp() { 44 void AuraTestHelper::SetUp() {
44 setup_called_ = true; 45 setup_called_ = true;
45 aura::Env::GetInstance(); 46 Env::GetInstance();
46 test_screen_.reset(new TestScreen()); 47 test_screen_.reset(new TestScreen());
47 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 48 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
48 root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); 49 root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay());
49 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); 50 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get()));
50 51
51 focus_manager_.reset(new FocusManager); 52 focus_client_.reset(new FocusManager);
52 root_window_->set_focus_manager(focus_manager_.get()); 53 client::SetFocusClient(root_window_.get(), focus_client_.get());
53 stacking_client_.reset(new TestStackingClient(root_window_.get())); 54 stacking_client_.reset(new TestStackingClient(root_window_.get()));
54 test_activation_client_.reset( 55 test_activation_client_.reset(
55 new test::TestActivationClient(root_window_.get())); 56 new test::TestActivationClient(root_window_.get()));
56 capture_client_.reset(new client::DefaultCaptureClient(root_window_.get())); 57 capture_client_.reset(new client::DefaultCaptureClient(root_window_.get()));
57 test_input_method_.reset(new ui::test::DummyInputMethod); 58 test_input_method_.reset(new ui::test::DummyInputMethod);
58 root_window_->SetProperty( 59 root_window_->SetProperty(
59 aura::client::kRootWindowInputMethodKey, 60 client::kRootWindowInputMethodKey,
60 test_input_method_.get()); 61 test_input_method_.get());
61 62
62 root_window_->Show(); 63 root_window_->Show();
63 // Ensure width != height so tests won't confuse them. 64 // Ensure width != height so tests won't confuse them.
64 root_window_->SetHostSize(gfx::Size(800, 600)); 65 root_window_->SetHostSize(gfx::Size(800, 600));
65 } 66 }
66 67
67 void AuraTestHelper::TearDown() { 68 void AuraTestHelper::TearDown() {
68 teardown_called_ = true; 69 teardown_called_ = true;
69 test_input_method_.reset(); 70 test_input_method_.reset();
70 stacking_client_.reset(); 71 stacking_client_.reset();
71 test_activation_client_.reset(); 72 test_activation_client_.reset();
72 capture_client_.reset(); 73 capture_client_.reset();
73 focus_manager_.reset(); 74 focus_client_.reset();
74 root_window_.reset(); 75 root_window_.reset();
75 test_screen_.reset(); 76 test_screen_.reset();
76 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); 77 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL);
77 aura::Env::DeleteInstance(); 78 Env::DeleteInstance();
78 } 79 }
79 80
80 void AuraTestHelper::RunAllPendingInMessageLoop() { 81 void AuraTestHelper::RunAllPendingInMessageLoop() {
81 #if !defined(OS_MACOSX) 82 #if !defined(OS_MACOSX)
82 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 83 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
83 // use run_loop.QuitClosure(). 84 // use run_loop.QuitClosure().
84 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); 85 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher());
85 run_loop.RunUntilIdle(); 86 run_loop.RunUntilIdle();
86 #endif 87 #endif
87 } 88 }
88 89
89 } // namespace test 90 } // namespace test
90 } // namespace aura 91 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698