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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « wm/test/wm_test_base.h ('k') | wm/test/wm_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: wm/test/wm_test_base.cc
diff --git a/wm/test/wm_test_base.cc b/wm/test/wm_test_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fe1bb6cb09079a3388e18156c274802c20dab717
--- /dev/null
+++ b/wm/test/wm_test_base.cc
@@ -0,0 +1,73 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "wm/test/wm_test_base.h"
+
+#include "ash/ash_switches.h"
+#include "base/command_line.h"
+#include "base/run_loop.h"
+#include "ui/aura/env.h"
+#include "ui/aura/root_window.h"
+#include "ui/base/ime/text_input_test_support.h"
+#include "ui/compositor/layer_animator.h"
+#include "wm/foreign_test_window.h"
+#include "wm/gpu/foreign_window_texture_factory.h"
+#include "wm/host/foreign_test_window_host.h"
+#include "wm/test/test_shell_delegate.h"
+
+namespace wm {
+namespace test {
+
+WmTestBase::WmTestBase() {
+}
+
+WmTestBase::~WmTestBase() {
+}
+
+void WmTestBase::SetUp() {
+ content::ImageTransportFactory::Initialize();
+ ForeignWindowTextureFactory::Initialize();
+ // Use the origin (1,1) so that it doesn't over
+ // lap with the native mouse cursor.
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ ash::switches::kAshHostWindowBounds, "1+1-800x600");
+#if defined(OS_WIN)
+ aura::test::SetUsePopupAsRootWindowForTest(true);
+#endif
+ // Disable animations during tests.
+ ui::LayerAnimator::set_disable_animations_for_test(true);
+ ui::TextInputTestSupport::Initialize();
+ // Creates Shell and hook with Desktop.
+ TestShellDelegate* delegate = new TestShellDelegate;
+ ash::Shell::CreateInstance(delegate);
+ ash::Shell::GetPrimaryRootWindow()->Show();
+ ash::Shell::GetPrimaryRootWindow()->ShowRootWindow();
+ // Move the mouse cursor to far away so that native events doesn't
+ // interfere test expectations.
+ ash::Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
+ ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
+}
+
+void WmTestBase::TearDown() {
+ // Flush the message loop to finish pending release tasks.
+ RunAllPendingInMessageLoop();
+
+ // Tear down the shell.
+ ash::Shell::DeleteInstance();
+ aura::Env::DeleteInstance();
+ ui::TextInputTestSupport::Shutdown();
+#if defined(OS_WIN)
+ aura::test::SetUsePopupAsRootWindowForTest(false);
+#endif
+ ForeignWindowTextureFactory::Terminate();
+ content::ImageTransportFactory::Terminate();
+}
+
+void WmTestBase::RunAllPendingInMessageLoop() {
+ DCHECK(MessageLoopForUI::current() == &message_loop_);
+ ForeignTestWindowHost::RunAllPendingInMessageLoop();
+}
+
+} // namespace test
+} // namespace wm
« 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