summaryrefslogtreecommitdiffstats
path: root/chromium/ash/system/web_notification/web_notification_tray_unittest.cc
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2013-11-21 14:09:57 +0100
committerAndras Becsi <andras.becsi@digia.com>2013-11-29 15:14:36 +0100
commiteb32ba6f51d0c21d58cd7d89785285ff8fa64624 (patch)
tree2c7c940e1dbee81b89d935626110816b494aa32c /chromium/ash/system/web_notification/web_notification_tray_unittest.cc
parent9427c1a0222ebd67efef1a2c7990a0fa5c9aac84 (diff)
Update chromium to branch 1599.
Change-Id: I04e775a946a208bb4500d3b722bcb05c82b9d7cb Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/ash/system/web_notification/web_notification_tray_unittest.cc')
-rw-r--r--chromium/ash/system/web_notification/web_notification_tray_unittest.cc119
1 files changed, 6 insertions, 113 deletions
diff --git a/chromium/ash/system/web_notification/web_notification_tray_unittest.cc b/chromium/ash/system/web_notification/web_notification_tray_unittest.cc
index 5b67b7d72b4..026500f1798 100644
--- a/chromium/ash/system/web_notification/web_notification_tray_unittest.cc
+++ b/chromium/ash/system/web_notification/web_notification_tray_unittest.cc
@@ -16,14 +16,8 @@
#include "ash/system/tray/system_tray_item.h"
#include "ash/system/tray/test_system_tray_delegate.h"
#include "ash/test/ash_test_base.h"
-#include "ash/wm/window_properties.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
-#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/test/event_generator.h"
-#include "ui/aura/window.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/screen.h"
#include "ui/message_center/message_center_style.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_util.h"
@@ -150,10 +144,6 @@ class WebNotificationTrayTest : public test::AshTestBase {
return tray->popup_collection_->work_area_;
}
- bool IsPopupVisible() {
- return GetTray()->IsPopupVisible();
- }
-
private:
DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest);
};
@@ -304,12 +294,8 @@ TEST_F(WebNotificationTrayTest, MAYBE_PopupShownOnBothDisplays) {
// RootWindow's bound can be bigger than gfx::Display's work area so that
// openingsystem tray doesn't affect at all the work area of popups.
#define MAYBE_PopupAndSystemTray PopupAndSystemTray
-#define MAYBE_PopupAndAutoHideShelf PopupAndAutoHideShelf
-#define MAYBE_PopupAndFullscreen PopupAndFullscreen
#else
#define MAYBE_PopupAndSystemTray DISABLED_PopupAndSystemTray
-#define MAYBE_PopupAndAutoHideShelf DISABLED_PopupAndAutoHideShelf
-#define MAYBE_PopupAndFullscreen DISABLED_PopupAndFullscreen
#endif
TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTray) {
@@ -346,115 +332,22 @@ TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTray) {
EXPECT_LT(work_area_with_tray_notificaiton.size().GetArea(),
work_area_with_notification.size().GetArea());
- // Close the system tray notifications.
+ // Close the notifications.
GetSystemTray()->HideNotificationView(test_item);
EXPECT_TRUE(GetTray()->IsPopupVisible());
EXPECT_EQ(work_area.ToString(), GetPopupWorkArea().ToString());
}
-TEST_F(WebNotificationTrayTest, MAYBE_PopupAndAutoHideShelf) {
+TEST_F(WebNotificationTrayTest, PopupAndSystemTrayAlignment) {
+ Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager()->
+ SetAlignment(SHELF_ALIGNMENT_LEFT);
AddNotification("test_id");
- EXPECT_TRUE(GetTray()->IsPopupVisible());
gfx::Rect work_area = GetPopupWorkArea();
- // Shelf's auto-hide state won't be HIDDEN unless window exists.
- scoped_ptr<aura::Window> window(
- CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
- internal::ShelfLayoutManager* shelf =
- Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
- shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
-
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
- gfx::Rect work_area_auto_hidden = GetPopupWorkArea();
- EXPECT_LT(work_area.size().GetArea(), work_area_auto_hidden.size().GetArea());
-
- // Close the window, which shows the shelf.
- window.reset();
- EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
- gfx::Rect work_area_auto_shown = GetPopupWorkArea();
- EXPECT_EQ(work_area.ToString(), work_area_auto_shown.ToString());
-
- // Create the system tray during auto-hide.
- window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
- TestItem* test_item = new TestItem;
- GetSystemTray()->AddTrayItem(test_item);
+ // System tray is created, but the work area is not affected since the tray
+ // appears at the left-bottom while the popups appear at the right bottom.
GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
-
- EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
- EXPECT_TRUE(GetTray()->IsPopupVisible());
- gfx::Rect work_area_with_tray = GetPopupWorkArea();
- EXPECT_GT(work_area_auto_shown.size().GetArea(),
- work_area_with_tray.size().GetArea());
-
- // Create tray notification.
- GetSystemTray()->ShowNotificationView(test_item);
- EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
- gfx::Rect work_area_with_tray_notification = GetPopupWorkArea();
- EXPECT_GT(work_area_with_tray.size().GetArea(),
- work_area_with_tray_notification.size().GetArea());
-
- // Close the system tray.
- GetSystemTray()->ClickedOutsideBubble();
- shelf->UpdateAutoHideState();
- RunAllPendingInMessageLoop();
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
- gfx::Rect work_area_hidden_with_tray_notification = GetPopupWorkArea();
- EXPECT_LT(work_area_with_tray_notification.size().GetArea(),
- work_area_hidden_with_tray_notification.size().GetArea());
- EXPECT_GT(work_area_auto_hidden.size().GetArea(),
- work_area_hidden_with_tray_notification.size().GetArea());
-
- // Close the window again, which shows the shelf.
- window.reset();
- EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
- gfx::Rect work_area_shown_with_tray_notification = GetPopupWorkArea();
- EXPECT_GT(work_area_hidden_with_tray_notification.size().GetArea(),
- work_area_shown_with_tray_notification.size().GetArea());
- EXPECT_GT(work_area_auto_shown.size().GetArea(),
- work_area_shown_with_tray_notification.size().GetArea());
-}
-
-TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) {
- AddNotification("test_id");
- EXPECT_TRUE(IsPopupVisible());
- gfx::Rect work_area = GetPopupWorkArea();
-
- // Checks the work area for normal auto-hidden state.
- scoped_ptr<aura::Window> window(
- CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
- internal::ShelfLayoutManager* shelf =
- Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
- shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
- gfx::Rect work_area_auto_hidden = GetPopupWorkArea();
- shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
-
- // Make the window to use immersive mode.
- window->SetProperty(internal::kFullscreenUsesMinimalChromeKey, true);
- window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- RunAllPendingInMessageLoop();
-
- // The work area for auto-hidden status of fullscreen is a bit larger
- // since it doesn't even have the 3-pixel width.
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
- gfx::Rect work_area_fullscreen_hidden = GetPopupWorkArea();
- EXPECT_EQ(work_area_auto_hidden.ToString(),
- work_area_fullscreen_hidden.ToString());
-
- // Move the mouse cursor at the bottom, which shows the shelf.
- aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
- gfx::Point bottom_right =
- Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom_right();
- bottom_right.Offset(-1, -1);
- generator.MoveMouseTo(bottom_right);
- shelf->UpdateAutoHideStateNow();
- EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
EXPECT_EQ(work_area.ToString(), GetPopupWorkArea().ToString());
-
- generator.MoveMouseTo(work_area.CenterPoint());
- shelf->UpdateAutoHideStateNow();
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
- EXPECT_EQ(work_area_auto_hidden.ToString(), GetPopupWorkArea().ToString());
}
TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTrayMultiDisplay) {