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

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

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: comment Created 4 years, 8 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
« no previous file with comments | « ash/system/tray/system_tray_item.cc ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/accessibility_delegate.h" 9 #include "ash/accessibility_delegate.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ASSERT_FALSE(tray->draw_background_as_active()); 175 ASSERT_FALSE(tray->draw_background_as_active());
176 } 176 }
177 177
178 // Closing the system bubble through an alignment change should change the 178 // Closing the system bubble through an alignment change should change the
179 // system tray coloring back to normal. 179 // system tray coloring back to normal.
180 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { 180 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) {
181 SystemTray* tray = GetSystemTray(); 181 SystemTray* tray = GetSystemTray();
182 ASSERT_TRUE(tray->GetWidget()); 182 ASSERT_TRUE(tray->GetWidget());
183 ShelfLayoutManager* manager = 183 ShelfLayoutManager* manager =
184 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager(); 184 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager();
185 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); 185 manager->SetAlignment(wm::SHELF_ALIGNMENT_BOTTOM);
186 // At the beginning the tray coloring is not active. 186 // At the beginning the tray coloring is not active.
187 ASSERT_FALSE(tray->draw_background_as_active()); 187 ASSERT_FALSE(tray->draw_background_as_active());
188 188
189 // Showing the system bubble should show the background as active. 189 // Showing the system bubble should show the background as active.
190 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 190 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
191 ASSERT_TRUE(tray->draw_background_as_active()); 191 ASSERT_TRUE(tray->draw_background_as_active());
192 192
193 // Changing the alignment should close the system bubble and change the 193 // Changing the alignment should close the system bubble and change the
194 // background color. 194 // background color.
195 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); 195 manager->SetAlignment(wm::SHELF_ALIGNMENT_LEFT);
196 ASSERT_FALSE(tray->draw_background_as_active()); 196 ASSERT_FALSE(tray->draw_background_as_active());
197 RunAllPendingInMessageLoop(); 197 RunAllPendingInMessageLoop();
198 // The bubble should already be closed by now. 198 // The bubble should already be closed by now.
199 ASSERT_FALSE(tray->CloseSystemBubble()); 199 ASSERT_FALSE(tray->CloseSystemBubble());
200 } 200 }
201 201
202 TEST_F(SystemTrayTest, SystemTrayTestItems) { 202 TEST_F(SystemTrayTest, SystemTrayTestItems) {
203 SystemTray* tray = GetSystemTray(); 203 SystemTray* tray = GetSystemTray();
204 ASSERT_TRUE(tray->GetWidget()); 204 ASSERT_TRUE(tray->GetWidget());
205 205
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // Tests that the tray is laid out properly and is fully contained within 350 // Tests that the tray is laid out properly and is fully contained within
351 // the shelf. 351 // the shelf.
352 TEST_F(SystemTrayTest, TrayBoundsInWidget) { 352 TEST_F(SystemTrayTest, TrayBoundsInWidget) {
353 ShelfLayoutManager* manager = 353 ShelfLayoutManager* manager =
354 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager(); 354 Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager();
355 StatusAreaWidget* widget = 355 StatusAreaWidget* widget =
356 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); 356 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
357 SystemTray* tray = widget->system_tray(); 357 SystemTray* tray = widget->system_tray();
358 358
359 // Test in bottom alignment. 359 // Test in bottom alignment.
360 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM); 360 manager->SetAlignment(wm::SHELF_ALIGNMENT_BOTTOM);
361 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen(); 361 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen();
362 gfx::Rect tray_bounds = tray->GetBoundsInScreen(); 362 gfx::Rect tray_bounds = tray->GetBoundsInScreen();
363 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom()); 363 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
364 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right()); 364 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
365 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x()); 365 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
366 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y()); 366 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
367 367
368 // Test in locked alignment. 368 // Test in locked alignment.
369 manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED); 369 manager->SetAlignment(wm::SHELF_ALIGNMENT_BOTTOM_LOCKED);
370 window_bounds = widget->GetWindowBoundsInScreen(); 370 window_bounds = widget->GetWindowBoundsInScreen();
371 tray_bounds = tray->GetBoundsInScreen(); 371 tray_bounds = tray->GetBoundsInScreen();
372 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom()); 372 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
373 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right()); 373 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
374 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x()); 374 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
375 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y()); 375 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
376 376
377 // Test in the left alignment. 377 // Test in the left alignment.
378 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); 378 manager->SetAlignment(wm::SHELF_ALIGNMENT_LEFT);
379 window_bounds = widget->GetWindowBoundsInScreen(); 379 window_bounds = widget->GetWindowBoundsInScreen();
380 tray_bounds = tray->GetBoundsInScreen(); 380 tray_bounds = tray->GetBoundsInScreen();
381 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom()); 381 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
382 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right()); 382 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
383 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x()); 383 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
384 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y()); 384 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
385 385
386 // Test in the right alignment. 386 // Test in the right alignment.
387 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); 387 manager->SetAlignment(wm::SHELF_ALIGNMENT_LEFT);
388 window_bounds = widget->GetWindowBoundsInScreen(); 388 window_bounds = widget->GetWindowBoundsInScreen();
389 tray_bounds = tray->GetBoundsInScreen(); 389 tray_bounds = tray->GetBoundsInScreen();
390 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom()); 390 EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
391 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right()); 391 EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
392 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x()); 392 EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
393 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y()); 393 EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
394 } 394 }
395 395
396 TEST_F(SystemTrayTest, PersistentBubble) { 396 TEST_F(SystemTrayTest, PersistentBubble) {
397 SystemTray* tray = GetSystemTray(); 397 SystemTray* tray = GetSystemTray();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 EXPECT_FALSE(view->active()); 544 EXPECT_FALSE(view->active());
545 545
546 generator.set_current_location(move_point); 546 generator.set_current_location(move_point);
547 generator.ReleaseTouch(); 547 generator.ReleaseTouch();
548 EXPECT_FALSE(view->active()); 548 EXPECT_FALSE(view->active());
549 } 549 }
550 #endif // OS_CHROMEOS 550 #endif // OS_CHROMEOS
551 551
552 } // namespace test 552 } // namespace test
553 } // namespace ash 553 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_item.cc ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698