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

Unified Diff: ash/wm/workspace/workspace_layout_manager_unittest.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/wm/workspace/workspace_event_handler_unittest.cc ('k') | ash/wm/workspace/workspace_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_layout_manager_unittest.cc
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 698717a3cebb51f0eee20cd6190e0f0888bd6450..8a9754db0c908a229e523633773eb0942c018b50 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/wm/property_util.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/window_util.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
@@ -19,24 +20,14 @@ namespace ash {
namespace {
-class WorkspaceLayoutManagerTest : public test::AshTestBase {
- public:
- WorkspaceLayoutManagerTest() {}
- virtual ~WorkspaceLayoutManagerTest() {}
-
- aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
- return aura::test::CreateTestWindowWithBounds(bounds, NULL);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerTest);
-};
+typedef test::AshTestBase WorkspaceLayoutManagerTest;
// Verifies that a window containing a restore coordinate will be restored to
// to the size prior to minimize, keeping the restore rectangle in tact (if
// there is one).
TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) {
- scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4)));
+ scoped_ptr<aura::Window> window(
+ CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
gfx::Rect bounds(10, 15, 25, 35);
window->SetBounds(bounds);
SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100));
@@ -92,11 +83,12 @@ TEST_F(WorkspaceLayoutManagerTest, DontClobberRestoreBounds) {
// NOTE: for this test to exercise the failure the observer needs to be added
// before the parent set. This mimics what BrowserFrameAura does.
window->AddObserver(&window_observer);
- window->SetParent(NULL);
+ SetDefaultParentByPrimaryRootWindow(window.get());
window->Show();
ash::wm::ActivateWindow(window.get());
- scoped_ptr<aura::Window> window2(CreateTestWindow(gfx::Rect(12, 20, 30, 40)));
+ scoped_ptr<aura::Window> window2(
+ CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 30, 40)));
window->AddTransientChild(window2.get());
window2->Show();
@@ -109,7 +101,7 @@ TEST_F(WorkspaceLayoutManagerTest, DontClobberRestoreBounds) {
// Verifies when a window is maximized all descendant windows have a size.
TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) {
scoped_ptr<aura::Window> window(
- CreateTestWindow(gfx::Rect(10, 20, 30, 40)));
+ CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 30, 40)));
window->Show();
ash::wm::ActivateWindow(window.get());
scoped_ptr<aura::Window> child_window(
@@ -123,7 +115,8 @@ TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) {
TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) {
// Normal window bounds shouldn't be changed.
gfx::Rect window_bounds(100, 100, 200, 200);
- scoped_ptr<aura::Window> window(CreateTestWindow(window_bounds));
+ scoped_ptr<aura::Window> window(
+ CreateTestWindowInShellWithBounds(window_bounds));
EXPECT_EQ(window_bounds, window->bounds());
// If the window is out of the workspace, it would be moved on screen.
@@ -131,7 +124,8 @@ TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) {
ash::Shell::GetInstance()->GetPrimaryRootWindow()->bounds();
window_bounds.Offset(root_window_bounds.width(), root_window_bounds.height());
ASSERT_FALSE(window_bounds.Intersects(root_window_bounds));
- scoped_ptr<aura::Window> out_window(CreateTestWindow(window_bounds));
+ scoped_ptr<aura::Window> out_window(
+ CreateTestWindowInShellWithBounds(window_bounds));
EXPECT_EQ(window_bounds.size(), out_window->bounds().size());
EXPECT_TRUE(out_window->bounds().Intersects(root_window_bounds));
}
@@ -143,7 +137,8 @@ TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) {
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size());
const gfx::Rect window_bounds(
100, 101, work_area.width() + 1, work_area.height() + 2);
- scoped_ptr<aura::Window> window(CreateTestWindow(window_bounds));
+ scoped_ptr<aura::Window> window(
+ CreateTestWindowInShellWithBounds(window_bounds));
EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(),
window->bounds().ToString());
« no previous file with comments | « ash/wm/workspace/workspace_event_handler_unittest.cc ('k') | ash/wm/workspace/workspace_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698