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

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

Issue 2008993004: Add a test of updating cached height for popup notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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"
11 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
12 #include "ash/shelf/shelf_widget.h" 12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/system/status_area_widget.h" 14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/tray/system_tray_bubble.h" 15 #include "ash/system/tray/system_tray_bubble.h"
16 #include "ash/system/tray/system_tray_item.h" 16 #include "ash/system/tray/system_tray_item.h"
17 #include "ash/system/tray/tray_constants.h" 17 #include "ash/system/tray/tray_constants.h"
18 #include "ash/system/tray/tray_popup_item_container.h" 18 #include "ash/system/tray/tray_popup_item_container.h"
19 #include "ash/system/web_notification/web_notification_tray.h"
19 #include "ash/test/ash_test_base.h" 20 #include "ash/test/ash_test_base.h"
20 #include "ash/wm/window_util.h" 21 #include "ash/wm/window_util.h"
21 #include "base/run_loop.h" 22 #include "base/run_loop.h"
22 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
23 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
24 #include "ui/base/ui_base_types.h" 25 #include "ui/base/ui_base_types.h"
25 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 26 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
26 #include "ui/events/test/event_generator.h" 27 #include "ui/events/test/event_generator.h"
27 #include "ui/gfx/geometry/point.h" 28 #include "ui/gfx/geometry/point.h"
28 #include "ui/gfx/geometry/rect.h" 29 #include "ui/gfx/geometry/rect.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 EXPECT_TRUE(view->active()); 541 EXPECT_TRUE(view->active());
541 542
542 gfx::Point move_point(view_bounds.x(), view_bounds.CenterPoint().y()); 543 gfx::Point move_point(view_bounds.x(), view_bounds.CenterPoint().y());
543 generator.MoveTouch(move_point); 544 generator.MoveTouch(move_point);
544 EXPECT_FALSE(view->active()); 545 EXPECT_FALSE(view->active());
545 546
546 generator.set_current_location(move_point); 547 generator.set_current_location(move_point);
547 generator.ReleaseTouch(); 548 generator.ReleaseTouch();
548 EXPECT_FALSE(view->active()); 549 EXPECT_FALSE(view->active());
549 } 550 }
551
552 TEST_F(SystemTrayTest, SystemTrayHeightWithBubble) {
553 StatusAreaWidget* widget =
554 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
555 SystemTray* tray = widget->system_tray();
556 WebNotificationTray* notification_tray =
557 tray->status_area_widget()->web_notification_tray();
558
559 // Ensure the initial system tray height is zero.
560 EXPECT_EQ(0, notification_tray->system_tray_height());
561
562 // Show the default view, ensure the system tray height is changed.
563 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
564 RunAllPendingInMessageLoop();
565 EXPECT_LT(0, notification_tray->system_tray_height());
566
567 // Hide the default view, ensure the system tray height is back to zero.
568 ASSERT_TRUE(tray->CloseSystemBubble());
569 RunAllPendingInMessageLoop();
570
571 EXPECT_EQ(0, notification_tray->system_tray_height());
572 }
550 #endif // OS_CHROMEOS 573 #endif // OS_CHROMEOS
551 574
552 } // namespace test 575 } // namespace test
553 } // namespace ash 576 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698