summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 21:21:51 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 21:21:51 +0000
commit60fa9bba51a44ade71a7d28199a90b655a2bec96 (patch)
tree6e12d8e2b4c2787e49f92ebb4fc76738da48318e
parent083823538f220a0374c061f787d16d5a7e623491 (diff)
downloadchromium_src-60fa9bba51a44ade71a7d28199a90b655a2bec96.zip
chromium_src-60fa9bba51a44ade71a7d28199a90b655a2bec96.tar.gz
chromium_src-60fa9bba51a44ade71a7d28199a90b655a2bec96.tar.bz2
Fixes bug where windows weren't being moved and resized if the desktop
size changed. BUG=none TEST=none R=oshima@chromium.org Review URL: http://codereview.chromium.org/8400067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107797 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/aura_shell/aura_shell.gyp2
-rw-r--r--ui/aura_shell/default_container_layout_manager.h14
-rw-r--r--ui/aura_shell/default_container_layout_manager_unittest.cc15
-rw-r--r--ui/aura_shell/shell.cc12
-rw-r--r--ui/aura_shell/shell.h7
-rw-r--r--ui/aura_shell/workspace/workspace.cc10
-rw-r--r--ui/aura_shell/workspace/workspace.h3
-rw-r--r--ui/aura_shell/workspace/workspace_controller.cc46
-rw-r--r--ui/aura_shell/workspace/workspace_controller.h56
-rw-r--r--ui/aura_shell/workspace/workspace_manager.cc36
-rw-r--r--ui/aura_shell/workspace/workspace_manager.h14
-rw-r--r--ui/aura_shell/workspace/workspace_manager_unittest.cc52
12 files changed, 189 insertions, 78 deletions
diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp
index 02df21a..743b832 100644
--- a/ui/aura_shell/aura_shell.gyp
+++ b/ui/aura_shell/aura_shell.gyp
@@ -68,6 +68,8 @@
'toplevel_frame_view.h',
'workspace/workspace.cc',
'workspace/workspace.h',
+ 'workspace/workspace_controller.cc',
+ 'workspace/workspace_controller.h',
'workspace/workspace_manager.cc',
'workspace/workspace_manager.h',
],
diff --git a/ui/aura_shell/default_container_layout_manager.h b/ui/aura_shell/default_container_layout_manager.h
index 53cd0d1..cf2fe9d 100644
--- a/ui/aura_shell/default_container_layout_manager.h
+++ b/ui/aura_shell/default_container_layout_manager.h
@@ -21,16 +21,16 @@ class Rect;
}
namespace aura_shell {
-class WorkspaceManager;
-
namespace internal {
+class WorkspaceManager;
+
// LayoutManager for the default window container.
class AURA_SHELL_EXPORT DefaultContainerLayoutManager
: public aura::LayoutManager {
public:
- DefaultContainerLayoutManager(
- aura::Window* owner, WorkspaceManager* workspace_manager);
+ DefaultContainerLayoutManager(aura::Window* owner,
+ WorkspaceManager* workspace_manager);
virtual ~DefaultContainerLayoutManager();
// Invoked when a window receives drag event.
@@ -48,6 +48,12 @@ class AURA_SHELL_EXPORT DefaultContainerLayoutManager
// Invoked when a user finished resizing window.
void EndResize(aura::Window* drag, aura::MouseEvent* evnet);
+ // If true, |CalculateBoundsForChild| does nothing. Use in situations where
+ // you want to circumvent what CalculateBoundsForChild() would normally do.
+ void set_ignore_calculate_bounds(bool value) {
+ ignore_calculate_bounds_ = value;
+ }
+
// Overridden from aura::LayoutManager:
virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAdded(aura::Window* child) OVERRIDE;
diff --git a/ui/aura_shell/default_container_layout_manager_unittest.cc b/ui/aura_shell/default_container_layout_manager_unittest.cc
index d53be63..deefc5a 100644
--- a/ui/aura_shell/default_container_layout_manager_unittest.cc
+++ b/ui/aura_shell/default_container_layout_manager_unittest.cc
@@ -11,7 +11,7 @@
#include "ui/aura/desktop.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/window.h"
-#include "ui/aura_shell/workspace/workspace_manager.h"
+#include "ui/aura_shell/workspace/workspace_controller.h"
#include "ui/base/view_prop.h"
#include "views/widget/native_widget_aura.h"
@@ -33,13 +33,10 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase {
aura::Desktop* desktop = aura::Desktop::GetInstance();
container_.reset(
CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop));
- workspace_manager_.reset(new WorkspaceManager(container_.get()));
+ workspace_controller_.reset(
+ new internal::WorkspaceController(container_.get()));
desktop->SetHostSize(gfx::Size(500, 400));
- default_container_layout_manager_ = new DefaultContainerLayoutManager(
- container_.get(), workspace_manager_.get());
- // draggable area is 0,0 500x400.
- container_->SetLayoutManager(default_container_layout_manager_);
}
aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds,
@@ -67,15 +64,13 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase {
aura::Window* container() { return container_.get(); }
DefaultContainerLayoutManager* default_container_layout_manager() {
- return default_container_layout_manager_;
+ return workspace_controller_->layout_manager();
}
-
private:
scoped_ptr<aura::Window> container_;
ScopedVector<ui::ViewProp> props_;
- scoped_ptr<aura_shell::WorkspaceManager> workspace_manager_;
- DefaultContainerLayoutManager* default_container_layout_manager_;
+ scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_;
DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest);
};
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc
index fdb992f..b0fe260 100644
--- a/ui/aura_shell/shell.cc
+++ b/ui/aura_shell/shell.cc
@@ -11,13 +11,12 @@
#include "ui/aura/window.h"
#include "ui/aura/window_types.h"
#include "ui/aura_shell/default_container_event_filter.h"
-#include "ui/aura_shell/default_container_layout_manager.h"
#include "ui/aura_shell/desktop_layout_manager.h"
#include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/shell_delegate.h"
#include "ui/aura_shell/shell_factory.h"
#include "ui/aura_shell/shell_window_ids.h"
-#include "ui/aura_shell/workspace/workspace_manager.h"
+#include "ui/aura_shell/workspace/workspace_controller.h"
#include "ui/base/view_prop.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
@@ -127,11 +126,8 @@ void Shell::Init() {
launcher_->widget()->GetWindowScreenBounds().height(),
kWorkAreaHorizontalMargin));
- // Workspace Manager
- workspace_manager_.reset(new WorkspaceManager(toplevel_container));
- toplevel_container->SetLayoutManager(
- new internal::DefaultContainerLayoutManager(
- toplevel_container, workspace_manager_.get()));
+ workspace_controller_.reset(
+ new internal::WorkspaceController(toplevel_container));
// Force a layout.
desktop_layout->OnWindowResized();
@@ -151,7 +147,7 @@ const aura::Window* Shell::GetContainer(int container_id) const {
}
void Shell::ToggleOverview() {
- workspace_manager_->SetOverview(!workspace_manager_->is_overview());
+ workspace_controller_->ToggleOverview();
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/ui/aura_shell/shell.h b/ui/aura_shell/shell.h
index c7a2700..36386b4 100644
--- a/ui/aura_shell/shell.h
+++ b/ui/aura_shell/shell.h
@@ -28,7 +28,10 @@ namespace aura_shell {
class Launcher;
class ShellDelegate;
-class WorkspaceManager;
+
+namespace internal {
+class WorkspaceController;
+}
// Shell is a singleton object that presents the Shell API and implements the
// Desktop's delegate interface.
@@ -73,7 +76,7 @@ class AURA_SHELL_EXPORT Shell : public aura::DesktopDelegate {
scoped_ptr<Launcher> launcher_;
- scoped_ptr<WorkspaceManager> workspace_manager_;
+ scoped_ptr<internal::WorkspaceController> workspace_controller_;
DISALLOW_COPY_AND_ASSIGN(Shell);
};
diff --git a/ui/aura_shell/workspace/workspace.cc b/ui/aura_shell/workspace/workspace.cc
index f661e92..083644d 100644
--- a/ui/aura_shell/workspace/workspace.cc
+++ b/ui/aura_shell/workspace/workspace.cc
@@ -4,6 +4,8 @@
#include "ui/aura_shell/workspace/workspace.h"
+#include <algorithm>
+
#include "base/logging.h"
#include "ui/aura/desktop.h"
#include "ui/aura/window.h"
@@ -20,6 +22,7 @@ size_t g_max_windows_per_workspace = 2;
}
namespace aura_shell {
+namespace internal {
Workspace::Workspace(WorkspaceManager* manager)
: workspace_manager_(manager) {
@@ -211,7 +214,11 @@ void Workspace::MoveWindowTo(
window->Maximize();
else {
gfx::Rect bounds = window->GetTargetBounds();
- bounds.set_origin(origin);
+ gfx::Rect work_area = GetWorkAreaBounds();
+ // Make sure the window isn't bigger than the workspace size.
+ bounds.SetRect(origin.x(), origin.y(),
+ std::min(work_area.width(), bounds.width()),
+ std::min(work_area.height(), bounds.height()));
if (animate) {
ui::LayerAnimator::ScopedSettings settings(
window->layer()->GetAnimator());
@@ -242,4 +249,5 @@ size_t Workspace::SetMaxWindowsCount(size_t max) {
return old;
}
+} // namespace internal
} // namespace aura_shell
diff --git a/ui/aura_shell/workspace/workspace.h b/ui/aura_shell/workspace/workspace.h
index d04060e..027b393 100644
--- a/ui/aura_shell/workspace/workspace.h
+++ b/ui/aura_shell/workspace/workspace.h
@@ -17,6 +17,8 @@ class Window;
}
namespace aura_shell {
+namespace internal {
+
class WorkspaceManager;
class WorkspaceTest;
@@ -128,6 +130,7 @@ class AURA_SHELL_EXPORT Workspace {
typedef std::vector<Workspace*> Workspaces;
+} // namespace internal
} // namespace aura_shell
#endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_
diff --git a/ui/aura_shell/workspace/workspace_controller.cc b/ui/aura_shell/workspace/workspace_controller.cc
new file mode 100644
index 0000000..e17228b
--- /dev/null
+++ b/ui/aura_shell/workspace/workspace_controller.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 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 "ui/aura_shell/workspace/workspace_controller.h"
+
+#include "ui/aura/desktop.h"
+#include "ui/aura/window.h"
+#include "ui/aura_shell/default_container_layout_manager.h"
+#include "ui/aura_shell/workspace/workspace.h"
+#include "ui/aura_shell/workspace/workspace_manager.h"
+
+namespace aura_shell {
+namespace internal {
+
+WorkspaceController::WorkspaceController(aura::Window* window)
+ : workspace_manager_(new WorkspaceManager(window)),
+ layout_manager_(new internal::DefaultContainerLayoutManager(
+ window, workspace_manager_.get())) {
+ window->SetLayoutManager(layout_manager_);
+ aura::Desktop::GetInstance()->AddObserver(this);
+}
+
+WorkspaceController::~WorkspaceController() {
+ aura::Desktop::GetInstance()->RemoveObserver(this);
+}
+
+void WorkspaceController::ToggleOverview() {
+ workspace_manager_->SetOverview(!workspace_manager_->is_overview());
+}
+
+void WorkspaceController::OnDesktopResized(const gfx::Size& new_size) {
+ layout_manager_->set_ignore_calculate_bounds(true);
+ workspace_manager_->SetWorkspaceSize(new_size);
+ layout_manager_->set_ignore_calculate_bounds(false);
+}
+
+void WorkspaceController::OnActiveWindowChanged(aura::Window* active) {
+ // FindBy handles NULL.
+ Workspace* workspace = workspace_manager_->FindBy(active);
+ if (workspace)
+ workspace->Activate();
+}
+
+} // namespace internal
+} // namespace aura_shell
diff --git a/ui/aura_shell/workspace/workspace_controller.h b/ui/aura_shell/workspace/workspace_controller.h
new file mode 100644
index 0000000..d928f96
--- /dev/null
+++ b/ui/aura_shell/workspace/workspace_controller.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_AURA_SHELL_WORKSPACE_WORKSPACE_CONTROLLER_H_
+#define UI_AURA_SHELL_WORKSPACE_WORKSPACE_CONTROLLER_H_
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/aura/desktop_observer.h"
+#include "ui/aura_shell/aura_shell_export.h"
+
+namespace aura {
+class Window;
+}
+
+namespace gfx {
+class Size;
+}
+
+namespace aura_shell {
+namespace internal {
+
+class DefaultContainerLayoutManager;
+class WorkspaceManager;
+
+// WorkspaceControlls owns a WorkspaceManager. WorkspaceControlls bridges
+// events From DesktopObserver translating them to WorkspaceManager.
+class AURA_SHELL_EXPORT WorkspaceController : public aura::DesktopObserver {
+ public:
+ explicit WorkspaceController(aura::Window* window);
+ virtual ~WorkspaceController();
+
+ void ToggleOverview();
+
+ internal::DefaultContainerLayoutManager* layout_manager() {
+ return layout_manager_;
+ }
+
+ // DesktopObserver overrides:
+ virtual void OnDesktopResized(const gfx::Size& new_size) OVERRIDE;
+ virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE;
+
+ private:
+ scoped_ptr<WorkspaceManager> workspace_manager_;
+
+ // This is owned by the window it's installed on.
+ internal::DefaultContainerLayoutManager* layout_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkspaceController);
+};
+
+} // namespace internal
+} // namespace aura_shell
+
+#endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_CONTROLLER_H_
diff --git a/ui/aura_shell/workspace/workspace_manager.cc b/ui/aura_shell/workspace/workspace_manager.cc
index c8904ea..aa777a4 100644
--- a/ui/aura_shell/workspace/workspace_manager.cc
+++ b/ui/aura_shell/workspace/workspace_manager.cc
@@ -1,22 +1,22 @@
// Copyright (c) 2011 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 "ui/aura_shell/workspace/workspace_manager.h"
#include <algorithm>
#include "base/auto_reset.h"
+#include "base/logging.h"
+#include "base/stl_util.h"
#include "ui/aura/desktop.h"
#include "ui/aura/screen_aura.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/workspace/workspace.h"
-#include "ui/aura_shell/workspace/workspace_manager.h"
-#include "ui/gfx/screen.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/compositor/layer_animator.h"
+#include "ui/gfx/screen.h"
#include "ui/gfx/transform.h"
-#include "base/logging.h"
-#include "base/stl_util.h"
namespace {
@@ -30,6 +30,7 @@ const float kMinOverviewScale = 0.3f;
}
namespace aura_shell {
+namespace internal {
////////////////////////////////////////////////////////////////////////////////
// WindowManager, public:
@@ -40,11 +41,9 @@ WorkspaceManager::WorkspaceManager(aura::Window* viewport)
workspace_size_(
gfx::Screen::GetMonitorAreaNearestWindow(viewport_).size()),
is_overview_(false) {
- aura::Desktop::GetInstance()->AddObserver(this);
}
WorkspaceManager::~WorkspaceManager() {
- aura::Desktop::GetInstance()->RemoveObserver(this);
std::vector<Workspace*> copy_to_delete(workspaces_);
STLDeleteElements(&copy_to_delete);
}
@@ -165,21 +164,13 @@ void WorkspaceManager::RotateWindows(aura::Window* source,
}
}
-////////////////////////////////////////////////////////////////////////////////
-// WorkspaceManager, Overridden from aura::DesktopObserver:
-
-void WorkspaceManager::OnDesktopResized(const gfx::Size& new_size) {
- workspace_size_ =
- gfx::Screen::GetMonitorAreaNearestWindow(viewport_).size();
+void WorkspaceManager::SetWorkspaceSize(const gfx::Size& workspace_size) {
+ if (workspace_size == workspace_size_)
+ return;
+ workspace_size_ = workspace_size;
LayoutWorkspaces();
}
-void WorkspaceManager::OnActiveWindowChanged(aura::Window* active) {
- Workspace* workspace = FindBy(active);
- if (workspace)
- SetActiveWorkspace(workspace);
-}
-
////////////////////////////////////////////////////////////////////////////////
// WorkspaceManager, private:
@@ -203,14 +194,10 @@ void WorkspaceManager::RemoveWorkspace(Workspace* workspace) {
}
void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) {
- DCHECK(std::find(workspaces_.begin(),
- workspaces_.end(),
- workspace)
- != workspaces_.end());
+ DCHECK(std::find(workspaces_.begin(), workspaces_.end(),
+ workspace) != workspaces_.end());
active_workspace_ = workspace;
- DCHECK(!workspaces_.empty());
-
is_overview_ = false;
UpdateViewport();
}
@@ -253,4 +240,5 @@ void WorkspaceManager::UpdateViewport() {
}
}
+} // namespace internal
} // namespace aura_shell
diff --git a/ui/aura_shell/workspace/workspace_manager.h b/ui/aura_shell/workspace/workspace_manager.h
index a9a7123..28cbab5 100644
--- a/ui/aura_shell/workspace/workspace_manager.h
+++ b/ui/aura_shell/workspace/workspace_manager.h
@@ -9,8 +9,6 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/gtest_prod_util.h"
-#include "ui/aura/desktop_observer.h"
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/size.h"
@@ -25,10 +23,11 @@ class Rect;
}
namespace aura_shell {
+namespace internal {
class Workspace;
// WorkspaceManager manages multiple workspaces in the desktop.
-class AURA_SHELL_EXPORT WorkspaceManager : public aura::DesktopObserver {
+class AURA_SHELL_EXPORT WorkspaceManager {
public:
explicit WorkspaceManager(aura::Window* viewport);
virtual ~WorkspaceManager();
@@ -60,15 +59,11 @@ class AURA_SHELL_EXPORT WorkspaceManager : public aura::DesktopObserver {
// Rotate windows by moving |source| window to the position of |target|.
void RotateWindows(aura::Window* source, aura::Window* target);
- // Overridden from aura::DesktopObserver:
- virtual void OnDesktopResized(const gfx::Size& new_size) OVERRIDE;
- virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE;
+ // Sets the size of a single workspace (all workspaces have the same size).
+ void SetWorkspaceSize(const gfx::Size& workspace_size);
private:
friend class Workspace;
- FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, Overview);
- FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, LayoutWorkspaces);
- FRIEND_TEST_ALL_PREFIXES(WorkspaceManagerTest, FindRotateWindow);
void AddWorkspace(Workspace* workspace);
void RemoveWorkspace(Workspace* workspace);
@@ -101,6 +96,7 @@ class AURA_SHELL_EXPORT WorkspaceManager : public aura::DesktopObserver {
DISALLOW_COPY_AND_ASSIGN(WorkspaceManager);
};
+} // namespace internal
} // namespace aura_shell
#endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_MANAGER_H_
diff --git a/ui/aura_shell/workspace/workspace_manager_unittest.cc b/ui/aura_shell/workspace/workspace_manager_unittest.cc
index 30d169b..8038884 100644
--- a/ui/aura_shell/workspace/workspace_manager_unittest.cc
+++ b/ui/aura_shell/workspace/workspace_manager_unittest.cc
@@ -2,16 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura_shell/workspace/workspace_manager.h"
#include "ui/aura_shell/workspace/workspace.h"
-
-#include "ui/aura/test/aura_test_base.h"
-#include "ui/aura/test/test_desktop_delegate.h"
+#include "ui/aura_shell/workspace/workspace_manager.h"
#include "ui/aura/desktop.h"
#include "ui/aura/screen_aura.h"
+#include "ui/aura/test/aura_test_base.h"
+#include "ui/aura/test/test_desktop_delegate.h"
#include "ui/aura/window.h"
-namespace {
+using aura::Window;
+
+namespace aura_shell {
+namespace internal {
class WorkspaceManagerTestBase : public aura::test::AuraTestBase {
public:
@@ -20,7 +22,7 @@ class WorkspaceManagerTestBase : public aura::test::AuraTestBase {
virtual void SetUp() OVERRIDE {
aura::test::AuraTestBase::SetUp();
- manager_.reset(new aura_shell::WorkspaceManager(viewport()));
+ manager_.reset(new WorkspaceManager(viewport()));
}
virtual void TearDown() OVERRIDE {
@@ -37,20 +39,12 @@ class WorkspaceManagerTestBase : public aura::test::AuraTestBase {
aura::Window* viewport() {
return GetTestDesktopDelegate()->default_container();
}
- scoped_ptr<aura_shell::WorkspaceManager> manager_;
+ scoped_ptr<WorkspaceManager> manager_;
private:
DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTestBase);
};
-} // namespace
-
-namespace aura_shell {
-
-using aura::Window;
-using aura_shell::Workspace;
-using aura_shell::WorkspaceManager;
-
class WorkspaceManagerTest : public WorkspaceManagerTestBase {
};
@@ -82,8 +76,7 @@ TEST_F(WorkspaceManagerTest, WorkspaceManagerCreateAddFind) {
}
TEST_F(WorkspaceManagerTest, LayoutWorkspaces) {
- manager_->workspace_size_ = gfx::Size(100, 100);
- manager_->LayoutWorkspaces();
+ manager_->SetWorkspaceSize(gfx::Size(100, 100));
EXPECT_EQ("0,0 100x100", viewport()->bounds().ToString());
Workspace* ws1 = manager_->CreateWorkspace();
@@ -102,6 +95,23 @@ TEST_F(WorkspaceManagerTest, LayoutWorkspaces) {
EXPECT_EQ("150,0 100x100", ws2->bounds().ToString());
}
+// Makes sure the bounds of window are resized if the workspace size shrinks.
+TEST_F(WorkspaceManagerTest, ResizeDuringLayout) {
+ manager_->SetWorkspaceSize(gfx::Size(100, 100));
+ EXPECT_EQ("0,0 100x100", viewport()->bounds().ToString());
+
+ Workspace* ws1 = manager_->CreateWorkspace();
+ scoped_ptr<Window> w1(CreateTestWindow());
+ w1->SetBounds(gfx::Rect(0, 0, 100, 100));
+ viewport()->AddChild(w1.get());
+ EXPECT_TRUE(ws1->AddWindowAfter(w1.get(), NULL));
+ manager_->SetWorkspaceSize(gfx::Size(50, 50));
+
+ // ws1 is laied out in left most position.
+ EXPECT_EQ("0,0 50x50", ws1->bounds().ToString());
+ EXPECT_EQ("0,0 50x50", w1->layer()->GetTargetBounds().ToString());
+}
+
TEST_F(WorkspaceManagerTest, WorkspaceManagerDragArea) {
aura::Desktop::GetInstance()->screen()->set_work_area_insets(
gfx::Insets(10, 10, 10, 10));
@@ -109,8 +119,9 @@ TEST_F(WorkspaceManagerTest, WorkspaceManagerDragArea) {
EXPECT_EQ("10,10 180x180", manager_->GetDragAreaBounds().ToString());
}
-TEST_F(WorkspaceManagerTest, Overview) {
- manager_->workspace_size_ = gfx::Size(500, 300);
+// TODO(sky): move this into a test for WorkspaceController.
+TEST_F(WorkspaceManagerTest, DISABLED_Overview) {
+ manager_->SetWorkspaceSize(gfx::Size(500, 300));
// Creating two workspaces, ws1 which contains window w1,
// and ws2 which contains window w2.
@@ -179,7 +190,7 @@ TEST_F(WorkspaceManagerTest, WorkspaceManagerActivate) {
}
TEST_F(WorkspaceManagerTest, FindRotateWindow) {
- manager_->workspace_size_ = gfx::Size(500, 300);
+ manager_->SetWorkspaceSize(gfx::Size(500, 300));
Workspace* ws1 = manager_->CreateWorkspace();
scoped_ptr<Window> w11(CreateTestWindow());
@@ -489,4 +500,5 @@ TEST_F(WorkspaceTest, ShiftWindowsMultiple) {
manager_.reset();
}
+} // namespace internal
} // namespace aura_shell