Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: ash/system/tray/system_tray_unittest.cc

Issue 15718003: Add SessionStateObserver with ActiveUserChanged() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: close button when switching users, notify observers with ActiveUserChanged() when new user logs in Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698