| 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_manager.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" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 EXPECT_FALSE(w1->layer()->IsDrawn()); | 384 EXPECT_FALSE(w1->layer()->IsDrawn()); |
| 385 EXPECT_FALSE(w2->layer()->IsDrawn()); | 385 EXPECT_FALSE(w2->layer()->IsDrawn()); |
| 386 EXPECT_TRUE(w3->layer()->IsDrawn()); | 386 EXPECT_TRUE(w3->layer()->IsDrawn()); |
| 387 | 387 |
| 388 wm::ActivateWindow(w1.get()); | 388 wm::ActivateWindow(w1.get()); |
| 389 EXPECT_TRUE(w1->layer()->IsDrawn()); | 389 EXPECT_TRUE(w1->layer()->IsDrawn()); |
| 390 EXPECT_FALSE(w2->layer()->IsDrawn()); | 390 EXPECT_FALSE(w2->layer()->IsDrawn()); |
| 391 EXPECT_FALSE(w3->layer()->IsDrawn()); | 391 EXPECT_FALSE(w3->layer()->IsDrawn()); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // Ensure a workspace with two windows reports immersive mode even if only |
| 395 // one has the property set. |
| 396 TEST_F(WorkspaceManagerTest, ImmersiveMode) { |
| 397 // Open a maximized window. |
| 398 scoped_ptr<Window> w1(CreateTestWindow()); |
| 399 w1->SetBounds(gfx::Rect(0, 1, 250, 251)); |
| 400 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 401 w1->Show(); |
| 402 wm::ActivateWindow(w1.get()); |
| 403 |
| 404 // Should be 2 workspaces, normal and maximized. |
| 405 ASSERT_EQ(2u, workspaces().size()); |
| 406 ASSERT_EQ(1u, workspaces()[1]->window()->children().size()); |
| 407 |
| 408 // Immersive mode off by default. |
| 409 EXPECT_FALSE(workspaces()[1]->IsImmersiveMode()); |
| 410 |
| 411 // Enter immersive mode. |
| 412 w1->SetProperty(ash::internal::kImmersiveModeKey, true); |
| 413 EXPECT_TRUE(workspaces()[1]->IsImmersiveMode()); |
| 414 |
| 415 // Add a transient child, like a print window. Still in immersive mode. |
| 416 scoped_ptr<Window> w2(CreateTestWindow()); |
| 417 w2->SetBounds(gfx::Rect(0, 1, 150, 151)); |
| 418 w1->AddTransientChild(w2.get()); |
| 419 w2->Show(); |
| 420 wm::ActivateWindow(w2.get()); |
| 421 EXPECT_TRUE(workspaces()[1]->IsImmersiveMode()); |
| 422 } |
| 423 |
| 394 // Assertions around minimizing a single window. | 424 // Assertions around minimizing a single window. |
| 395 TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) { | 425 TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) { |
| 396 scoped_ptr<Window> w1(CreateTestWindow()); | 426 scoped_ptr<Window> w1(CreateTestWindow()); |
| 397 | 427 |
| 398 w1->Show(); | 428 w1->Show(); |
| 399 ASSERT_EQ("1 active=0", StateString()); | 429 ASSERT_EQ("1 active=0", StateString()); |
| 400 | 430 |
| 401 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 431 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 402 ASSERT_EQ("1 active=0", StateString()); | 432 ASSERT_EQ("1 active=0", StateString()); |
| 403 EXPECT_FALSE(w1->layer()->IsDrawn()); | 433 EXPECT_FALSE(w1->layer()->IsDrawn()); |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 window2->layer()->GetAnimator()->StopAnimating(); | 1464 window2->layer()->GetAnimator()->StopAnimating(); |
| 1435 // |window1| should be flush right and |window2| flush left. | 1465 // |window1| should be flush right and |window2| flush left. |
| 1436 EXPECT_EQ(base::IntToString( | 1466 EXPECT_EQ(base::IntToString( |
| 1437 desktop_area.width() - window1->bounds().width()) + | 1467 desktop_area.width() - window1->bounds().width()) + |
| 1438 ",32 640x320", window1->bounds().ToString()); | 1468 ",32 640x320", window1->bounds().ToString()); |
| 1439 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); | 1469 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); |
| 1440 } | 1470 } |
| 1441 | 1471 |
| 1442 } // namespace internal | 1472 } // namespace internal |
| 1443 } // namespace ash | 1473 } // namespace ash |
| OLD | NEW |