| 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/common/system/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/accelerators/accelerator_controller.h" | 10 #include "ash/common/accelerators/accelerator_controller.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 SHOW_SYSTEM_TRAY_BUBBLE); | 229 SHOW_SYSTEM_TRAY_BUBBLE); |
| 230 EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); | 230 EXPECT_TRUE(tray->GetSystemBubble()->bubble_view()->GetWidget()->IsActive()); |
| 231 EXPECT_FALSE(widget->IsActive()); | 231 EXPECT_FALSE(widget->IsActive()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 // Opening and closing the bubble should change the coloring of the tray. | 234 // Opening and closing the bubble should change the coloring of the tray. |
| 235 TEST_F(SystemTrayTest, SystemTrayColoring) { | 235 TEST_F(SystemTrayTest, SystemTrayColoring) { |
| 236 SystemTray* tray = GetPrimarySystemTray(); | 236 SystemTray* tray = GetPrimarySystemTray(); |
| 237 ASSERT_TRUE(tray->GetWidget()); | 237 ASSERT_TRUE(tray->GetWidget()); |
| 238 // At the beginning the tray coloring is not active. | 238 // At the beginning the tray coloring is not active. |
| 239 ASSERT_FALSE(tray->draw_background_as_active()); | 239 ASSERT_FALSE(tray->is_active()); |
| 240 | 240 |
| 241 // Showing the system bubble should show the background as active. | 241 // Showing the system bubble should show the background as active. |
| 242 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 242 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 243 ASSERT_TRUE(tray->draw_background_as_active()); | 243 ASSERT_TRUE(tray->is_active()); |
| 244 | 244 |
| 245 // Closing the system menu should change the coloring back to normal. | 245 // Closing the system menu should change the coloring back to normal. |
| 246 ASSERT_TRUE(tray->CloseSystemBubble()); | 246 ASSERT_TRUE(tray->CloseSystemBubble()); |
| 247 RunAllPendingInMessageLoop(); | 247 RunAllPendingInMessageLoop(); |
| 248 ASSERT_FALSE(tray->draw_background_as_active()); | 248 ASSERT_FALSE(tray->is_active()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // Closing the system bubble through an alignment change should change the | 251 // Closing the system bubble through an alignment change should change the |
| 252 // system tray coloring back to normal. | 252 // system tray coloring back to normal. |
| 253 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { | 253 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { |
| 254 SystemTray* tray = GetPrimarySystemTray(); | 254 SystemTray* tray = GetPrimarySystemTray(); |
| 255 ASSERT_TRUE(tray->GetWidget()); | 255 ASSERT_TRUE(tray->GetWidget()); |
| 256 WmShelf* shelf = GetPrimaryShelf(); | 256 WmShelf* shelf = GetPrimaryShelf(); |
| 257 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 257 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 258 // At the beginning the tray coloring is not active. | 258 // At the beginning the tray coloring is not active. |
| 259 ASSERT_FALSE(tray->draw_background_as_active()); | 259 ASSERT_FALSE(tray->is_active()); |
| 260 | 260 |
| 261 // Showing the system bubble should show the background as active. | 261 // Showing the system bubble should show the background as active. |
| 262 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 262 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 263 ASSERT_TRUE(tray->draw_background_as_active()); | 263 ASSERT_TRUE(tray->is_active()); |
| 264 | 264 |
| 265 // Changing the alignment should close the system bubble and change the | 265 // Changing the alignment should close the system bubble and change the |
| 266 // background color. | 266 // background color. |
| 267 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 267 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 268 ASSERT_FALSE(tray->draw_background_as_active()); | 268 ASSERT_FALSE(tray->is_active()); |
| 269 RunAllPendingInMessageLoop(); | 269 RunAllPendingInMessageLoop(); |
| 270 // The bubble should already be closed by now. | 270 // The bubble should already be closed by now. |
| 271 ASSERT_FALSE(tray->CloseSystemBubble()); | 271 ASSERT_FALSE(tray->CloseSystemBubble()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 TEST_F(SystemTrayTest, SystemTrayTestItems) { | 274 TEST_F(SystemTrayTest, SystemTrayTestItems) { |
| 275 SystemTray* tray = GetPrimarySystemTray(); | 275 SystemTray* tray = GetPrimarySystemTray(); |
| 276 ASSERT_TRUE(tray->GetWidget()); | 276 ASSERT_TRUE(tray->GetWidget()); |
| 277 | 277 |
| 278 TestSystemTrayItem* test_item = new TestSystemTrayItem(); | 278 TestSystemTrayItem* test_item = new TestSystemTrayItem(); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 // Hide the default view, ensure the tray bubble height is back to zero. | 655 // Hide the default view, ensure the tray bubble height is back to zero. |
| 656 ASSERT_TRUE(tray->CloseSystemBubble()); | 656 ASSERT_TRUE(tray->CloseSystemBubble()); |
| 657 RunAllPendingInMessageLoop(); | 657 RunAllPendingInMessageLoop(); |
| 658 | 658 |
| 659 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 659 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
| 660 } | 660 } |
| 661 #endif // OS_CHROMEOS | 661 #endif // OS_CHROMEOS |
| 662 | 662 |
| 663 } // namespace test | 663 } // namespace test |
| 664 } // namespace ash | 664 } // namespace ash |
| OLD | NEW |