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

Unified Diff: ash/test/ash_test_base.cc

Issue 11421006: Desktop aura: Break aura::Window::SetParent in two. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ash_unittests Created 8 years, 1 month 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 | « ash/test/ash_test_base.h ('k') | ash/tooltips/tooltip_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/test/ash_test_base.cc
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index dc9590f1cde5d6bbf3c84b29b82b58f9a0c43d97..0280e61dcbafbb6605d9b76cd6a366b10ef2fb89 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -14,8 +14,11 @@
#include "ash/test/test_shell_delegate.h"
#include "base/run_loop.h"
#include "content/public/test/web_contents_tester.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/test/test_window_delegate.h"
+#include "ui/aura/window_delegate.h"
#include "ui/base/ime/text_input_test_support.h"
#include "ui/compositor/layer_animator.h"
#include "ui/gfx/display.h"
@@ -78,6 +81,54 @@ void AshTestBase::UpdateDisplay(const std::string& display_specs) {
display_manager_test_api.UpdateDisplay(display_specs);
}
+aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) {
+ return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect());
+}
+
+aura::Window* AshTestBase::CreateTestWindowInShellWithBounds(
+ const gfx::Rect& bounds) {
+ return CreateTestWindowInShellWithDelegate(NULL, 0, bounds);
+}
+
+aura::Window* AshTestBase::CreateTestWindowInShell(SkColor color,
+ int id,
+ const gfx::Rect& bounds) {
+ return CreateTestWindowInShellWithDelegate(
+ new aura::test::ColorTestWindowDelegate(color), id, bounds);
+}
+
+aura::Window* AshTestBase::CreateTestWindowInShellWithDelegate(
+ aura::WindowDelegate* delegate,
+ int id,
+ const gfx::Rect& bounds) {
+ return CreateTestWindowInShellWithDelegateAndType(
+ delegate,
+ aura::client::WINDOW_TYPE_NORMAL,
+ id,
+ bounds);
+}
+
+aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType(
+ aura::WindowDelegate* delegate,
+ aura::client::WindowType type,
+ int id,
+ const gfx::Rect& bounds) {
+ aura::Window* window = new aura::Window(delegate);
+ window->set_id(id);
+ window->SetType(type);
+ window->Init(ui::LAYER_TEXTURED);
+ window->SetBounds(bounds);
+ window->Show();
+ SetDefaultParentByPrimaryRootWindow(window);
+ window->SetProperty(aura::client::kCanMaximizeKey, true);
+ return window;
+}
+
+void AshTestBase::SetDefaultParentByPrimaryRootWindow(aura::Window* window) {
+ window->SetDefaultParentByRootWindow(
+ Shell::GetPrimaryRootWindow(), gfx::Rect());
+}
+
void AshTestBase::RunAllPendingInMessageLoop() {
#if !defined(OS_MACOSX)
DCHECK(MessageLoopForUI::current() == &message_loop_);
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/tooltips/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698