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

Side by Side Diff: wm/test/wm_test_base.cc

Issue 11485006: Add window manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Push gfx::AcceleratedWidget usage into platform specific code. Created 7 years, 10 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 | « wm/test/wm_test_base.h ('k') | wm/test/wm_unittests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "wm/test/wm_test_base.h"
6
7 #include "ash/ash_switches.h"
8 #include "base/command_line.h"
9 #include "base/run_loop.h"
10 #include "ui/aura/env.h"
11 #include "ui/aura/root_window.h"
12 #include "ui/base/ime/text_input_test_support.h"
13 #include "ui/compositor/layer_animator.h"
14 #include "wm/foreign_test_window.h"
15 #include "wm/gpu/foreign_window_texture_factory.h"
16 #include "wm/host/foreign_test_window_host.h"
17 #include "wm/test/test_shell_delegate.h"
18
19 namespace wm {
20 namespace test {
21
22 WmTestBase::WmTestBase() {
23 }
24
25 WmTestBase::~WmTestBase() {
26 }
27
28 void WmTestBase::SetUp() {
29 content::ImageTransportFactory::Initialize();
30 ForeignWindowTextureFactory::Initialize();
31 // Use the origin (1,1) so that it doesn't over
32 // lap with the native mouse cursor.
33 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
34 ash::switches::kAshHostWindowBounds, "1+1-800x600");
35 #if defined(OS_WIN)
36 aura::test::SetUsePopupAsRootWindowForTest(true);
37 #endif
38 // Disable animations during tests.
39 ui::LayerAnimator::set_disable_animations_for_test(true);
40 ui::TextInputTestSupport::Initialize();
41 // Creates Shell and hook with Desktop.
42 TestShellDelegate* delegate = new TestShellDelegate;
43 ash::Shell::CreateInstance(delegate);
44 ash::Shell::GetPrimaryRootWindow()->Show();
45 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow();
46 // Move the mouse cursor to far away so that native events doesn't
47 // interfere test expectations.
48 ash::Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
49 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
50 }
51
52 void WmTestBase::TearDown() {
53 // Flush the message loop to finish pending release tasks.
54 RunAllPendingInMessageLoop();
55
56 // Tear down the shell.
57 ash::Shell::DeleteInstance();
58 aura::Env::DeleteInstance();
59 ui::TextInputTestSupport::Shutdown();
60 #if defined(OS_WIN)
61 aura::test::SetUsePopupAsRootWindowForTest(false);
62 #endif
63 ForeignWindowTextureFactory::Terminate();
64 content::ImageTransportFactory::Terminate();
65 }
66
67 void WmTestBase::RunAllPendingInMessageLoop() {
68 DCHECK(MessageLoopForUI::current() == &message_loop_);
69 ForeignTestWindowHost::RunAllPendingInMessageLoop();
70 }
71
72 } // namespace test
73 } // namespace wm
OLDNEW
« no previous file with comments | « wm/test/wm_test_base.h ('k') | wm/test/wm_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698