| 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_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 typedef AshTestBase SystemTrayTest; | 136 typedef AshTestBase SystemTrayTest; |
| 137 | 137 |
| 138 TEST_F(SystemTrayTest, SystemTrayDefaultView) { | 138 TEST_F(SystemTrayTest, SystemTrayDefaultView) { |
| 139 SystemTray* tray = GetSystemTray(); | 139 SystemTray* tray = GetSystemTray(); |
| 140 ASSERT_TRUE(tray->GetWidget()); | 140 ASSERT_TRUE(tray->GetWidget()); |
| 141 | 141 |
| 142 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 142 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 143 | 143 |
| 144 // Ensure that closing the bubble destroys it. | 144 // Ensure that closing the bubble destroys it. |
| 145 ASSERT_TRUE(tray->CloseSystemBubbleForTest()); | 145 ASSERT_TRUE(tray->CloseSystemBubble()); |
| 146 RunAllPendingInMessageLoop(); | 146 RunAllPendingInMessageLoop(); |
| 147 ASSERT_FALSE(tray->CloseSystemBubbleForTest()); | 147 ASSERT_FALSE(tray->CloseSystemBubble()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 TEST_F(SystemTrayTest, SystemTrayTestItems) { | 150 TEST_F(SystemTrayTest, SystemTrayTestItems) { |
| 151 SystemTray* tray = GetSystemTray(); | 151 SystemTray* tray = GetSystemTray(); |
| 152 ASSERT_TRUE(tray->GetWidget()); | 152 ASSERT_TRUE(tray->GetWidget()); |
| 153 | 153 |
| 154 TestItem* test_item = new TestItem; | 154 TestItem* test_item = new TestItem; |
| 155 TestItem* detailed_item = new TestItem; | 155 TestItem* detailed_item = new TestItem; |
| 156 tray->AddTrayItem(test_item); | 156 tray->AddTrayItem(test_item); |
| 157 tray->AddTrayItem(detailed_item); | 157 tray->AddTrayItem(detailed_item); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 240 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 241 RunAllPendingInMessageLoop(); | 241 RunAllPendingInMessageLoop(); |
| 242 ASSERT_TRUE(test_item->notification_view() != NULL); | 242 ASSERT_TRUE(test_item->notification_view() != NULL); |
| 243 | 243 |
| 244 // Show the detailed view, ensure the notificaiton view remains. | 244 // Show the detailed view, ensure the notificaiton view remains. |
| 245 tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW); | 245 tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW); |
| 246 RunAllPendingInMessageLoop(); | 246 RunAllPendingInMessageLoop(); |
| 247 ASSERT_TRUE(detailed_item->detailed_view() != NULL); | 247 ASSERT_TRUE(detailed_item->detailed_view() != NULL); |
| 248 ASSERT_TRUE(test_item->notification_view() != NULL); | 248 ASSERT_TRUE(test_item->notification_view() != NULL); |
| 249 | 249 |
| 250 // Hide the detailed view, ensure the notificaiton view still exists. | 250 // Hide the detailed view, ensure the notification view still exists. |
| 251 ASSERT_TRUE(tray->CloseSystemBubbleForTest()); | 251 ASSERT_TRUE(tray->CloseSystemBubble()); |
| 252 RunAllPendingInMessageLoop(); | 252 RunAllPendingInMessageLoop(); |
| 253 ASSERT_TRUE(detailed_item->detailed_view() == NULL); | 253 ASSERT_TRUE(detailed_item->detailed_view() == NULL); |
| 254 ASSERT_TRUE(test_item->notification_view() != NULL); | 254 ASSERT_TRUE(test_item->notification_view() != NULL); |
| 255 } | 255 } |
| 256 | 256 |
| 257 TEST_F(SystemTrayTest, BubbleCreationTypesTest) { | 257 TEST_F(SystemTrayTest, BubbleCreationTypesTest) { |
| 258 SystemTray* tray = GetSystemTray(); | 258 SystemTray* tray = GetSystemTray(); |
| 259 ASSERT_TRUE(tray->GetWidget()); | 259 ASSERT_TRUE(tray->GetWidget()); |
| 260 | 260 |
| 261 TestItem* test_item = new TestItem; | 261 TestItem* test_item = new TestItem; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // Test in the right alignment. Right and bottom edges should match. | 323 // Test in the right alignment. Right and bottom edges should match. |
| 324 widget->SetShelfAlignment(SHELF_ALIGNMENT_LEFT); | 324 widget->SetShelfAlignment(SHELF_ALIGNMENT_LEFT); |
| 325 window_bounds = widget->GetWindowBoundsInScreen(); | 325 window_bounds = widget->GetWindowBoundsInScreen(); |
| 326 tray_bounds = tray->GetBoundsInScreen(); | 326 tray_bounds = tray->GetBoundsInScreen(); |
| 327 EXPECT_EQ(window_bounds.bottom(), tray_bounds.bottom()); | 327 EXPECT_EQ(window_bounds.bottom(), tray_bounds.bottom()); |
| 328 EXPECT_EQ(window_bounds.right(), tray_bounds.right()); | 328 EXPECT_EQ(window_bounds.right(), tray_bounds.right()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace test | 331 } // namespace test |
| 332 } // namespace ash | 332 } // namespace ash |
| OLD | NEW |