| 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/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 ASSERT_TRUE(tray->CloseSystemBubble()); | 166 ASSERT_TRUE(tray->CloseSystemBubble()); |
| 167 RunAllPendingInMessageLoop(); | 167 RunAllPendingInMessageLoop(); |
| 168 ASSERT_FALSE(tray->draw_background_as_active()); | 168 ASSERT_FALSE(tray->draw_background_as_active()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Closing the system bubble through an alignment change should change the | 171 // Closing the system bubble through an alignment change should change the |
| 172 // system tray coloring back to normal. | 172 // system tray coloring back to normal. |
| 173 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { | 173 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { |
| 174 SystemTray* tray = GetSystemTray(); | 174 SystemTray* tray = GetSystemTray(); |
| 175 ASSERT_TRUE(tray->GetWidget()); | 175 ASSERT_TRUE(tray->GetWidget()); |
| 176 internal::ShelfLayoutManager* manager = | 176 ShelfLayoutManager* manager = |
| 177 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager(); | 177 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager(); |
| 178 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 178 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 179 // At the beginning the tray coloring is not active. | 179 // At the beginning the tray coloring is not active. |
| 180 ASSERT_FALSE(tray->draw_background_as_active()); | 180 ASSERT_FALSE(tray->draw_background_as_active()); |
| 181 | 181 |
| 182 // Showing the system bubble should show the background as active. | 182 // Showing the system bubble should show the background as active. |
| 183 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 183 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 184 ASSERT_TRUE(tray->draw_background_as_active()); | 184 ASSERT_TRUE(tray->draw_background_as_active()); |
| 185 | 185 |
| 186 // Changing the alignment should close the system bubble and change the | 186 // Changing the alignment should close the system bubble and change the |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 RunAllPendingInMessageLoop(); | 336 RunAllPendingInMessageLoop(); |
| 337 | 337 |
| 338 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> | 338 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> |
| 339 GetWindowBoundsInScreen().ToString()); | 339 GetWindowBoundsInScreen().ToString()); |
| 340 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); | 340 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Tests that the tray is laid out properly and is fully contained within | 343 // Tests that the tray is laid out properly and is fully contained within |
| 344 // the shelf. | 344 // the shelf. |
| 345 TEST_F(SystemTrayTest, TrayBoundsInWidget) { | 345 TEST_F(SystemTrayTest, TrayBoundsInWidget) { |
| 346 internal::ShelfLayoutManager* manager = | 346 ShelfLayoutManager* manager = |
| 347 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager(); | 347 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager(); |
| 348 internal::StatusAreaWidget* widget = | 348 StatusAreaWidget* widget = |
| 349 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); | 349 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); |
| 350 SystemTray* tray = widget->system_tray(); | 350 SystemTray* tray = widget->system_tray(); |
| 351 | 351 |
| 352 // Test in bottom alignment. | 352 // Test in bottom alignment. |
| 353 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 353 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 354 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen(); | 354 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen(); |
| 355 gfx::Rect tray_bounds = tray->GetBoundsInScreen(); | 355 gfx::Rect tray_bounds = tray->GetBoundsInScreen(); |
| 356 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom()); | 356 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom()); |
| 357 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right()); | 357 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right()); |
| 358 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x()); | 358 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 { | 413 { |
| 414 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 414 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 415 gfx::Point(5, 5)); | 415 gfx::Point(5, 5)); |
| 416 generator.ClickLeftButton(); | 416 generator.ClickLeftButton(); |
| 417 ASSERT_TRUE(tray->HasSystemBubble()); | 417 ASSERT_TRUE(tray->HasSystemBubble()); |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace test | 421 } // namespace test |
| 422 } // namespace ash | 422 } // namespace ash |
| OLD | NEW |