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

Side by Side Diff: athena/test/athena_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/test/athena_test_helper.h" 5 #include "athena/test/athena_test_helper.h"
6 6
7 #include "athena/main/athena_launcher.h" 7 #include "athena/main/athena_launcher.h"
8 #include "athena/test/sample_activity_factory.h" 8 #include "athena/test/sample_activity_factory.h"
9 #include "athena/test/test_app_model_builder.h" 9 #include "athena/test/test_app_model_builder.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 aura::Env::CreateInstance(true); 49 aura::Env::CreateInstance(true);
50 aura::Env::GetInstance()->set_context_factory(context_factory); 50 aura::Env::GetInstance()->set_context_factory(context_factory);
51 51
52 // Unit tests generally don't want to query the system, rather use the state 52 // Unit tests generally don't want to query the system, rather use the state
53 // from RootWindow. 53 // from RootWindow.
54 aura::test::EnvTestHelper(aura::Env::GetInstance()) 54 aura::test::EnvTestHelper(aura::Env::GetInstance())
55 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>()); 55 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>());
56 56
57 ui::InitializeInputMethodForTesting(); 57 ui::InitializeInputMethodForTesting();
58 58
59 test_screen_.reset(aura::TestScreen::Create()); 59 const gfx::Size host_size(800, 600);
60 test_screen_.reset(aura::TestScreen::Create(host_size));
60 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); 61 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
61 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); 62 host_.reset(test_screen_->CreateHostForPrimaryDisplay());
62 63
63 input_method_filter_.reset(new ::wm::InputMethodEventFilter( 64 input_method_filter_.reset(new ::wm::InputMethodEventFilter(
64 root_window()->GetHost()->GetAcceleratedWidget())); 65 root_window()->GetHost()->GetAcceleratedWidget()));
65 input_method_filter_->SetInputMethodPropertyInRootWindow( 66 input_method_filter_->SetInputMethodPropertyInRootWindow(
66 root_window()); 67 root_window());
67 68
68 // TODO(oshima): Switch to athena implementation. 69 // TODO(oshima): Switch to athena implementation.
69 focus_client_.reset(new aura::test::TestFocusClient); 70 focus_client_.reset(new aura::test::TestFocusClient);
70 aura::client::SetFocusClient(root_window(), 71 aura::client::SetFocusClient(root_window(),
71 focus_client_.get()); 72 focus_client_.get());
72 new ::wm::DefaultActivationClient(root_window()); 73 new ::wm::DefaultActivationClient(root_window());
73 74
74 root_window()->Show(); 75 root_window()->Show();
75 // Ensure width != height so tests won't confuse them. 76 // Ensure width != height so tests won't confuse them.
76 host()->SetBounds(gfx::Rect(800, 600)); 77 host()->SetBounds(gfx::Rect(host_size));
77 78
78 athena::StartAthena(root_window(), 79 athena::StartAthena(root_window(),
79 new SampleActivityFactory(), 80 new SampleActivityFactory(),
80 new TestAppModelBuilder()); 81 new TestAppModelBuilder());
81 } 82 }
82 83
83 void AthenaTestHelper::TearDown() { 84 void AthenaTestHelper::TearDown() {
84 teardown_called_ = true; 85 teardown_called_ = true;
85 86
86 athena::ShutdownAthena(); 87 athena::ShutdownAthena();
(...skipping 18 matching lines...) Expand all
105 106
106 void AthenaTestHelper::RunAllPendingInMessageLoop() { 107 void AthenaTestHelper::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 athena 115 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698