| 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 views::Widget* widget_one = CreateTestWidgetWithParams(params); | 1356 views::Widget* widget_one = CreateTestWidgetWithParams(params); |
| 1357 widget_one->Maximize(); | 1357 widget_one->Maximize(); |
| 1358 | 1358 |
| 1359 views::Widget* widget_two = CreateTestWidgetWithParams(params); | 1359 views::Widget* widget_two = CreateTestWidgetWithParams(params); |
| 1360 widget_two->Maximize(); | 1360 widget_two->Maximize(); |
| 1361 widget_two->Activate(); | 1361 widget_two->Activate(); |
| 1362 | 1362 |
| 1363 // Both windows are maximized. They should be of the same size. | 1363 // Both windows are maximized. They should be of the same size. |
| 1364 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1364 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1365 widget_two->GetNativeWindow()->bounds().ToString()); | 1365 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1366 int area_when_shelf_shown = |
| 1367 widget_one->GetNativeWindow()->bounds().size().GetArea(); |
| 1366 | 1368 |
| 1367 // Now hide the shelf. | 1369 // Now hide the shelf. |
| 1368 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1370 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1369 | 1371 |
| 1370 // The active maximized window will get resized to the new work area. However, | 1372 // Both windows should be resized according to the shelf status. |
| 1371 // the inactive window should not get resized. | |
| 1372 EXPECT_NE(widget_one->GetNativeWindow()->bounds().ToString(), | |
| 1373 widget_two->GetNativeWindow()->bounds().ToString()); | |
| 1374 | |
| 1375 // Activate the first window. Now, both windows should be of the same size | |
| 1376 // again. | |
| 1377 widget_one->Activate(); | |
| 1378 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1373 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1379 widget_two->GetNativeWindow()->bounds().ToString()); | 1374 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1375 // Resized to small. |
| 1376 EXPECT_LT(area_when_shelf_shown, |
| 1377 widget_one->GetNativeWindow()->bounds().size().GetArea()); |
| 1380 | 1378 |
| 1381 // Now show the shelf. | 1379 // Now show the shelf. |
| 1382 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1380 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1383 | 1381 |
| 1384 // The active maximized window will get resized to the new work area. However, | 1382 // Again both windows should be of the same size. |
| 1385 // the inactive window should not get resized. | |
| 1386 EXPECT_NE(widget_one->GetNativeWindow()->bounds().ToString(), | |
| 1387 widget_two->GetNativeWindow()->bounds().ToString()); | |
| 1388 | |
| 1389 // Activate the first window. Now, both windows should be of the same size | |
| 1390 // again. | |
| 1391 widget_two->Activate(); | |
| 1392 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1383 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1393 widget_two->GetNativeWindow()->bounds().ToString()); | 1384 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1385 EXPECT_EQ(area_when_shelf_shown, |
| 1386 widget_one->GetNativeWindow()->bounds().size().GetArea()); |
| 1394 } | 1387 } |
| 1395 | 1388 |
| 1396 // Confirm that the shelf is dimmed only when content is maximized and | 1389 // Confirm that the shelf is dimmed only when content is maximized and |
| 1397 // shelf is not autohidden. | 1390 // shelf is not autohidden. |
| 1398 TEST_F(ShelfLayoutManagerTest, Dimming) { | 1391 TEST_F(ShelfLayoutManagerTest, Dimming) { |
| 1399 GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1392 GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1400 scoped_ptr<aura::Window> w1(CreateTestWindow()); | 1393 scoped_ptr<aura::Window> w1(CreateTestWindow()); |
| 1401 w1->Show(); | 1394 w1->Show(); |
| 1402 wm::ActivateWindow(w1.get()); | 1395 wm::ActivateWindow(w1.get()); |
| 1403 | 1396 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1463 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
| 1471 } else { | 1464 } else { |
| 1472 EXPECT_FALSE(shelf->IsVisible()); | 1465 EXPECT_FALSE(shelf->IsVisible()); |
| 1473 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1466 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
| 1474 } | 1467 } |
| 1475 } | 1468 } |
| 1476 } | 1469 } |
| 1477 | 1470 |
| 1478 } // namespace internal | 1471 } // namespace internal |
| 1479 } // namespace ash | 1472 } // namespace ash |
| OLD | NEW |