Commit 54113a89 authored by dgozman@chromium.org's avatar dgozman@chromium.org

[chromeos] Do not move notifications to KEEP_SIZE state when mouse moved.

This allows notification to resize.

BUG=chromium-os:16050
TEST=See bug.
Review URL: http://codereview.chromium.org/7747044

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98618 0039d316-1c4b-4281-b951-d872f2087c98
parent b0cfd90e
...@@ -174,8 +174,9 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestBasic) { ...@@ -174,8 +174,9 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestBasic) {
ui_test_utils::RunAllPendingInMessageLoop(); ui_test_utils::RunAllPendingInMessageLoop();
} }
// [CLOSED] -add->[STICKY_AND_NEW] -mouse-> [KEEP_SIZE] -remove/add-> // [CLOSED] -add->[STICKY_AND_NEW] -mouse-> [STICKY_AND_NEW] -remove/add->
// [KEEP_SIZE] -remove-> [CLOSED] -add-> [STICKY_AND_NEW] -remove-> [CLOSED] // [STICKY_AND_NEW] -remove-> [CLOSED] -add-> [STICKY_AND_NEW] -remove->
// [CLOSED]
IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) { IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) {
BalloonCollectionImpl* collection = GetBalloonCollectionImpl(); BalloonCollectionImpl* collection = GetBalloonCollectionImpl();
NotificationPanel* panel = GetNotificationPanel(); NotificationPanel* panel = GetNotificationPanel();
...@@ -190,25 +191,25 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) { ...@@ -190,25 +191,25 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) {
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state()); EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
panel->OnMouseMotion(gfx::Point(10, 10)); panel->OnMouseMotion(gfx::Point(10, 10));
EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->RemoveById("1"); collection->RemoveById("1");
ui_test_utils::RunAllPendingInMessageLoop(); ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(1, tester->GetNewNotificationCount()); EXPECT_EQ(1, tester->GetNewNotificationCount());
EXPECT_EQ(1, tester->GetNotificationCount()); EXPECT_EQ(1, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->Add(NewMockNotification("1"), browser()->profile()); collection->Add(NewMockNotification("1"), browser()->profile());
ui_test_utils::RunAllPendingInMessageLoop(); ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(2, tester->GetNewNotificationCount()); EXPECT_EQ(2, tester->GetNewNotificationCount());
EXPECT_EQ(2, tester->GetNotificationCount()); EXPECT_EQ(2, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->RemoveById("1"); collection->RemoveById("1");
ui_test_utils::RunAllPendingInMessageLoop(); ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(1, tester->GetNewNotificationCount()); EXPECT_EQ(1, tester->GetNewNotificationCount());
EXPECT_EQ(1, tester->GetNotificationCount()); EXPECT_EQ(1, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state()); EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->RemoveById("2"); collection->RemoveById("2");
ui_test_utils::RunAllPendingInMessageLoop(); ui_test_utils::RunAllPendingInMessageLoop();
......
...@@ -651,11 +651,15 @@ void NotificationPanel::OnMouseLeave() { ...@@ -651,11 +651,15 @@ void NotificationPanel::OnMouseLeave() {
void NotificationPanel::OnMouseMotion(const gfx::Point& point) { void NotificationPanel::OnMouseMotion(const gfx::Point& point) {
SetActiveView(balloon_container_->FindBalloonView(point)); SetActiveView(balloon_container_->FindBalloonView(point));
SET_STATE(KEEP_SIZE);
// We need to set the focus to scroll view to get mouse wheel // We need to set the focus to scroll view to get mouse wheel
// working. Setting focus when mouse moves on the panel // working. Setting focus when mouse moves on the panel
// because focus may be taken by other view. // because focus may be taken by other view.
scroll_view_->RequestFocus(); scroll_view_->RequestFocus();
// This method used to set KEEP_SIZE state. However,
// some html notifications may want to change their size,
// and setting KEEP_SIZE caused them to behave differently
// depending on whether user moved mouse over notification
// or not.
} }
NotificationPanelTester* NotificationPanel::GetTester() { NotificationPanelTester* NotificationPanel::GetTester() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment