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

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

Issue 345603003: aura: Allow specifying the size of TestScreen when creating it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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/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/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"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 Env::CreateInstance(true); 58 Env::CreateInstance(true);
59 Env::GetInstance()->set_context_factory(context_factory); 59 Env::GetInstance()->set_context_factory(context_factory);
60 // Unit tests generally don't want to query the system, rather use the state 60 // Unit tests generally don't want to query the system, rather use the state
61 // from RootWindow. 61 // from RootWindow.
62 EnvTestHelper(Env::GetInstance()).SetInputStateLookup( 62 EnvTestHelper(Env::GetInstance()).SetInputStateLookup(
63 scoped_ptr<InputStateLookup>()); 63 scoped_ptr<InputStateLookup>());
64 64
65 ui::InitializeInputMethodForTesting(); 65 ui::InitializeInputMethodForTesting();
66 66
67 test_screen_.reset(TestScreen::Create()); 67 gfx::Size host_size(800, 600);
68 test_screen_.reset(TestScreen::Create(host_size));
68 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 69 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
69 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); 70 host_.reset(test_screen_->CreateHostForPrimaryDisplay());
70 71
71 focus_client_.reset(new TestFocusClient); 72 focus_client_.reset(new TestFocusClient);
72 client::SetFocusClient(root_window(), focus_client_.get()); 73 client::SetFocusClient(root_window(), focus_client_.get());
73 stacking_client_.reset(new TestWindowTreeClient(root_window())); 74 stacking_client_.reset(new TestWindowTreeClient(root_window()));
74 capture_client_.reset(new client::DefaultCaptureClient(root_window())); 75 capture_client_.reset(new client::DefaultCaptureClient(root_window()));
75 test_input_method_.reset(new ui::DummyInputMethod); 76 test_input_method_.reset(new ui::DummyInputMethod);
76 root_window()->SetProperty( 77 root_window()->SetProperty(
77 client::kRootWindowInputMethodKey, 78 client::kRootWindowInputMethodKey,
78 test_input_method_.get()); 79 test_input_method_.get());
79 80
80 root_window()->Show(); 81 root_window()->Show();
81 // Ensure width != height so tests won't confuse them. 82 // Ensure width != height so tests won't confuse them.
82 host()->SetBounds(gfx::Rect(800, 600)); 83 host()->SetBounds(gfx::Rect(host_size));
83 } 84 }
84 85
85 void AuraTestHelper::TearDown() { 86 void AuraTestHelper::TearDown() {
86 teardown_called_ = true; 87 teardown_called_ = true;
87 test_input_method_.reset(); 88 test_input_method_.reset();
88 stacking_client_.reset(); 89 stacking_client_.reset();
89 capture_client_.reset(); 90 capture_client_.reset();
90 focus_client_.reset(); 91 focus_client_.reset();
91 client::SetFocusClient(root_window(), NULL); 92 client::SetFocusClient(root_window(), NULL);
92 host_.reset(); 93 host_.reset();
(...skipping 12 matching lines...) Expand all
105 106
106 void AuraTestHelper::RunAllPendingInMessageLoop() { 107 void AuraTestHelper::RunAllPendingInMessageLoop() {
107 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 108 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
108 // use run_loop.QuitClosure(). 109 // use run_loop.QuitClosure().
109 base::RunLoop run_loop; 110 base::RunLoop run_loop;
110 run_loop.RunUntilIdle(); 111 run_loop.RunUntilIdle();
111 } 112 }
112 113
113 } // namespace test 114 } // namespace test
114 } // namespace aura 115 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698