| 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 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 views::Widget* widget_one = CreateTestWidgetWithParams(params); | 1317 views::Widget* widget_one = CreateTestWidgetWithParams(params); |
| 1318 widget_one->Maximize(); | 1318 widget_one->Maximize(); |
| 1319 | 1319 |
| 1320 views::Widget* widget_two = CreateTestWidgetWithParams(params); | 1320 views::Widget* widget_two = CreateTestWidgetWithParams(params); |
| 1321 widget_two->Maximize(); | 1321 widget_two->Maximize(); |
| 1322 widget_two->Activate(); | 1322 widget_two->Activate(); |
| 1323 | 1323 |
| 1324 // Both windows are maximized. They should be of the same size. | 1324 // Both windows are maximized. They should be of the same size. |
| 1325 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1325 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1326 widget_two->GetNativeWindow()->bounds().ToString()); | 1326 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1327 int area_when_shelf_shown = |
| 1328 widget_one->GetNativeWindow()->bounds().size().GetArea(); |
| 1327 | 1329 |
| 1328 // Now hide the shelf. | 1330 // Now hide the shelf. |
| 1329 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1331 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1330 | 1332 |
| 1331 // The active maximized window will get resized to the new work area. However, | 1333 // Both windows should be resized according to the shelf status. |
| 1332 // the inactive window should not get resized. | |
| 1333 EXPECT_NE(widget_one->GetNativeWindow()->bounds().ToString(), | |
| 1334 widget_two->GetNativeWindow()->bounds().ToString()); | |
| 1335 | |
| 1336 // Activate the first window. Now, both windows should be of the same size | |
| 1337 // again. | |
| 1338 widget_one->Activate(); | |
| 1339 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1334 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1340 widget_two->GetNativeWindow()->bounds().ToString()); | 1335 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1336 // Resized to small. |
| 1337 EXPECT_LT(area_when_shelf_shown, |
| 1338 widget_one->GetNativeWindow()->bounds().size().GetArea()); |
| 1341 | 1339 |
| 1342 // Now show the shelf. | 1340 // Now show the shelf. |
| 1343 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1341 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1344 | 1342 |
| 1345 // The active maximized window will get resized to the new work area. However, | 1343 // Again both windows should be of the same size. |
| 1346 // the inactive window should not get resized. | |
| 1347 EXPECT_NE(widget_one->GetNativeWindow()->bounds().ToString(), | |
| 1348 widget_two->GetNativeWindow()->bounds().ToString()); | |
| 1349 | |
| 1350 // Activate the first window. Now, both windows should be of the same size | |
| 1351 // again. | |
| 1352 widget_two->Activate(); | |
| 1353 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1344 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1354 widget_two->GetNativeWindow()->bounds().ToString()); | 1345 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1346 EXPECT_EQ(area_when_shelf_shown, |
| 1347 widget_one->GetNativeWindow()->bounds().size().GetArea()); |
| 1355 } | 1348 } |
| 1356 | 1349 |
| 1357 // Confirm that the shelf is dimmed only when content is maximized and | 1350 // Confirm that the shelf is dimmed only when content is maximized and |
| 1358 // shelf is not autohidden. | 1351 // shelf is not autohidden. |
| 1359 TEST_F(ShelfLayoutManagerTest, Dimming) { | 1352 TEST_F(ShelfLayoutManagerTest, Dimming) { |
| 1360 GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1353 GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1361 scoped_ptr<aura::Window> w1(CreateTestWindow()); | 1354 scoped_ptr<aura::Window> w1(CreateTestWindow()); |
| 1362 w1->Show(); | 1355 w1->Show(); |
| 1363 wm::ActivateWindow(w1.get()); | 1356 wm::ActivateWindow(w1.get()); |
| 1364 | 1357 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1424 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
| 1432 } else { | 1425 } else { |
| 1433 EXPECT_FALSE(shelf->IsVisible()); | 1426 EXPECT_FALSE(shelf->IsVisible()); |
| 1434 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1427 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
| 1435 } | 1428 } |
| 1436 } | 1429 } |
| 1437 } | 1430 } |
| 1438 | 1431 |
| 1439 } // namespace internal | 1432 } // namespace internal |
| 1440 } // namespace ash | 1433 } // namespace ash |
| OLD | NEW |