| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace/workspace_manager2.h" | 5 #include "ash/wm/workspace/workspace_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "ash/system/status_area_widget.h" | 12 #include "ash/system/status_area_widget.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/wm/activation_controller.h" | 14 #include "ash/wm/activation_controller.h" |
| 15 #include "ash/wm/property_util.h" | 15 #include "ash/wm/property_util.h" |
| 16 #include "ash/wm/shelf_layout_manager.h" | 16 #include "ash/wm/shelf_layout_manager.h" |
| 17 #include "ash/wm/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
| 18 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| 19 #include "ash/wm/workspace/workspace2.h" | 19 #include "ash/wm/workspace/workspace.h" |
| 20 #include "ash/wm/workspace_controller_test_helper.h" | 20 #include "ash/wm/workspace_controller_test_helper.h" |
| 21 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 22 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| 24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
| 25 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
| 26 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
| 27 #include "ui/aura/test/test_windows.h" | 27 #include "ui/aura/test/test_windows.h" |
| 28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 29 #include "ui/base/ui_base_types.h" | 29 #include "ui/base/ui_base_types.h" |
| 30 #include "ui/compositor/layer.h" | 30 #include "ui/compositor/layer.h" |
| 31 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 32 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 33 | 33 |
| 34 using aura::Window; | 34 using aura::Window; |
| 35 | 35 |
| 36 namespace ash { | 36 namespace ash { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 class WorkspaceManager2Test : public test::AshTestBase { | 39 class WorkspaceManagerTest : public test::AshTestBase { |
| 40 public: | 40 public: |
| 41 WorkspaceManager2Test() : manager_(NULL) {} | 41 WorkspaceManagerTest() : manager_(NULL) {} |
| 42 virtual ~WorkspaceManager2Test() {} | 42 virtual ~WorkspaceManagerTest() {} |
| 43 | 43 |
| 44 aura::Window* CreateTestWindowUnparented() { | 44 aura::Window* CreateTestWindowUnparented() { |
| 45 aura::Window* window = new aura::Window(NULL); | 45 aura::Window* window = new aura::Window(NULL); |
| 46 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 46 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 47 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 47 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
| 48 window->Init(ui::LAYER_TEXTURED); | 48 window->Init(ui::LAYER_TEXTURED); |
| 49 return window; | 49 return window; |
| 50 } | 50 } |
| 51 | 51 |
| 52 aura::Window* CreateTestWindow() { | 52 aura::Window* CreateTestWindow() { |
| 53 aura::Window* window = new aura::Window(NULL); | 53 aura::Window* window = new aura::Window(NULL); |
| 54 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 54 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 55 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 55 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
| 56 window->Init(ui::LAYER_TEXTURED); | 56 window->Init(ui::LAYER_TEXTURED); |
| 57 window->SetParent(NULL); | 57 window->SetParent(NULL); |
| 58 return window; | 58 return window; |
| 59 } | 59 } |
| 60 | 60 |
| 61 aura::Window* GetViewport() { | 61 aura::Window* GetViewport() { |
| 62 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 62 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| 63 kShellWindowId_DefaultContainer); | 63 kShellWindowId_DefaultContainer); |
| 64 } | 64 } |
| 65 | 65 |
| 66 const std::vector<Workspace2*>& workspaces() const { | 66 const std::vector<Workspace*>& workspaces() const { |
| 67 return manager_->workspaces_; | 67 return manager_->workspaces_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 gfx::Rect GetFullscreenBounds(aura::Window* window) { | 70 gfx::Rect GetFullscreenBounds(aura::Window* window) { |
| 71 return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds(); | 71 return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 Workspace2* active_workspace() { | 74 Workspace* active_workspace() { |
| 75 return manager_->active_workspace_; | 75 return manager_->active_workspace_; |
| 76 } | 76 } |
| 77 | 77 |
| 78 ShelfLayoutManager* shelf_layout_manager() { | 78 ShelfLayoutManager* shelf_layout_manager() { |
| 79 return Shell::GetPrimaryRootWindowController()->shelf(); | 79 return Shell::GetPrimaryRootWindowController()->shelf(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool GetWindowOverlapsShelf() { | 82 bool GetWindowOverlapsShelf() { |
| 83 return shelf_layout_manager()->window_overlaps_shelf(); | 83 return shelf_layout_manager()->window_overlaps_shelf(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 Workspace2* FindBy(aura::Window* window) const { | 86 Workspace* FindBy(aura::Window* window) const { |
| 87 return manager_->FindBy(window); | 87 return manager_->FindBy(window); |
| 88 } | 88 } |
| 89 | 89 |
| 90 std::string WorkspaceStateString(Workspace2* workspace) { | 90 std::string WorkspaceStateString(Workspace* workspace) { |
| 91 return (workspace->is_maximized() ? "M" : "") + | 91 return (workspace->is_maximized() ? "M" : "") + |
| 92 base::IntToString(static_cast<int>( | 92 base::IntToString(static_cast<int>( |
| 93 workspace->window()->children().size())); | 93 workspace->window()->children().size())); |
| 94 } | 94 } |
| 95 | 95 |
| 96 int active_index() { | 96 int active_index() { |
| 97 return static_cast<int>( | 97 return static_cast<int>( |
| 98 manager_->FindWorkspace(manager_->active_workspace_) - | 98 manager_->FindWorkspace(manager_->active_workspace_) - |
| 99 manager_->workspaces_.begin()); | 99 manager_->workspaces_.begin()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 std::string StateString() { | 102 std::string StateString() { |
| 103 std::string result; | 103 std::string result; |
| 104 for (size_t i = 0; i < manager_->workspaces_.size(); ++i) { | 104 for (size_t i = 0; i < manager_->workspaces_.size(); ++i) { |
| 105 if (i > 0) | 105 if (i > 0) |
| 106 result += " "; | 106 result += " "; |
| 107 result += WorkspaceStateString(manager_->workspaces_[i]); | 107 result += WorkspaceStateString(manager_->workspaces_[i]); |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (!manager_->pending_workspaces_.empty()) { | 110 if (!manager_->pending_workspaces_.empty()) { |
| 111 result += " P="; | 111 result += " P="; |
| 112 for (std::set<Workspace2*>::const_iterator i = | 112 for (std::set<Workspace*>::const_iterator i = |
| 113 manager_->pending_workspaces_.begin(); | 113 manager_->pending_workspaces_.begin(); |
| 114 i != manager_->pending_workspaces_.end(); ++i) { | 114 i != manager_->pending_workspaces_.end(); ++i) { |
| 115 if (i != manager_->pending_workspaces_.begin()) | 115 if (i != manager_->pending_workspaces_.begin()) |
| 116 result += " "; | 116 result += " "; |
| 117 result += WorkspaceStateString(*i); | 117 result += WorkspaceStateString(*i); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 result += " active=" + base::IntToString(active_index()); | 121 result += " active=" + base::IntToString(active_index()); |
| 122 return result; | 122 return result; |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Overridden from AshTestBase: | 125 // Overridden from AshTestBase: |
| 126 virtual void SetUp() OVERRIDE { | 126 virtual void SetUp() OVERRIDE { |
| 127 test::AshTestBase::SetUp(); | 127 test::AshTestBase::SetUp(); |
| 128 WorkspaceControllerTestHelper workspace_helper( | 128 WorkspaceControllerTestHelper workspace_helper( |
| 129 Shell::TestApi(Shell::GetInstance()).workspace_controller()); | 129 Shell::TestApi(Shell::GetInstance()).workspace_controller()); |
| 130 manager_ = workspace_helper.workspace_manager2(); | 130 manager_ = workspace_helper.workspace_manager(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 virtual void TearDown() OVERRIDE { | 133 virtual void TearDown() OVERRIDE { |
| 134 manager_ = NULL; | 134 manager_ = NULL; |
| 135 test::AshTestBase::TearDown(); | 135 test::AshTestBase::TearDown(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 protected: | 138 protected: |
| 139 WorkspaceManager2* manager_; | 139 WorkspaceManager* manager_; |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 scoped_ptr<ActivationController> activation_controller_; | 142 scoped_ptr<ActivationController> activation_controller_; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(WorkspaceManager2Test); | 144 DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTest); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 // Assertions around adding a normal window. | 147 // Assertions around adding a normal window. |
| 148 TEST_F(WorkspaceManager2Test, AddNormalWindowWhenEmpty) { | 148 TEST_F(WorkspaceManagerTest, AddNormalWindowWhenEmpty) { |
| 149 scoped_ptr<Window> w1(CreateTestWindow()); | 149 scoped_ptr<Window> w1(CreateTestWindow()); |
| 150 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 150 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 151 | 151 |
| 152 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL); | 152 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL); |
| 153 | 153 |
| 154 w1->Show(); | 154 w1->Show(); |
| 155 | 155 |
| 156 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL); | 156 EXPECT_TRUE(GetRestoreBoundsInScreen(w1.get()) == NULL); |
| 157 | 157 |
| 158 ASSERT_TRUE(w1->layer() != NULL); | 158 ASSERT_TRUE(w1->layer() != NULL); |
| 159 EXPECT_TRUE(w1->layer()->visible()); | 159 EXPECT_TRUE(w1->layer()->visible()); |
| 160 | 160 |
| 161 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); | 161 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); |
| 162 | 162 |
| 163 // Should be 1 workspace for the desktop, not maximized. | 163 // Should be 1 workspace for the desktop, not maximized. |
| 164 ASSERT_EQ("1 active=0", StateString()); | 164 ASSERT_EQ("1 active=0", StateString()); |
| 165 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); | 165 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Assertions around maximizing/unmaximizing. | 168 // Assertions around maximizing/unmaximizing. |
| 169 TEST_F(WorkspaceManager2Test, SingleMaximizeWindow) { | 169 TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) { |
| 170 scoped_ptr<Window> w1(CreateTestWindow()); | 170 scoped_ptr<Window> w1(CreateTestWindow()); |
| 171 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 171 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 172 | 172 |
| 173 w1->Show(); | 173 w1->Show(); |
| 174 wm::ActivateWindow(w1.get()); | 174 wm::ActivateWindow(w1.get()); |
| 175 | 175 |
| 176 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 176 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
| 177 | 177 |
| 178 ASSERT_TRUE(w1->layer() != NULL); | 178 ASSERT_TRUE(w1->layer() != NULL); |
| 179 EXPECT_TRUE(w1->layer()->visible()); | 179 EXPECT_TRUE(w1->layer()->visible()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 196 // Restore the window. | 196 // Restore the window. |
| 197 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 197 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 198 | 198 |
| 199 // Should be 1 workspace for the desktop. | 199 // Should be 1 workspace for the desktop. |
| 200 ASSERT_EQ("1 active=0", StateString()); | 200 ASSERT_EQ("1 active=0", StateString()); |
| 201 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); | 201 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); |
| 202 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); | 202 EXPECT_EQ("0,0 250x251", w1->bounds().ToString()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 // Assertions around closing the last window in a workspace. | 205 // Assertions around closing the last window in a workspace. |
| 206 TEST_F(WorkspaceManager2Test, CloseLastWindowInWorkspace) { | 206 TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) { |
| 207 scoped_ptr<Window> w1(CreateTestWindow()); | 207 scoped_ptr<Window> w1(CreateTestWindow()); |
| 208 scoped_ptr<Window> w2(CreateTestWindow()); | 208 scoped_ptr<Window> w2(CreateTestWindow()); |
| 209 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 209 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 210 w1->Show(); | 210 w1->Show(); |
| 211 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 211 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 212 w2->Show(); | 212 w2->Show(); |
| 213 wm::ActivateWindow(w1.get()); | 213 wm::ActivateWindow(w1.get()); |
| 214 | 214 |
| 215 // Should be 1 workspace and 1 pending, !maximized and maximized. The second | 215 // Should be 1 workspace and 1 pending, !maximized and maximized. The second |
| 216 // workspace is pending since the window wasn't active. | 216 // workspace is pending since the window wasn't active. |
| 217 ASSERT_EQ("1 P=M1 active=0", StateString()); | 217 ASSERT_EQ("1 P=M1 active=0", StateString()); |
| 218 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); | 218 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); |
| 219 | 219 |
| 220 // Close w2. | 220 // Close w2. |
| 221 w2.reset(); | 221 w2.reset(); |
| 222 | 222 |
| 223 // Should have one workspace. | 223 // Should have one workspace. |
| 224 ASSERT_EQ("1 active=0", StateString()); | 224 ASSERT_EQ("1 active=0", StateString()); |
| 225 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); | 225 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); |
| 226 EXPECT_TRUE(w1->IsVisible()); | 226 EXPECT_TRUE(w1->IsVisible()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 // Assertions around adding a maximized window when empty. | 229 // Assertions around adding a maximized window when empty. |
| 230 TEST_F(WorkspaceManager2Test, AddMaximizedWindowWhenEmpty) { | 230 TEST_F(WorkspaceManagerTest, AddMaximizedWindowWhenEmpty) { |
| 231 scoped_ptr<Window> w1(CreateTestWindow()); | 231 scoped_ptr<Window> w1(CreateTestWindow()); |
| 232 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 232 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 233 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 233 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 234 w1->Show(); | 234 w1->Show(); |
| 235 wm::ActivateWindow(w1.get()); | 235 wm::ActivateWindow(w1.get()); |
| 236 | 236 |
| 237 ASSERT_TRUE(w1->layer() != NULL); | 237 ASSERT_TRUE(w1->layer() != NULL); |
| 238 EXPECT_TRUE(w1->layer()->visible()); | 238 EXPECT_TRUE(w1->layer()->visible()); |
| 239 gfx::Rect work_area( | 239 gfx::Rect work_area( |
| 240 ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get())); | 240 ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get())); |
| 241 EXPECT_EQ(work_area.width(), w1->bounds().width()); | 241 EXPECT_EQ(work_area.width(), w1->bounds().width()); |
| 242 EXPECT_EQ(work_area.height(), w1->bounds().height()); | 242 EXPECT_EQ(work_area.height(), w1->bounds().height()); |
| 243 | 243 |
| 244 // Should be 2 workspaces (since we always keep the desktop). | 244 // Should be 2 workspaces (since we always keep the desktop). |
| 245 ASSERT_EQ("0 M1 active=1", StateString()); | 245 ASSERT_EQ("0 M1 active=1", StateString()); |
| 246 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); | 246 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); |
| 247 } | 247 } |
| 248 | 248 |
| 249 // Assertions around two windows and toggling one to be maximized. | 249 // Assertions around two windows and toggling one to be maximized. |
| 250 TEST_F(WorkspaceManager2Test, MaximizeWithNormalWindow) { | 250 TEST_F(WorkspaceManagerTest, MaximizeWithNormalWindow) { |
| 251 scoped_ptr<Window> w1(CreateTestWindow()); | 251 scoped_ptr<Window> w1(CreateTestWindow()); |
| 252 scoped_ptr<Window> w2(CreateTestWindow()); | 252 scoped_ptr<Window> w2(CreateTestWindow()); |
| 253 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 253 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 254 w1->Show(); | 254 w1->Show(); |
| 255 | 255 |
| 256 ASSERT_TRUE(w1->layer() != NULL); | 256 ASSERT_TRUE(w1->layer() != NULL); |
| 257 EXPECT_TRUE(w1->layer()->visible()); | 257 EXPECT_TRUE(w1->layer()->visible()); |
| 258 | 258 |
| 259 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); | 259 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); |
| 260 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 260 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 274 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 274 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 275 ASSERT_EQ("2 active=0", StateString()); | 275 ASSERT_EQ("2 active=0", StateString()); |
| 276 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); | 276 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); |
| 277 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[1]); | 277 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[1]); |
| 278 EXPECT_EQ(50, w2->bounds().width()); | 278 EXPECT_EQ(50, w2->bounds().width()); |
| 279 EXPECT_EQ(51, w2->bounds().height()); | 279 EXPECT_EQ(51, w2->bounds().height()); |
| 280 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); | 280 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); |
| 281 } | 281 } |
| 282 | 282 |
| 283 // Assertions around two maximized windows. | 283 // Assertions around two maximized windows. |
| 284 TEST_F(WorkspaceManager2Test, TwoMaximized) { | 284 TEST_F(WorkspaceManagerTest, TwoMaximized) { |
| 285 scoped_ptr<Window> w1(CreateTestWindow()); | 285 scoped_ptr<Window> w1(CreateTestWindow()); |
| 286 scoped_ptr<Window> w2(CreateTestWindow()); | 286 scoped_ptr<Window> w2(CreateTestWindow()); |
| 287 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 287 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 288 w1->Show(); | 288 w1->Show(); |
| 289 wm::ActivateWindow(w1.get()); | 289 wm::ActivateWindow(w1.get()); |
| 290 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 290 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 291 ASSERT_EQ("1 M1 active=1", StateString()); | 291 ASSERT_EQ("1 M1 active=1", StateString()); |
| 292 | 292 |
| 293 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); | 293 w2->SetBounds(gfx::Rect(0, 0, 50, 51)); |
| 294 w2->Show(); | 294 w2->Show(); |
| 295 wm::ActivateWindow(w2.get()); | 295 wm::ActivateWindow(w2.get()); |
| 296 ASSERT_EQ("1 M1 active=0", StateString()); | 296 ASSERT_EQ("1 M1 active=0", StateString()); |
| 297 | 297 |
| 298 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 298 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 299 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); | 299 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); |
| 300 ASSERT_EQ("0 M1 M1 active=2", StateString()); | 300 ASSERT_EQ("0 M1 M1 active=2", StateString()); |
| 301 | 301 |
| 302 // The last stacked window (|w2|) should be last since it was maximized last. | 302 // The last stacked window (|w2|) should be last since it was maximized last. |
| 303 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); | 303 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); |
| 304 EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]); | 304 EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]); |
| 305 } | 305 } |
| 306 | 306 |
| 307 // Makes sure requests to change the bounds of a normal window go through. | 307 // Makes sure requests to change the bounds of a normal window go through. |
| 308 TEST_F(WorkspaceManager2Test, ChangeBoundsOfNormalWindow) { | 308 TEST_F(WorkspaceManagerTest, ChangeBoundsOfNormalWindow) { |
| 309 scoped_ptr<Window> w1(CreateTestWindow()); | 309 scoped_ptr<Window> w1(CreateTestWindow()); |
| 310 w1->Show(); | 310 w1->Show(); |
| 311 | 311 |
| 312 // Setting the bounds should go through since the window is in the normal | 312 // Setting the bounds should go through since the window is in the normal |
| 313 // workspace. | 313 // workspace. |
| 314 w1->SetBounds(gfx::Rect(0, 0, 200, 500)); | 314 w1->SetBounds(gfx::Rect(0, 0, 200, 500)); |
| 315 EXPECT_EQ(200, w1->bounds().width()); | 315 EXPECT_EQ(200, w1->bounds().width()); |
| 316 EXPECT_EQ(500, w1->bounds().height()); | 316 EXPECT_EQ(500, w1->bounds().height()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 // Verifies the bounds is not altered when showing and grid is enabled. | 319 // Verifies the bounds is not altered when showing and grid is enabled. |
| 320 TEST_F(WorkspaceManager2Test, SnapToGrid) { | 320 TEST_F(WorkspaceManagerTest, SnapToGrid) { |
| 321 scoped_ptr<Window> w1(CreateTestWindowUnparented()); | 321 scoped_ptr<Window> w1(CreateTestWindowUnparented()); |
| 322 w1->SetBounds(gfx::Rect(1, 6, 25, 30)); | 322 w1->SetBounds(gfx::Rect(1, 6, 25, 30)); |
| 323 w1->SetParent(NULL); | 323 w1->SetParent(NULL); |
| 324 // We are not aligning this anymore this way. When the window gets shown | 324 // We are not aligning this anymore this way. When the window gets shown |
| 325 // the window is expected to be handled differently, but this cannot be | 325 // the window is expected to be handled differently, but this cannot be |
| 326 // tested with this test. So the result of this test should be that the | 326 // tested with this test. So the result of this test should be that the |
| 327 // bounds are exactly as passed in. | 327 // bounds are exactly as passed in. |
| 328 EXPECT_EQ("1,6 25x30", w1->bounds().ToString()); | 328 EXPECT_EQ("1,6 25x30", w1->bounds().ToString()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 // Assertions around a fullscreen window. | 331 // Assertions around a fullscreen window. |
| 332 TEST_F(WorkspaceManager2Test, SingleFullscreenWindow) { | 332 TEST_F(WorkspaceManagerTest, SingleFullscreenWindow) { |
| 333 scoped_ptr<Window> w1(CreateTestWindow()); | 333 scoped_ptr<Window> w1(CreateTestWindow()); |
| 334 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 334 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 335 // Make the window fullscreen. | 335 // Make the window fullscreen. |
| 336 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 336 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 337 w1->Show(); | 337 w1->Show(); |
| 338 wm::ActivateWindow(w1.get()); | 338 wm::ActivateWindow(w1.get()); |
| 339 | 339 |
| 340 // Should be 2 workspaces, normal and maximized. | 340 // Should be 2 workspaces, normal and maximized. |
| 341 ASSERT_EQ("0 M1 active=1", StateString()); | 341 ASSERT_EQ("0 M1 active=1", StateString()); |
| 342 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); | 342 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 358 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 358 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 359 ASSERT_EQ("0 M1 active=1", StateString()); | 359 ASSERT_EQ("0 M1 active=1", StateString()); |
| 360 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); | 360 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); |
| 361 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width()); | 361 EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width()); |
| 362 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height()); | 362 EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height()); |
| 363 ASSERT_TRUE(GetRestoreBoundsInScreen(w1.get())); | 363 ASSERT_TRUE(GetRestoreBoundsInScreen(w1.get())); |
| 364 EXPECT_EQ("0,0 250x251", GetRestoreBoundsInScreen(w1.get())->ToString()); | 364 EXPECT_EQ("0,0 250x251", GetRestoreBoundsInScreen(w1.get())->ToString()); |
| 365 } | 365 } |
| 366 | 366 |
| 367 // Makes sure switching workspaces doesn't show transient windows. | 367 // Makes sure switching workspaces doesn't show transient windows. |
| 368 TEST_F(WorkspaceManager2Test, DontShowTransientsOnSwitch) { | 368 TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) { |
| 369 scoped_ptr<Window> w1(CreateTestWindow()); | 369 scoped_ptr<Window> w1(CreateTestWindow()); |
| 370 scoped_ptr<Window> w2(CreateTestWindow()); | 370 scoped_ptr<Window> w2(CreateTestWindow()); |
| 371 | 371 |
| 372 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); | 372 w1->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 373 w2->SetBounds(gfx::Rect(0, 0, 250, 251)); | 373 w2->SetBounds(gfx::Rect(0, 0, 250, 251)); |
| 374 w1->AddTransientChild(w2.get()); | 374 w1->AddTransientChild(w2.get()); |
| 375 | 375 |
| 376 w1->Show(); | 376 w1->Show(); |
| 377 | 377 |
| 378 scoped_ptr<Window> w3(CreateTestWindow()); | 378 scoped_ptr<Window> w3(CreateTestWindow()); |
| 379 w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 379 w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 380 w3->Show(); | 380 w3->Show(); |
| 381 wm::ActivateWindow(w3.get()); | 381 wm::ActivateWindow(w3.get()); |
| 382 | 382 |
| 383 EXPECT_FALSE(w1->layer()->IsDrawn()); | 383 EXPECT_FALSE(w1->layer()->IsDrawn()); |
| 384 EXPECT_FALSE(w2->layer()->IsDrawn()); | 384 EXPECT_FALSE(w2->layer()->IsDrawn()); |
| 385 EXPECT_TRUE(w3->layer()->IsDrawn()); | 385 EXPECT_TRUE(w3->layer()->IsDrawn()); |
| 386 | 386 |
| 387 wm::ActivateWindow(w1.get()); | 387 wm::ActivateWindow(w1.get()); |
| 388 EXPECT_TRUE(w1->layer()->IsDrawn()); | 388 EXPECT_TRUE(w1->layer()->IsDrawn()); |
| 389 EXPECT_FALSE(w2->layer()->IsDrawn()); | 389 EXPECT_FALSE(w2->layer()->IsDrawn()); |
| 390 EXPECT_FALSE(w3->layer()->IsDrawn()); | 390 EXPECT_FALSE(w3->layer()->IsDrawn()); |
| 391 } | 391 } |
| 392 | 392 |
| 393 // Assertions around minimizing a single window. | 393 // Assertions around minimizing a single window. |
| 394 TEST_F(WorkspaceManager2Test, MinimizeSingleWindow) { | 394 TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) { |
| 395 scoped_ptr<Window> w1(CreateTestWindow()); | 395 scoped_ptr<Window> w1(CreateTestWindow()); |
| 396 | 396 |
| 397 w1->Show(); | 397 w1->Show(); |
| 398 ASSERT_EQ("1 active=0", StateString()); | 398 ASSERT_EQ("1 active=0", StateString()); |
| 399 | 399 |
| 400 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 400 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 401 ASSERT_EQ("1 active=0", StateString()); | 401 ASSERT_EQ("1 active=0", StateString()); |
| 402 EXPECT_FALSE(w1->layer()->IsDrawn()); | 402 EXPECT_FALSE(w1->layer()->IsDrawn()); |
| 403 | 403 |
| 404 // Show the window. | 404 // Show the window. |
| 405 w1->Show(); | 405 w1->Show(); |
| 406 EXPECT_TRUE(wm::IsWindowNormal(w1.get())); | 406 EXPECT_TRUE(wm::IsWindowNormal(w1.get())); |
| 407 ASSERT_EQ("1 active=0", StateString()); | 407 ASSERT_EQ("1 active=0", StateString()); |
| 408 EXPECT_TRUE(w1->layer()->IsDrawn()); | 408 EXPECT_TRUE(w1->layer()->IsDrawn()); |
| 409 } | 409 } |
| 410 | 410 |
| 411 // Assertions around minimizing a maximized window. | 411 // Assertions around minimizing a maximized window. |
| 412 TEST_F(WorkspaceManager2Test, MinimizeMaximizedWindow) { | 412 TEST_F(WorkspaceManagerTest, MinimizeMaximizedWindow) { |
| 413 // Two windows, w1 normal, w2 maximized. | 413 // Two windows, w1 normal, w2 maximized. |
| 414 scoped_ptr<Window> w1(CreateTestWindow()); | 414 scoped_ptr<Window> w1(CreateTestWindow()); |
| 415 scoped_ptr<Window> w2(CreateTestWindow()); | 415 scoped_ptr<Window> w2(CreateTestWindow()); |
| 416 w1->Show(); | 416 w1->Show(); |
| 417 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 417 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 418 w2->Show(); | 418 w2->Show(); |
| 419 wm::ActivateWindow(w2.get()); | 419 wm::ActivateWindow(w2.get()); |
| 420 ASSERT_EQ("1 M1 active=1", StateString()); | 420 ASSERT_EQ("1 M1 active=1", StateString()); |
| 421 | 421 |
| 422 // Minimize w2. | 422 // Minimize w2. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 446 // Make the window normal. | 446 // Make the window normal. |
| 447 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 447 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 448 ASSERT_EQ("2 active=0", StateString()); | 448 ASSERT_EQ("2 active=0", StateString()); |
| 449 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); | 449 EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]); |
| 450 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[1]); | 450 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[1]); |
| 451 EXPECT_TRUE(w2->layer()->IsDrawn()); | 451 EXPECT_TRUE(w2->layer()->IsDrawn()); |
| 452 } | 452 } |
| 453 | 453 |
| 454 // Verifies ShelfLayoutManager's visibility/auto-hide state is correctly | 454 // Verifies ShelfLayoutManager's visibility/auto-hide state is correctly |
| 455 // updated. | 455 // updated. |
| 456 TEST_F(WorkspaceManager2Test, ShelfStateUpdated) { | 456 TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { |
| 457 // Since ShelfLayoutManager queries for mouse location, move the mouse so | 457 // Since ShelfLayoutManager queries for mouse location, move the mouse so |
| 458 // it isn't over the shelf. | 458 // it isn't over the shelf. |
| 459 aura::test::EventGenerator generator( | 459 aura::test::EventGenerator generator( |
| 460 Shell::GetPrimaryRootWindow(), gfx::Point()); | 460 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 461 generator.MoveMouseTo(0, 0); | 461 generator.MoveMouseTo(0, 0); |
| 462 | 462 |
| 463 scoped_ptr<Window> w1(CreateTestWindow()); | 463 scoped_ptr<Window> w1(CreateTestWindow()); |
| 464 const gfx::Rect w1_bounds(0, 1, 101, 102); | 464 const gfx::Rect w1_bounds(0, 1, 101, 102); |
| 465 ShelfLayoutManager* shelf = shelf_layout_manager(); | 465 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 466 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 466 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 // the window isn't in the visible workspace. | 577 // the window isn't in the visible workspace. |
| 578 w1->SetBounds(touches_shelf_bounds); | 578 w1->SetBounds(touches_shelf_bounds); |
| 579 EXPECT_FALSE(GetWindowOverlapsShelf()); | 579 EXPECT_FALSE(GetWindowOverlapsShelf()); |
| 580 | 580 |
| 581 // Activate w1. Since w1 is visible the overlap state should be true. | 581 // Activate w1. Since w1 is visible the overlap state should be true. |
| 582 wm::ActivateWindow(w1.get()); | 582 wm::ActivateWindow(w1.get()); |
| 583 EXPECT_TRUE(GetWindowOverlapsShelf()); | 583 EXPECT_TRUE(GetWindowOverlapsShelf()); |
| 584 } | 584 } |
| 585 | 585 |
| 586 // Verifies persist across all workspaces. | 586 // Verifies persist across all workspaces. |
| 587 TEST_F(WorkspaceManager2Test, PersistAcrossAllWorkspaces) { | 587 TEST_F(WorkspaceManagerTest, PersistAcrossAllWorkspaces) { |
| 588 // Create a maximized window. | 588 // Create a maximized window. |
| 589 scoped_ptr<Window> w1(CreateTestWindow()); | 589 scoped_ptr<Window> w1(CreateTestWindow()); |
| 590 w1->Show(); | 590 w1->Show(); |
| 591 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 591 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 592 wm::ActivateWindow(w1.get()); | 592 wm::ActivateWindow(w1.get()); |
| 593 ASSERT_EQ("0 M1 active=1", StateString()); | 593 ASSERT_EQ("0 M1 active=1", StateString()); |
| 594 | 594 |
| 595 // Create a window that persists across all workspaces. It should be placed in | 595 // Create a window that persists across all workspaces. It should be placed in |
| 596 // the current maximized workspace. | 596 // the current maximized workspace. |
| 597 scoped_ptr<Window> w2(CreateTestWindow()); | 597 scoped_ptr<Window> w2(CreateTestWindow()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 624 ASSERT_EQ("1 P=M1 active=0", StateString()); | 624 ASSERT_EQ("1 P=M1 active=0", StateString()); |
| 625 wm::ActivateWindow(w2.get()); | 625 wm::ActivateWindow(w2.get()); |
| 626 ASSERT_EQ("1 P=M1 active=0", StateString()); | 626 ASSERT_EQ("1 P=M1 active=0", StateString()); |
| 627 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 627 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 628 ASSERT_EQ("1 P=M1 active=0", StateString()); | 628 ASSERT_EQ("1 P=M1 active=0", StateString()); |
| 629 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]); | 629 EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]); |
| 630 } | 630 } |
| 631 | 631 |
| 632 // Verifies that when a window persists across all workpaces is activated that | 632 // Verifies that when a window persists across all workpaces is activated that |
| 633 // it moves to the current workspace. | 633 // it moves to the current workspace. |
| 634 TEST_F(WorkspaceManager2Test, ActivatePersistAcrossAllWorkspacesWhenNotActive) { | 634 TEST_F(WorkspaceManagerTest, ActivatePersistAcrossAllWorkspacesWhenNotActive) { |
| 635 // Create a window that persists across all workspaces. | 635 // Create a window that persists across all workspaces. |
| 636 scoped_ptr<Window> w2(CreateTestWindow()); | 636 scoped_ptr<Window> w2(CreateTestWindow()); |
| 637 SetPersistsAcrossAllWorkspaces( | 637 SetPersistsAcrossAllWorkspaces( |
| 638 w2.get(), | 638 w2.get(), |
| 639 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); | 639 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); |
| 640 w2->Show(); | 640 w2->Show(); |
| 641 ASSERT_EQ("1 active=0", StateString()); | 641 ASSERT_EQ("1 active=0", StateString()); |
| 642 | 642 |
| 643 // Create a maximized window. | 643 // Create a maximized window. |
| 644 scoped_ptr<Window> w1(CreateTestWindow()); | 644 scoped_ptr<Window> w1(CreateTestWindow()); |
| 645 w1->Show(); | 645 w1->Show(); |
| 646 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 646 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 647 wm::ActivateWindow(w1.get()); | 647 wm::ActivateWindow(w1.get()); |
| 648 ASSERT_EQ("1 M1 active=1", StateString()); | 648 ASSERT_EQ("1 M1 active=1", StateString()); |
| 649 | 649 |
| 650 // Activate the persists across all workspace window. It should move to the | 650 // Activate the persists across all workspace window. It should move to the |
| 651 // current workspace. | 651 // current workspace. |
| 652 wm::ActivateWindow(w2.get()); | 652 wm::ActivateWindow(w2.get()); |
| 653 ASSERT_EQ("0 M2 active=1", StateString()); | 653 ASSERT_EQ("0 M2 active=1", StateString()); |
| 654 // The window that persists across all workspaces should be moved to the top | 654 // The window that persists across all workspaces should be moved to the top |
| 655 // of the stacking order. | 655 // of the stacking order. |
| 656 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); | 656 EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]); |
| 657 EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[1]); | 657 EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[1]); |
| 658 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); | 658 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); |
| 659 } | 659 } |
| 660 | 660 |
| 661 // Verifies Show()ing a minimized window that persists across all workspaces | 661 // Verifies Show()ing a minimized window that persists across all workspaces |
| 662 // unminimizes the window. | 662 // unminimizes the window. |
| 663 TEST_F(WorkspaceManager2Test, ShowMinimizedPersistWindow) { | 663 TEST_F(WorkspaceManagerTest, ShowMinimizedPersistWindow) { |
| 664 // Create a window that persists across all workspaces. | 664 // Create a window that persists across all workspaces. |
| 665 scoped_ptr<Window> w1(CreateTestWindow()); | 665 scoped_ptr<Window> w1(CreateTestWindow()); |
| 666 SetPersistsAcrossAllWorkspaces( | 666 SetPersistsAcrossAllWorkspaces( |
| 667 w1.get(), | 667 w1.get(), |
| 668 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); | 668 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); |
| 669 w1->Show(); | 669 w1->Show(); |
| 670 wm::ActivateWindow(w1.get()); | 670 wm::ActivateWindow(w1.get()); |
| 671 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 671 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 672 EXPECT_FALSE(w1->IsVisible()); | 672 EXPECT_FALSE(w1->IsVisible()); |
| 673 w1->Show(); | 673 w1->Show(); |
| 674 EXPECT_TRUE(w1->IsVisible()); | 674 EXPECT_TRUE(w1->IsVisible()); |
| 675 } | 675 } |
| 676 | 676 |
| 677 // Test that we report we're in the fullscreen state even if the fullscreen | 677 // Test that we report we're in the fullscreen state even if the fullscreen |
| 678 // window isn't being managed by us (http://crbug.com/123931). | 678 // window isn't being managed by us (http://crbug.com/123931). |
| 679 TEST_F(WorkspaceManager2Test, GetWindowStateWithUnmanagedFullscreenWindow) { | 679 TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) { |
| 680 ShelfLayoutManager* shelf = shelf_layout_manager(); | 680 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 681 | 681 |
| 682 // We need to create a regular window first so there's an active workspace. | 682 // We need to create a regular window first so there's an active workspace. |
| 683 scoped_ptr<Window> w1(CreateTestWindow()); | 683 scoped_ptr<Window> w1(CreateTestWindow()); |
| 684 w1->Show(); | 684 w1->Show(); |
| 685 | 685 |
| 686 scoped_ptr<Window> w2(CreateTestWindow()); | 686 scoped_ptr<Window> w2(CreateTestWindow()); |
| 687 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 687 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 688 SetPersistsAcrossAllWorkspaces( | 688 SetPersistsAcrossAllWorkspaces( |
| 689 w2.get(), | 689 w2.get(), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 711 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState()); | 711 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState()); |
| 712 | 712 |
| 713 w2.reset(); | 713 w2.reset(); |
| 714 ASSERT_EQ("1 active=0", StateString()); | 714 ASSERT_EQ("1 active=0", StateString()); |
| 715 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 715 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 716 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); | 716 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); |
| 717 } | 717 } |
| 718 | 718 |
| 719 // Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized | 719 // Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized |
| 720 // window rather than a normal window. | 720 // window rather than a normal window. |
| 721 TEST_F(WorkspaceManager2Test, | 721 TEST_F(WorkspaceManagerTest, |
| 722 GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) { | 722 GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) { |
| 723 ShelfLayoutManager* shelf = shelf_layout_manager(); | 723 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 724 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 724 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 725 | 725 |
| 726 // Make the first window maximized. | 726 // Make the first window maximized. |
| 727 scoped_ptr<Window> w1(CreateTestWindow()); | 727 scoped_ptr<Window> w1(CreateTestWindow()); |
| 728 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 728 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 729 w1->Show(); | 729 w1->Show(); |
| 730 | 730 |
| 731 scoped_ptr<Window> w2(CreateTestWindow()); | 731 scoped_ptr<Window> w2(CreateTestWindow()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 750 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); | 750 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); |
| 751 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, | 751 EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, |
| 752 manager_->GetWindowState()); | 752 manager_->GetWindowState()); |
| 753 | 753 |
| 754 w2.reset(); | 754 w2.reset(); |
| 755 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 755 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 756 } | 756 } |
| 757 | 757 |
| 758 // Verifies a window marked as persisting across all workspaces ends up in its | 758 // Verifies a window marked as persisting across all workspaces ends up in its |
| 759 // own workspace when maximized. | 759 // own workspace when maximized. |
| 760 TEST_F(WorkspaceManager2Test, MaximizeDontPersistEndsUpInOwnWorkspace) { | 760 TEST_F(WorkspaceManagerTest, MaximizeDontPersistEndsUpInOwnWorkspace) { |
| 761 scoped_ptr<Window> w1(CreateTestWindow()); | 761 scoped_ptr<Window> w1(CreateTestWindow()); |
| 762 | 762 |
| 763 SetPersistsAcrossAllWorkspaces( | 763 SetPersistsAcrossAllWorkspaces( |
| 764 w1.get(), | 764 w1.get(), |
| 765 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); | 765 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); |
| 766 w1->Show(); | 766 w1->Show(); |
| 767 | 767 |
| 768 ASSERT_EQ("1 active=0", StateString()); | 768 ASSERT_EQ("1 active=0", StateString()); |
| 769 | 769 |
| 770 // Maximize should trigger containing the window. | 770 // Maximize should trigger containing the window. |
| 771 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 771 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 772 ASSERT_EQ("0 P=M1 active=0", StateString()); | 772 ASSERT_EQ("0 P=M1 active=0", StateString()); |
| 773 | 773 |
| 774 // And resetting to normal should remove it. | 774 // And resetting to normal should remove it. |
| 775 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 775 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 776 ASSERT_EQ("1 active=0", StateString()); | 776 ASSERT_EQ("1 active=0", StateString()); |
| 777 } | 777 } |
| 778 | 778 |
| 779 // Verifies going from maximized to minimized sets the right state for painting | 779 // Verifies going from maximized to minimized sets the right state for painting |
| 780 // the background of the launcher. | 780 // the background of the launcher. |
| 781 TEST_F(WorkspaceManager2Test, MinimizeResetsVisibility) { | 781 TEST_F(WorkspaceManagerTest, MinimizeResetsVisibility) { |
| 782 scoped_ptr<Window> w1(CreateTestWindow()); | 782 scoped_ptr<Window> w1(CreateTestWindow()); |
| 783 w1->Show(); | 783 w1->Show(); |
| 784 wm::ActivateWindow(w1.get()); | 784 wm::ActivateWindow(w1.get()); |
| 785 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 785 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 786 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 786 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 787 EXPECT_EQ(ShelfLayoutManager::VISIBLE, | 787 EXPECT_EQ(ShelfLayoutManager::VISIBLE, |
| 788 shelf_layout_manager()->visibility_state()); | 788 shelf_layout_manager()->visibility_state()); |
| 789 EXPECT_FALSE(Launcher::ForPrimaryDisplay()->paints_background()); | 789 EXPECT_FALSE(Launcher::ForPrimaryDisplay()->paints_background()); |
| 790 } | 790 } |
| 791 | 791 |
| 792 // Verifies transients are moved when maximizing. | 792 // Verifies transients are moved when maximizing. |
| 793 TEST_F(WorkspaceManager2Test, MoveTransientOnMaximize) { | 793 TEST_F(WorkspaceManagerTest, MoveTransientOnMaximize) { |
| 794 scoped_ptr<Window> w1(CreateTestWindow()); | 794 scoped_ptr<Window> w1(CreateTestWindow()); |
| 795 w1->Show(); | 795 w1->Show(); |
| 796 scoped_ptr<Window> w2(CreateTestWindow()); | 796 scoped_ptr<Window> w2(CreateTestWindow()); |
| 797 w1->AddTransientChild(w2.get()); | 797 w1->AddTransientChild(w2.get()); |
| 798 w2->Show(); | 798 w2->Show(); |
| 799 wm::ActivateWindow(w1.get()); | 799 wm::ActivateWindow(w1.get()); |
| 800 ASSERT_EQ("2 active=0", StateString()); | 800 ASSERT_EQ("2 active=0", StateString()); |
| 801 | 801 |
| 802 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 802 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 803 ASSERT_EQ("0 M2 active=1", StateString()); | 803 ASSERT_EQ("0 M2 active=1", StateString()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 816 // up in pending. | 816 // up in pending. |
| 817 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 817 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 818 ASSERT_EQ("0 P=M3 active=0", StateString()); | 818 ASSERT_EQ("0 P=M3 active=0", StateString()); |
| 819 | 819 |
| 820 // Restore and everything should go back to the first workspace. | 820 // Restore and everything should go back to the first workspace. |
| 821 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 821 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 822 ASSERT_EQ("3 active=0", StateString()); | 822 ASSERT_EQ("3 active=0", StateString()); |
| 823 } | 823 } |
| 824 | 824 |
| 825 // Verifies window visibility during various workspace changes. | 825 // Verifies window visibility during various workspace changes. |
| 826 TEST_F(WorkspaceManager2Test, VisibilityTests) { | 826 TEST_F(WorkspaceManagerTest, VisibilityTests) { |
| 827 scoped_ptr<Window> w1(CreateTestWindow()); | 827 scoped_ptr<Window> w1(CreateTestWindow()); |
| 828 w1->Show(); | 828 w1->Show(); |
| 829 EXPECT_TRUE(w1->IsVisible()); | 829 EXPECT_TRUE(w1->IsVisible()); |
| 830 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); | 830 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); |
| 831 | 831 |
| 832 // Create another window, activate it and maximized it. | 832 // Create another window, activate it and maximized it. |
| 833 scoped_ptr<Window> w2(CreateTestWindow()); | 833 scoped_ptr<Window> w2(CreateTestWindow()); |
| 834 w2->Show(); | 834 w2->Show(); |
| 835 wm::ActivateWindow(w2.get()); | 835 wm::ActivateWindow(w2.get()); |
| 836 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 836 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); | 873 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); |
| 874 EXPECT_FALSE(w1->IsVisible()); | 874 EXPECT_FALSE(w1->IsVisible()); |
| 875 | 875 |
| 876 // Close |w2|. | 876 // Close |w2|. |
| 877 w2.reset(); | 877 w2.reset(); |
| 878 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); | 878 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); |
| 879 EXPECT_TRUE(w1->IsVisible()); | 879 EXPECT_TRUE(w1->IsVisible()); |
| 880 } | 880 } |
| 881 | 881 |
| 882 // Verifies windows that are offscreen don't move when switching workspaces. | 882 // Verifies windows that are offscreen don't move when switching workspaces. |
| 883 TEST_F(WorkspaceManager2Test, DontMoveOnSwitch) { | 883 TEST_F(WorkspaceManagerTest, DontMoveOnSwitch) { |
| 884 aura::test::EventGenerator generator( | 884 aura::test::EventGenerator generator( |
| 885 Shell::GetPrimaryRootWindow(), gfx::Point()); | 885 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 886 generator.MoveMouseTo(0, 0); | 886 generator.MoveMouseTo(0, 0); |
| 887 | 887 |
| 888 scoped_ptr<Window> w1(CreateTestWindow()); | 888 scoped_ptr<Window> w1(CreateTestWindow()); |
| 889 ShelfLayoutManager* shelf = shelf_layout_manager(); | 889 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 890 const gfx::Rect touches_shelf_bounds( | 890 const gfx::Rect touches_shelf_bounds( |
| 891 0, shelf->GetIdealBounds().y() - 10, 101, 102); | 891 0, shelf->GetIdealBounds().y() - 10, 101, 102); |
| 892 // Move |w1| to overlap the shelf. | 892 // Move |w1| to overlap the shelf. |
| 893 w1->SetBounds(touches_shelf_bounds); | 893 w1->SetBounds(touches_shelf_bounds); |
| 894 w1->Show(); | 894 w1->Show(); |
| 895 wm::ActivateWindow(w1.get()); | 895 wm::ActivateWindow(w1.get()); |
| 896 | 896 |
| 897 // Create another window and maximize it. | 897 // Create another window and maximize it. |
| 898 scoped_ptr<Window> w2(CreateTestWindow()); | 898 scoped_ptr<Window> w2(CreateTestWindow()); |
| 899 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 899 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 900 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 900 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 901 w2->Show(); | 901 w2->Show(); |
| 902 wm::ActivateWindow(w2.get()); | 902 wm::ActivateWindow(w2.get()); |
| 903 | 903 |
| 904 // Switch to w1. | 904 // Switch to w1. |
| 905 wm::ActivateWindow(w1.get()); | 905 wm::ActivateWindow(w1.get()); |
| 906 EXPECT_EQ(touches_shelf_bounds.ToString(), w1->bounds().ToString()); | 906 EXPECT_EQ(touches_shelf_bounds.ToString(), w1->bounds().ToString()); |
| 907 } | 907 } |
| 908 | 908 |
| 909 // Verifies that windows that are completely offscreen move when switching | 909 // Verifies that windows that are completely offscreen move when switching |
| 910 // workspaces. | 910 // workspaces. |
| 911 TEST_F(WorkspaceManager2Test, MoveOnSwitch) { | 911 TEST_F(WorkspaceManagerTest, MoveOnSwitch) { |
| 912 aura::test::EventGenerator generator( | 912 aura::test::EventGenerator generator( |
| 913 Shell::GetPrimaryRootWindow(), gfx::Point()); | 913 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 914 generator.MoveMouseTo(0, 0); | 914 generator.MoveMouseTo(0, 0); |
| 915 | 915 |
| 916 scoped_ptr<Window> w1(CreateTestWindow()); | 916 scoped_ptr<Window> w1(CreateTestWindow()); |
| 917 ShelfLayoutManager* shelf = shelf_layout_manager(); | 917 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 918 const gfx::Rect w1_bounds(0, shelf->GetIdealBounds().y(), 100, 200); | 918 const gfx::Rect w1_bounds(0, shelf->GetIdealBounds().y(), 100, 200); |
| 919 // Move |w1| so that the top edge is the same as the top edge of the shelf. | 919 // Move |w1| so that the top edge is the same as the top edge of the shelf. |
| 920 w1->SetBounds(w1_bounds); | 920 w1->SetBounds(w1_bounds); |
| 921 w1->Show(); | 921 w1->Show(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 934 gfx::Size size(shelf->status_area_widget()->GetWindowBoundsInScreen().size()); | 934 gfx::Size size(shelf->status_area_widget()->GetWindowBoundsInScreen().size()); |
| 935 size.Enlarge(0, 30); | 935 size.Enlarge(0, 30); |
| 936 shelf->status_area_widget()->SetSize(size); | 936 shelf->status_area_widget()->SetSize(size); |
| 937 | 937 |
| 938 // Switch to w1. The window should have moved. | 938 // Switch to w1. The window should have moved. |
| 939 wm::ActivateWindow(w1.get()); | 939 wm::ActivateWindow(w1.get()); |
| 940 EXPECT_NE(w1_bounds.ToString(), w1->bounds().ToString()); | 940 EXPECT_NE(w1_bounds.ToString(), w1->bounds().ToString()); |
| 941 } | 941 } |
| 942 | 942 |
| 943 // Verifies Focus() works in a window that isn't in the active workspace. | 943 // Verifies Focus() works in a window that isn't in the active workspace. |
| 944 TEST_F(WorkspaceManager2Test, FocusOnFullscreenInSeparateWorkspace) { | 944 TEST_F(WorkspaceManagerTest, FocusOnFullscreenInSeparateWorkspace) { |
| 945 scoped_ptr<Window> w1(CreateTestWindow()); | 945 scoped_ptr<Window> w1(CreateTestWindow()); |
| 946 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); | 946 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 947 w1->Show(); | 947 w1->Show(); |
| 948 wm::ActivateWindow(w1.get()); | 948 wm::ActivateWindow(w1.get()); |
| 949 | 949 |
| 950 scoped_ptr<Window> w2(CreateTestWindow()); | 950 scoped_ptr<Window> w2(CreateTestWindow()); |
| 951 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 951 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 952 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 952 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 953 w2->Show(); | 953 w2->Show(); |
| 954 EXPECT_FALSE(w2->IsVisible()); | 954 EXPECT_FALSE(w2->IsVisible()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 985 DISALLOW_COPY_AND_ASSIGN(DontCrashOnChangeAndActivateDelegate); | 985 DISALLOW_COPY_AND_ASSIGN(DontCrashOnChangeAndActivateDelegate); |
| 986 }; | 986 }; |
| 987 | 987 |
| 988 } // namespace | 988 } // namespace |
| 989 | 989 |
| 990 // Exercises possible crash in W2. Here's the sequence: | 990 // Exercises possible crash in W2. Here's the sequence: |
| 991 // . minimize a maximized window. | 991 // . minimize a maximized window. |
| 992 // . remove the window (which happens when switching displays). | 992 // . remove the window (which happens when switching displays). |
| 993 // . add the window back. | 993 // . add the window back. |
| 994 // . show the window and during the bounds change activate it. | 994 // . show the window and during the bounds change activate it. |
| 995 TEST_F(WorkspaceManager2Test, DontCrashOnChangeAndActivate) { | 995 TEST_F(WorkspaceManagerTest, DontCrashOnChangeAndActivate) { |
| 996 // Force the shelf | 996 // Force the shelf |
| 997 ShelfLayoutManager* shelf = shelf_layout_manager(); | 997 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 998 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 998 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 999 | 999 |
| 1000 DontCrashOnChangeAndActivateDelegate delegate; | 1000 DontCrashOnChangeAndActivateDelegate delegate; |
| 1001 scoped_ptr<Window> w1( | 1001 scoped_ptr<Window> w1( |
| 1002 CreateTestWindowWithDelegate(&delegate, 1000, gfx::Rect(10, 11, 250, 251), | 1002 CreateTestWindowWithDelegate(&delegate, 1000, gfx::Rect(10, 11, 250, 251), |
| 1003 NULL)); | 1003 NULL)); |
| 1004 w1->Show(); | 1004 w1->Show(); |
| 1005 wm::ActivateWindow(w1.get()); | 1005 wm::ActivateWindow(w1.get()); |
| 1006 wm::MaximizeWindow(w1.get()); | 1006 wm::MaximizeWindow(w1.get()); |
| 1007 wm::MinimizeWindow(w1.get()); | 1007 wm::MinimizeWindow(w1.get()); |
| 1008 | 1008 |
| 1009 w1->parent()->RemoveChild(w1.get()); | 1009 w1->parent()->RemoveChild(w1.get()); |
| 1010 | 1010 |
| 1011 // Do this so that when we Show() the window a resize occurs and we make the | 1011 // Do this so that when we Show() the window a resize occurs and we make the |
| 1012 // window active. | 1012 // window active. |
| 1013 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1013 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1014 | 1014 |
| 1015 w1->SetParent(NULL); | 1015 w1->SetParent(NULL); |
| 1016 delegate.set_window(w1.get()); | 1016 delegate.set_window(w1.get()); |
| 1017 w1->Show(); | 1017 w1->Show(); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 // Verifies a window with a transient parent not managed by workspace works. | 1020 // Verifies a window with a transient parent not managed by workspace works. |
| 1021 TEST_F(WorkspaceManager2Test, TransientParent) { | 1021 TEST_F(WorkspaceManagerTest, TransientParent) { |
| 1022 // Normal window with no transient parent. | 1022 // Normal window with no transient parent. |
| 1023 scoped_ptr<Window> w2(CreateTestWindow()); | 1023 scoped_ptr<Window> w2(CreateTestWindow()); |
| 1024 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 1024 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 1025 w2->Show(); | 1025 w2->Show(); |
| 1026 wm::ActivateWindow(w2.get()); | 1026 wm::ActivateWindow(w2.get()); |
| 1027 | 1027 |
| 1028 // Window with a transient parent. We set the transient parent to the root, | 1028 // Window with a transient parent. We set the transient parent to the root, |
| 1029 // which would never happen but is enough to exercise the bug. | 1029 // which would never happen but is enough to exercise the bug. |
| 1030 scoped_ptr<Window> w1(CreateTestWindowUnparented()); | 1030 scoped_ptr<Window> w1(CreateTestWindowUnparented()); |
| 1031 Shell::GetInstance()->GetPrimaryRootWindow()->AddTransientChild(w1.get()); | 1031 Shell::GetInstance()->GetPrimaryRootWindow()->AddTransientChild(w1.get()); |
| 1032 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); | 1032 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 1033 w1->SetParent(NULL); | 1033 w1->SetParent(NULL); |
| 1034 w1->Show(); | 1034 w1->Show(); |
| 1035 wm::ActivateWindow(w1.get()); | 1035 wm::ActivateWindow(w1.get()); |
| 1036 | 1036 |
| 1037 // The window with the transient parent should get added to the same parent as | 1037 // The window with the transient parent should get added to the same parent as |
| 1038 // the normal window. | 1038 // the normal window. |
| 1039 EXPECT_EQ(w2->parent(), w1->parent()); | 1039 EXPECT_EQ(w2->parent(), w1->parent()); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 // Verifies changing TrackedByWorkspace works. | 1042 // Verifies changing TrackedByWorkspace works. |
| 1043 TEST_F(WorkspaceManager2Test, TrackedByWorkspace) { | 1043 TEST_F(WorkspaceManagerTest, TrackedByWorkspace) { |
| 1044 // Create a window maximized. | 1044 // Create a window maximized. |
| 1045 scoped_ptr<Window> w1(CreateTestWindow()); | 1045 scoped_ptr<Window> w1(CreateTestWindow()); |
| 1046 w1->Show(); | 1046 w1->Show(); |
| 1047 wm::ActivateWindow(w1.get()); | 1047 wm::ActivateWindow(w1.get()); |
| 1048 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 1048 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1049 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 1049 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
| 1050 EXPECT_TRUE(w1->IsVisible()); | 1050 EXPECT_TRUE(w1->IsVisible()); |
| 1051 | 1051 |
| 1052 // Create a second window maximized and mark it not tracked by workspace | 1052 // Create a second window maximized and mark it not tracked by workspace |
| 1053 // manager. | 1053 // manager. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1075 // workspace. | 1075 // workspace. |
| 1076 SetTrackedByWorkspace(w2.get(), true); | 1076 SetTrackedByWorkspace(w2.get(), true); |
| 1077 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); | 1077 EXPECT_TRUE(wm::IsActiveWindow(w2.get())); |
| 1078 EXPECT_FALSE(w1->IsVisible()); | 1078 EXPECT_FALSE(w1->IsVisible()); |
| 1079 EXPECT_TRUE(w2->IsVisible()); | 1079 EXPECT_TRUE(w2->IsVisible()); |
| 1080 EXPECT_NE(w1->parent(), w2->parent()); | 1080 EXPECT_NE(w1->parent(), w2->parent()); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 // Verifies a window marked as persisting across all workspaces ends up in its | 1083 // Verifies a window marked as persisting across all workspaces ends up in its |
| 1084 // own workspace when maximized. | 1084 // own workspace when maximized. |
| 1085 TEST_F(WorkspaceManager2Test, DeactivateDropsToDesktop) { | 1085 TEST_F(WorkspaceManagerTest, DeactivateDropsToDesktop) { |
| 1086 // Create a window maximized. | 1086 // Create a window maximized. |
| 1087 scoped_ptr<Window> w1(CreateTestWindow()); | 1087 scoped_ptr<Window> w1(CreateTestWindow()); |
| 1088 w1->Show(); | 1088 w1->Show(); |
| 1089 wm::ActivateWindow(w1.get()); | 1089 wm::ActivateWindow(w1.get()); |
| 1090 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 1090 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1091 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 1091 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
| 1092 EXPECT_TRUE(w1->IsVisible()); | 1092 EXPECT_TRUE(w1->IsVisible()); |
| 1093 | 1093 |
| 1094 // Create another window that persists across all workspaces. It should end | 1094 // Create another window that persists across all workspaces. It should end |
| 1095 // up with the same parent as |w1|. | 1095 // up with the same parent as |w1|. |
| 1096 scoped_ptr<Window> w2(CreateTestWindow()); | 1096 scoped_ptr<Window> w2(CreateTestWindow()); |
| 1097 SetPersistsAcrossAllWorkspaces( | 1097 SetPersistsAcrossAllWorkspaces( |
| 1098 w2.get(), | 1098 w2.get(), |
| 1099 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); | 1099 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); |
| 1100 w2->Show(); | 1100 w2->Show(); |
| 1101 wm::ActivateWindow(w2.get()); | 1101 wm::ActivateWindow(w2.get()); |
| 1102 EXPECT_EQ(w1->parent(), w2->parent()); | 1102 EXPECT_EQ(w1->parent(), w2->parent()); |
| 1103 ASSERT_EQ("0 M2 active=1", StateString()); | 1103 ASSERT_EQ("0 M2 active=1", StateString()); |
| 1104 | 1104 |
| 1105 // Activate |w1|, should result in dropping |w2| to the desktop. | 1105 // Activate |w1|, should result in dropping |w2| to the desktop. |
| 1106 wm::ActivateWindow(w1.get()); | 1106 wm::ActivateWindow(w1.get()); |
| 1107 ASSERT_EQ("1 M1 active=1", StateString()); | 1107 ASSERT_EQ("1 M1 active=1", StateString()); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 // Test the basic auto placement of one and or two windows in a "simulated | 1110 // Test the basic auto placement of one and or two windows in a "simulated |
| 1111 // session" of sequential window operations. | 1111 // session" of sequential window operations. |
| 1112 TEST_F(WorkspaceManager2Test, BasicAutoPlacing) { | 1112 TEST_F(WorkspaceManagerTest, BasicAutoPlacing) { |
| 1113 // Test 1: In case there is no manageable window, no window should shift. | 1113 // Test 1: In case there is no manageable window, no window should shift. |
| 1114 | 1114 |
| 1115 scoped_ptr<aura::Window> window1( | 1115 scoped_ptr<aura::Window> window1( |
| 1116 aura::test::CreateTestWindowWithId(0, NULL)); | 1116 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1117 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); | 1117 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 1118 gfx::Rect desktop_area = window1->parent()->bounds(); | 1118 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1119 | 1119 |
| 1120 scoped_ptr<aura::Window> window2( | 1120 scoped_ptr<aura::Window> window2( |
| 1121 aura::test::CreateTestWindowWithId(1, NULL)); | 1121 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1122 // Trigger the auto window placement function by making it visible. | 1122 // Trigger the auto window placement function by making it visible. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 window1->Hide(); | 1181 window1->Hide(); |
| 1182 window1->Show(); | 1182 window1->Show(); |
| 1183 // |window1| should be centered. | 1183 // |window1| should be centered. |
| 1184 EXPECT_EQ( | 1184 EXPECT_EQ( |
| 1185 base::IntToString( | 1185 base::IntToString( |
| 1186 (desktop_area.width() - window1->bounds().width()) / 2) + | 1186 (desktop_area.width() - window1->bounds().width()) / 2) + |
| 1187 ",32 640x320", window1->bounds().ToString()); | 1187 ",32 640x320", window1->bounds().ToString()); |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 // Test the proper usage of user window movement interaction. | 1190 // Test the proper usage of user window movement interaction. |
| 1191 TEST_F(WorkspaceManager2Test, TestUserMovedWindowRepositioning) { | 1191 TEST_F(WorkspaceManagerTest, TestUserMovedWindowRepositioning) { |
| 1192 scoped_ptr<aura::Window> window1( | 1192 scoped_ptr<aura::Window> window1( |
| 1193 aura::test::CreateTestWindowWithId(0, NULL)); | 1193 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1194 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); | 1194 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 1195 gfx::Rect desktop_area = window1->parent()->bounds(); | 1195 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1196 scoped_ptr<aura::Window> window2( | 1196 scoped_ptr<aura::Window> window2( |
| 1197 aura::test::CreateTestWindowWithId(1, NULL)); | 1197 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1198 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); | 1198 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); |
| 1199 window1->Hide(); | 1199 window1->Hide(); |
| 1200 window2->Hide(); | 1200 window2->Hide(); |
| 1201 ash::wm::SetWindowPositionManaged(window1.get(), true); | 1201 ash::wm::SetWindowPositionManaged(window1.get(), true); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1228 // Going back to one shown window should keep the state. | 1228 // Going back to one shown window should keep the state. |
| 1229 ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), true); | 1229 ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), true); |
| 1230 window2->Hide(); | 1230 window2->Hide(); |
| 1231 EXPECT_EQ(base::IntToString( | 1231 EXPECT_EQ(base::IntToString( |
| 1232 desktop_area.width() - window1->bounds().width()) + | 1232 desktop_area.width() - window1->bounds().width()) + |
| 1233 ",32 640x320", window1->bounds().ToString()); | 1233 ",32 640x320", window1->bounds().ToString()); |
| 1234 EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); | 1234 EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); |
| 1235 } | 1235 } |
| 1236 | 1236 |
| 1237 // Test that a window from normal to minimize will repos the remaining. | 1237 // Test that a window from normal to minimize will repos the remaining. |
| 1238 TEST_F(WorkspaceManager2Test, ToMinimizeRepositionsRemaining) { | 1238 TEST_F(WorkspaceManagerTest, ToMinimizeRepositionsRemaining) { |
| 1239 scoped_ptr<aura::Window> window1( | 1239 scoped_ptr<aura::Window> window1( |
| 1240 aura::test::CreateTestWindowWithId(0, NULL)); | 1240 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1241 ash::wm::SetWindowPositionManaged(window1.get(), true); | 1241 ash::wm::SetWindowPositionManaged(window1.get(), true); |
| 1242 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); | 1242 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 1243 gfx::Rect desktop_area = window1->parent()->bounds(); | 1243 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1244 | 1244 |
| 1245 scoped_ptr<aura::Window> window2( | 1245 scoped_ptr<aura::Window> window2( |
| 1246 aura::test::CreateTestWindowWithId(1, NULL)); | 1246 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1247 ash::wm::SetWindowPositionManaged(window2.get(), true); | 1247 ash::wm::SetWindowPositionManaged(window2.get(), true); |
| 1248 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); | 1248 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); |
| 1249 | 1249 |
| 1250 ash::wm::MinimizeWindow(window1.get()); | 1250 ash::wm::MinimizeWindow(window1.get()); |
| 1251 | 1251 |
| 1252 // |window2| should be centered now. | 1252 // |window2| should be centered now. |
| 1253 EXPECT_TRUE(window2->IsVisible()); | 1253 EXPECT_TRUE(window2->IsVisible()); |
| 1254 EXPECT_TRUE(ash::wm::IsWindowNormal(window2.get())); | 1254 EXPECT_TRUE(ash::wm::IsWindowNormal(window2.get())); |
| 1255 EXPECT_EQ(base::IntToString( | 1255 EXPECT_EQ(base::IntToString( |
| 1256 (desktop_area.width() - window2->bounds().width()) / 2) + | 1256 (desktop_area.width() - window2->bounds().width()) / 2) + |
| 1257 ",48 256x512", window2->bounds().ToString()); | 1257 ",48 256x512", window2->bounds().ToString()); |
| 1258 | 1258 |
| 1259 ash::wm::RestoreWindow(window1.get()); | 1259 ash::wm::RestoreWindow(window1.get()); |
| 1260 // |window1| should be flush right and |window3| flush left. | 1260 // |window1| should be flush right and |window3| flush left. |
| 1261 EXPECT_EQ(base::IntToString( | 1261 EXPECT_EQ(base::IntToString( |
| 1262 desktop_area.width() - window1->bounds().width()) + | 1262 desktop_area.width() - window1->bounds().width()) + |
| 1263 ",32 640x320", window1->bounds().ToString()); | 1263 ",32 640x320", window1->bounds().ToString()); |
| 1264 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); | 1264 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 // Test that minimizing an initially maximized window will repos the remaining. | 1267 // Test that minimizing an initially maximized window will repos the remaining. |
| 1268 TEST_F(WorkspaceManager2Test, MaxToMinRepositionsRemaining) { | 1268 TEST_F(WorkspaceManagerTest, MaxToMinRepositionsRemaining) { |
| 1269 scoped_ptr<aura::Window> window1( | 1269 scoped_ptr<aura::Window> window1( |
| 1270 aura::test::CreateTestWindowWithId(0, NULL)); | 1270 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1271 ash::wm::SetWindowPositionManaged(window1.get(), true); | 1271 ash::wm::SetWindowPositionManaged(window1.get(), true); |
| 1272 gfx::Rect desktop_area = window1->parent()->bounds(); | 1272 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1273 | 1273 |
| 1274 scoped_ptr<aura::Window> window2( | 1274 scoped_ptr<aura::Window> window2( |
| 1275 aura::test::CreateTestWindowWithId(1, NULL)); | 1275 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1276 ash::wm::SetWindowPositionManaged(window2.get(), true); | 1276 ash::wm::SetWindowPositionManaged(window2.get(), true); |
| 1277 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); | 1277 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); |
| 1278 | 1278 |
| 1279 ash::wm::MaximizeWindow(window1.get()); | 1279 ash::wm::MaximizeWindow(window1.get()); |
| 1280 ash::wm::MinimizeWindow(window1.get()); | 1280 ash::wm::MinimizeWindow(window1.get()); |
| 1281 | 1281 |
| 1282 // |window2| should be centered now. | 1282 // |window2| should be centered now. |
| 1283 EXPECT_TRUE(window2->IsVisible()); | 1283 EXPECT_TRUE(window2->IsVisible()); |
| 1284 EXPECT_TRUE(ash::wm::IsWindowNormal(window2.get())); | 1284 EXPECT_TRUE(ash::wm::IsWindowNormal(window2.get())); |
| 1285 EXPECT_EQ(base::IntToString( | 1285 EXPECT_EQ(base::IntToString( |
| 1286 (desktop_area.width() - window2->bounds().width()) / 2) + | 1286 (desktop_area.width() - window2->bounds().width()) / 2) + |
| 1287 ",48 256x512", window2->bounds().ToString()); | 1287 ",48 256x512", window2->bounds().ToString()); |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 // Test that nomral, maximize, minimizing will repos the remaining. | 1290 // Test that nomral, maximize, minimizing will repos the remaining. |
| 1291 TEST_F(WorkspaceManager2Test, NormToMaxToMinRepositionsRemaining) { | 1291 TEST_F(WorkspaceManagerTest, NormToMaxToMinRepositionsRemaining) { |
| 1292 scoped_ptr<aura::Window> window1( | 1292 scoped_ptr<aura::Window> window1( |
| 1293 aura::test::CreateTestWindowWithId(0, NULL)); | 1293 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1294 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); | 1294 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 1295 ash::wm::SetWindowPositionManaged(window1.get(), true); | 1295 ash::wm::SetWindowPositionManaged(window1.get(), true); |
| 1296 gfx::Rect desktop_area = window1->parent()->bounds(); | 1296 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1297 | 1297 |
| 1298 scoped_ptr<aura::Window> window2( | 1298 scoped_ptr<aura::Window> window2( |
| 1299 aura::test::CreateTestWindowWithId(1, NULL)); | 1299 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1300 ash::wm::SetWindowPositionManaged(window2.get(), true); | 1300 ash::wm::SetWindowPositionManaged(window2.get(), true); |
| 1301 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); | 1301 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1315 | 1315 |
| 1316 // |window2| should be centered now. | 1316 // |window2| should be centered now. |
| 1317 EXPECT_TRUE(window2->IsVisible()); | 1317 EXPECT_TRUE(window2->IsVisible()); |
| 1318 EXPECT_TRUE(ash::wm::IsWindowNormal(window2.get())); | 1318 EXPECT_TRUE(ash::wm::IsWindowNormal(window2.get())); |
| 1319 EXPECT_EQ(base::IntToString( | 1319 EXPECT_EQ(base::IntToString( |
| 1320 (desktop_area.width() - window2->bounds().width()) / 2) + | 1320 (desktop_area.width() - window2->bounds().width()) / 2) + |
| 1321 ",48 256x512", window2->bounds().ToString()); | 1321 ",48 256x512", window2->bounds().ToString()); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 // Test that nomral, maximize, normal will repos the remaining. | 1324 // Test that nomral, maximize, normal will repos the remaining. |
| 1325 TEST_F(WorkspaceManager2Test, NormToMaxToNormRepositionsRemaining) { | 1325 TEST_F(WorkspaceManagerTest, NormToMaxToNormRepositionsRemaining) { |
| 1326 scoped_ptr<aura::Window> window1( | 1326 scoped_ptr<aura::Window> window1( |
| 1327 aura::test::CreateTestWindowWithId(0, NULL)); | 1327 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1328 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); | 1328 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 1329 ash::wm::SetWindowPositionManaged(window1.get(), true); | 1329 ash::wm::SetWindowPositionManaged(window1.get(), true); |
| 1330 gfx::Rect desktop_area = window1->parent()->bounds(); | 1330 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1331 | 1331 |
| 1332 scoped_ptr<aura::Window> window2( | 1332 scoped_ptr<aura::Window> window2( |
| 1333 aura::test::CreateTestWindowWithId(1, NULL)); | 1333 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1334 ash::wm::SetWindowPositionManaged(window2.get(), true); | 1334 ash::wm::SetWindowPositionManaged(window2.get(), true); |
| 1335 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); | 1335 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1348 ash::wm::RestoreWindow(window1.get()); | 1348 ash::wm::RestoreWindow(window1.get()); |
| 1349 | 1349 |
| 1350 // |window1| should be flush right and |window2| flush left. | 1350 // |window1| should be flush right and |window2| flush left. |
| 1351 EXPECT_EQ(base::IntToString( | 1351 EXPECT_EQ(base::IntToString( |
| 1352 desktop_area.width() - window1->bounds().width()) + | 1352 desktop_area.width() - window1->bounds().width()) + |
| 1353 ",32 640x320", window1->bounds().ToString()); | 1353 ",32 640x320", window1->bounds().ToString()); |
| 1354 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); | 1354 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); |
| 1355 } | 1355 } |
| 1356 | 1356 |
| 1357 // Test that animations are triggered. | 1357 // Test that animations are triggered. |
| 1358 TEST_F(WorkspaceManager2Test, AnimatedNormToMaxToNormRepositionsRemaining) { | 1358 TEST_F(WorkspaceManagerTest, AnimatedNormToMaxToNormRepositionsRemaining) { |
| 1359 ui::LayerAnimator::set_disable_animations_for_test(false); | 1359 ui::LayerAnimator::set_disable_animations_for_test(false); |
| 1360 scoped_ptr<aura::Window> window1( | 1360 scoped_ptr<aura::Window> window1( |
| 1361 aura::test::CreateTestWindowWithId(0, NULL)); | 1361 aura::test::CreateTestWindowWithId(0, NULL)); |
| 1362 window1->Hide(); | 1362 window1->Hide(); |
| 1363 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); | 1363 window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 1364 gfx::Rect desktop_area = window1->parent()->bounds(); | 1364 gfx::Rect desktop_area = window1->parent()->bounds(); |
| 1365 scoped_ptr<aura::Window> window2( | 1365 scoped_ptr<aura::Window> window2( |
| 1366 aura::test::CreateTestWindowWithId(1, NULL)); | 1366 aura::test::CreateTestWindowWithId(1, NULL)); |
| 1367 window2->Hide(); | 1367 window2->Hide(); |
| 1368 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); | 1368 window2->SetBounds(gfx::Rect(32, 48, 256, 512)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1387 window2->layer()->GetAnimator()->StopAnimating(); | 1387 window2->layer()->GetAnimator()->StopAnimating(); |
| 1388 // |window1| should be flush right and |window2| flush left. | 1388 // |window1| should be flush right and |window2| flush left. |
| 1389 EXPECT_EQ(base::IntToString( | 1389 EXPECT_EQ(base::IntToString( |
| 1390 desktop_area.width() - window1->bounds().width()) + | 1390 desktop_area.width() - window1->bounds().width()) + |
| 1391 ",32 640x320", window1->bounds().ToString()); | 1391 ",32 640x320", window1->bounds().ToString()); |
| 1392 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); | 1392 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 } // namespace internal | 1395 } // namespace internal |
| 1396 } // namespace ash | 1396 } // namespace ash |
| OLD | NEW |