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

Unified Diff: ash/system/tray/system_tray_unittest.cc

Issue 10384178: ash: Make sure all the sub-popups retain the same height as the main popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray/system_tray_item.cc ('k') | ash/system/tray/tray_details_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray_unittest.cc
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc
index 0946fbd53e114142d24d31accb577ad087552eb8..feceee20d92a16e23e92a3d66e9b772639d17948 100644
--- a/ash/system/tray/system_tray_unittest.cc
+++ b/ash/system/tray/system_tray_unittest.cc
@@ -9,6 +9,7 @@
#include "ash/system/tray/system_tray_item.h"
#include "ash/test/ash_test_base.h"
#include "ui/views/view.h"
+#include "ui/views/widget/widget.h"
namespace ash {
namespace test {
@@ -86,7 +87,7 @@ TEST_F(SystemTrayTest, SystemTrayDefaultView) {
scoped_ptr<SystemTray> tray(CreateSystemTray());
ASSERT_TRUE(tray->widget());
- tray->ShowDefaultView();
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
// Ensure that closing the bubble destroys it.
ASSERT_TRUE(tray->CloseBubbleForTest());
@@ -108,18 +109,18 @@ TEST_F(SystemTrayTest, SystemTrayTestItems) {
ASSERT_TRUE(detailed_item->tray_view() != NULL);
// Ensure a default views are created.
- tray->ShowDefaultView();
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
ASSERT_TRUE(test_item->default_view() != NULL);
ASSERT_TRUE(detailed_item->default_view() != NULL);
// Show the detailed view, ensure it's created and the default view destroyed.
- tray->ShowDetailedView(detailed_item, 0, false);
+ tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW);
RunAllPendingInMessageLoop();
ASSERT_TRUE(test_item->default_view() == NULL);
ASSERT_TRUE(detailed_item->detailed_view() != NULL);
// Show the default view, ensure it's created and the detailed view destroyed.
- tray->ShowDefaultView();
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
RunAllPendingInMessageLoop();
ASSERT_TRUE(test_item->default_view() != NULL);
ASSERT_TRUE(detailed_item->detailed_view() == NULL);
@@ -144,12 +145,12 @@ TEST_F(SystemTrayTest, DISABLED_SystemTrayNotifications) {
ASSERT_TRUE(test_item->notification_view() != NULL);
// Show the default view, ensure the notification view is destroyed.
- tray->ShowDefaultView();
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
RunAllPendingInMessageLoop();
ASSERT_TRUE(test_item->notification_view() == NULL);
// Show the detailed view, ensure the notificaiton view is created again.
- tray->ShowDetailedView(detailed_item, 0, false);
+ tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW);
RunAllPendingInMessageLoop();
ASSERT_TRUE(detailed_item->detailed_view() != NULL);
ASSERT_TRUE(test_item->notification_view() != NULL);
@@ -161,5 +162,39 @@ TEST_F(SystemTrayTest, DISABLED_SystemTrayNotifications) {
ASSERT_TRUE(test_item->notification_view() != NULL);
}
+TEST_F(SystemTrayTest, BubbleCreationTypesTest) {
+ scoped_ptr<SystemTray> tray(CreateSystemTray());
+ ASSERT_TRUE(tray->widget());
+
+ TestItem* test_item = new TestItem;
+ tray->AddTrayItem(test_item);
+
+ // Ensure the tray views are created.
+ ASSERT_TRUE(test_item->tray_view() != NULL);
+
+ // Show the default view, ensure the notification view is destroyed.
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
+ RunAllPendingInMessageLoop();
+
+ views::Widget* widget = test_item->default_view()->GetWidget();
+ gfx::Rect bubble_bounds = widget->GetWindowScreenBounds();
+
+ tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING);
+ RunAllPendingInMessageLoop();
+
+ EXPECT_FALSE(test_item->default_view());
+
+ EXPECT_EQ(bubble_bounds.ToString(), test_item->detailed_view()->GetWidget()->
+ GetWindowScreenBounds().ToString());
+ EXPECT_EQ(widget, test_item->detailed_view()->GetWidget());
+
+ tray->ShowDefaultView(BUBBLE_USE_EXISTING);
+ RunAllPendingInMessageLoop();
+
+ EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()->
+ GetWindowScreenBounds().ToString());
+ EXPECT_EQ(widget, test_item->default_view()->GetWidget());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/system/tray/system_tray_item.cc ('k') | ash/system/tray/tray_details_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698