Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / ash / system / web_notification / web_notification_tray_unittest.cc
blob20e68936a35a8b7a514a921e02cbc6fbaed59ff3
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
3 // found in the LICENSE file.
5 #include "ash/system/web_notification/web_notification_tray.h"
7 #include <vector>
9 #include "ash/display/display_manager.h"
10 #include "ash/root_window_controller.h"
11 #include "ash/shelf/shelf_layout_manager.h"
12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h"
14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/tray/system_tray.h"
16 #include "ash/system/tray/system_tray_item.h"
17 #include "ash/system/web_notification/ash_popup_alignment_delegate.h"
18 #include "ash/test/ash_test_base.h"
19 #include "ash/test/status_area_widget_test_helper.h"
20 #include "ash/test/test_system_tray_delegate.h"
21 #include "ash/wm/window_state.h"
22 #include "base/strings/stringprintf.h"
23 #include "base/strings/utf_string_conversions.h"
24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/window.h"
26 #include "ui/events/event.h"
27 #include "ui/events/test/event_generator.h"
28 #include "ui/gfx/display.h"
29 #include "ui/gfx/geometry/point.h"
30 #include "ui/gfx/geometry/rect.h"
31 #include "ui/gfx/screen.h"
32 #include "ui/message_center/message_center_style.h"
33 #include "ui/message_center/message_center_tray.h"
34 #include "ui/message_center/notification_list.h"
35 #include "ui/message_center/notification_types.h"
36 #include "ui/message_center/views/message_center_bubble.h"
37 #include "ui/message_center/views/message_popup_collection.h"
38 #include "ui/views/controls/label.h"
39 #include "ui/views/layout/fill_layout.h"
40 #include "ui/views/view.h"
41 #include "ui/views/widget/widget.h"
43 namespace ash {
45 namespace {
47 WebNotificationTray* GetTray() {
48 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->
49 web_notification_tray();
52 WebNotificationTray* GetSecondaryTray() {
53 StatusAreaWidget* status_area_widget =
54 StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget();
55 if (status_area_widget)
56 return status_area_widget->web_notification_tray();
57 return NULL;
60 message_center::MessageCenter* GetMessageCenter() {
61 return GetTray()->message_center();
64 SystemTray* GetSystemTray() {
65 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray();
68 // Trivial item implementation for testing PopupAndSystemTray test case.
69 class TestItem : public SystemTrayItem {
70 public:
71 TestItem() : SystemTrayItem(GetSystemTray()) {}
73 views::View* CreateDefaultView(user::LoginStatus status) override {
74 views::View* default_view = new views::View;
75 default_view->SetLayoutManager(new views::FillLayout);
76 default_view->AddChildView(new views::Label(base::UTF8ToUTF16("Default")));
77 return default_view;
80 views::View* CreateNotificationView(user::LoginStatus status) override {
81 return new views::View;
84 private:
85 DISALLOW_COPY_AND_ASSIGN(TestItem);
88 } // namespace
90 class WebNotificationTrayTest : public test::AshTestBase {
91 public:
92 WebNotificationTrayTest() {}
93 ~WebNotificationTrayTest() override {}
95 void TearDown() override {
96 GetMessageCenter()->RemoveAllNotifications(false);
97 test::AshTestBase::TearDown();
100 protected:
101 void AddNotification(const std::string& id) {
102 scoped_ptr<message_center::Notification> notification;
103 notification.reset(new message_center::Notification(
104 message_center::NOTIFICATION_TYPE_SIMPLE,
106 base::ASCIIToUTF16("Test Web Notification"),
107 base::ASCIIToUTF16("Notification message body."),
108 gfx::Image(),
109 base::ASCIIToUTF16("www.test.org"),
110 message_center::NotifierId(),
111 message_center::RichNotificationData(),
112 NULL /* delegate */));
113 GetMessageCenter()->AddNotification(notification.Pass());
116 void UpdateNotification(const std::string& old_id,
117 const std::string& new_id) {
118 scoped_ptr<message_center::Notification> notification;
119 notification.reset(new message_center::Notification(
120 message_center::NOTIFICATION_TYPE_SIMPLE,
121 new_id,
122 base::ASCIIToUTF16("Updated Web Notification"),
123 base::ASCIIToUTF16("Updated message body."),
124 gfx::Image(),
125 base::ASCIIToUTF16("www.test.org"),
126 message_center::NotifierId(),
127 message_center::RichNotificationData(),
128 NULL /* delegate */));
129 GetMessageCenter()->UpdateNotification(old_id, notification.Pass());
132 void RemoveNotification(const std::string& id) {
133 GetMessageCenter()->RemoveNotification(id, false);
136 views::Widget* GetWidget() {
137 return GetTray()->GetWidget();
140 int GetPopupWorkAreaBottom() {
141 return GetPopupWorkAreaBottomForTray(GetTray());
144 int GetPopupWorkAreaBottomForTray(WebNotificationTray* tray) {
145 return tray->popup_alignment_delegate_->GetWorkAreaBottom();
148 bool IsPopupVisible() {
149 return GetTray()->IsPopupVisible();
152 private:
153 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest);
156 TEST_F(WebNotificationTrayTest, WebNotifications) {
157 // TODO(mukai): move this test case to ui/message_center.
158 ASSERT_TRUE(GetWidget());
160 // Add a notification.
161 AddNotification("test_id1");
162 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount());
163 EXPECT_TRUE(GetMessageCenter()->FindVisibleNotificationById("test_id1"));
164 AddNotification("test_id2");
165 AddNotification("test_id2");
166 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount());
167 EXPECT_TRUE(GetMessageCenter()->FindVisibleNotificationById("test_id2"));
169 // Ensure that updating a notification does not affect the count.
170 UpdateNotification("test_id2", "test_id3");
171 UpdateNotification("test_id3", "test_id3");
172 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount());
173 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id2"));
175 // Ensure that Removing the first notification removes it from the tray.
176 RemoveNotification("test_id1");
177 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id1"));
178 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount());
180 // Remove the remianing notification.
181 RemoveNotification("test_id3");
182 EXPECT_EQ(0u, GetMessageCenter()->NotificationCount());
183 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id3"));
186 TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) {
187 // TODO(mukai): move this test case to ui/message_center.
188 ASSERT_TRUE(GetWidget());
190 // Adding a notification should show the popup bubble.
191 AddNotification("test_id1");
192 EXPECT_TRUE(GetTray()->IsPopupVisible());
194 // Updating a notification should not hide the popup bubble.
195 AddNotification("test_id2");
196 UpdateNotification("test_id2", "test_id3");
197 EXPECT_TRUE(GetTray()->IsPopupVisible());
199 // Removing the first notification should not hide the popup bubble.
200 RemoveNotification("test_id1");
201 EXPECT_TRUE(GetTray()->IsPopupVisible());
203 // Removing the visible notification should hide the popup bubble.
204 RemoveNotification("test_id3");
205 EXPECT_FALSE(GetTray()->IsPopupVisible());
207 // Now test that we can show multiple popups and then show the message center.
208 AddNotification("test_id4");
209 AddNotification("test_id5");
210 EXPECT_TRUE(GetTray()->IsPopupVisible());
212 GetTray()->message_center_tray_->ShowMessageCenterBubble();
213 GetTray()->message_center_tray_->HideMessageCenterBubble();
215 EXPECT_FALSE(GetTray()->IsPopupVisible());
218 using message_center::NotificationList;
221 // Flakily fails. http://crbug.com/229791
222 TEST_F(WebNotificationTrayTest, DISABLED_ManyMessageCenterNotifications) {
223 // Add the max visible notifications +1, ensure the correct visible number.
224 size_t notifications_to_add =
225 message_center::kMaxVisibleMessageCenterNotifications + 1;
226 for (size_t i = 0; i < notifications_to_add; ++i) {
227 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
228 AddNotification(id);
230 bool shown = GetTray()->message_center_tray_->ShowMessageCenterBubble();
231 EXPECT_TRUE(shown);
232 RunAllPendingInMessageLoop();
233 EXPECT_TRUE(GetTray()->message_center_bubble() != NULL);
234 EXPECT_EQ(notifications_to_add,
235 GetMessageCenter()->NotificationCount());
236 EXPECT_EQ(message_center::kMaxVisibleMessageCenterNotifications,
237 GetTray()->GetMessageCenterBubbleForTest()->
238 NumMessageViewsForTest());
241 // Flakily times out. http://crbug.com/229792
242 TEST_F(WebNotificationTrayTest, DISABLED_ManyPopupNotifications) {
243 // Add the max visible popup notifications +1, ensure the correct num visible.
244 size_t notifications_to_add =
245 message_center::kMaxVisiblePopupNotifications + 1;
246 for (size_t i = 0; i < notifications_to_add; ++i) {
247 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
248 AddNotification(id);
250 GetTray()->ShowPopups();
251 EXPECT_TRUE(GetTray()->IsPopupVisible());
252 EXPECT_EQ(notifications_to_add,
253 GetMessageCenter()->NotificationCount());
254 NotificationList::PopupNotifications popups =
255 GetMessageCenter()->GetPopupNotifications();
256 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size());
259 #if defined(OS_CHROMEOS)
260 // Display notification is ChromeOS only.
261 #define MAYBE_PopupShownOnBothDisplays PopupShownOnBothDisplays
262 #define MAYBE_PopupAndSystemTrayMultiDisplay PopupAndSystemTrayMultiDisplay
263 #else
264 #define MAYBE_PopupShownOnBothDisplays DISABLED_PopupShownOnBothDisplays
265 #define MAYBE_PopupAndSystemTrayMultiDisplay \
266 DISABLED_PopupAndSystemTrayMultiDisplay
267 #endif
269 // Verifies if the notification appears on both displays when extended mode.
270 TEST_F(WebNotificationTrayTest, MAYBE_PopupShownOnBothDisplays) {
271 if (!SupportsMultipleDisplays())
272 return;
274 // Enables to appear the notification for display changes.
275 test::TestSystemTrayDelegate* tray_delegate =
276 static_cast<test::TestSystemTrayDelegate*>(
277 Shell::GetInstance()->system_tray_delegate());
278 tray_delegate->set_should_show_display_notification(true);
280 UpdateDisplay("400x400,200x200");
281 // UpdateDisplay() creates the display notifications, so popup is visible.
282 EXPECT_TRUE(GetTray()->IsPopupVisible());
283 WebNotificationTray* secondary_tray = GetSecondaryTray();
284 ASSERT_TRUE(secondary_tray);
285 EXPECT_TRUE(secondary_tray->IsPopupVisible());
287 // Transition to mirroring and then back to extended display, which recreates
288 // root window controller and shelf with having notifications. This code
289 // verifies it doesn't cause crash and popups are still visible. See
290 // http://crbug.com/263664
291 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
293 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING);
294 UpdateDisplay("400x400,200x200");
295 EXPECT_TRUE(GetTray()->IsPopupVisible());
296 EXPECT_FALSE(GetSecondaryTray());
298 display_manager->SetSecondDisplayMode(DisplayManager::EXTENDED);
299 UpdateDisplay("400x400,200x200");
300 EXPECT_TRUE(GetTray()->IsPopupVisible());
301 secondary_tray = GetSecondaryTray();
302 ASSERT_TRUE(secondary_tray);
303 EXPECT_TRUE(secondary_tray->IsPopupVisible());
306 #if defined(OS_CHROMEOS)
307 // PopupAndSystemTray may fail in platforms other than ChromeOS because the
308 // RootWindow's bound can be bigger than gfx::Display's work area so that
309 // openingsystem tray doesn't affect at all the work area of popups.
310 #define MAYBE_PopupAndSystemTray PopupAndSystemTray
311 #define MAYBE_PopupAndAutoHideShelf PopupAndAutoHideShelf
312 #define MAYBE_PopupAndFullscreen PopupAndFullscreen
313 #else
314 #define MAYBE_PopupAndSystemTray DISABLED_PopupAndSystemTray
315 #define MAYBE_PopupAndAutoHideShelf DISABLED_PopupAndAutoHideShelf
316 #define MAYBE_PopupAndFullscreen DISABLED_PopupAndFullscreen
317 #endif
319 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTray) {
320 TestItem* test_item = new TestItem;
321 GetSystemTray()->AddTrayItem(test_item);
323 AddNotification("test_id");
324 EXPECT_TRUE(GetTray()->IsPopupVisible());
325 int bottom = GetPopupWorkAreaBottom();
327 // System tray is created, the popup's work area should be narrowed but still
328 // visible.
329 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
330 EXPECT_TRUE(GetTray()->IsPopupVisible());
331 int bottom_with_tray = GetPopupWorkAreaBottom();
332 EXPECT_GT(bottom, bottom_with_tray);
334 // System tray notification is also created, the popup's work area is narrowed
335 // even more, but still visible.
336 GetSystemTray()->ShowNotificationView(test_item);
337 EXPECT_TRUE(GetTray()->IsPopupVisible());
338 int bottom_with_tray_notification = GetPopupWorkAreaBottom();
339 EXPECT_GT(bottom, bottom_with_tray_notification);
340 EXPECT_GT(bottom_with_tray, bottom_with_tray_notification);
342 // Close system tray, only system tray notifications.
343 GetSystemTray()->ClickedOutsideBubble();
344 EXPECT_TRUE(GetTray()->IsPopupVisible());
345 int bottom_with_notification = GetPopupWorkAreaBottom();
346 EXPECT_GT(bottom, bottom_with_notification);
347 EXPECT_LT(bottom_with_tray_notification, bottom_with_notification);
349 // Close the system tray notifications.
350 GetSystemTray()->HideNotificationView(test_item);
351 EXPECT_TRUE(GetTray()->IsPopupVisible());
352 EXPECT_EQ(bottom, GetPopupWorkAreaBottom());
355 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndAutoHideShelf) {
356 AddNotification("test_id");
357 EXPECT_TRUE(GetTray()->IsPopupVisible());
358 int bottom = GetPopupWorkAreaBottom();
360 // Shelf's auto-hide state won't be HIDDEN unless window exists.
361 scoped_ptr<aura::Window> window(
362 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
363 ShelfLayoutManager* shelf =
364 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
365 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
367 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
368 int bottom_auto_hidden = GetPopupWorkAreaBottom();
369 EXPECT_LT(bottom, bottom_auto_hidden);
371 // Close the window, which shows the shelf.
372 window.reset();
373 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
374 int bottom_auto_shown = GetPopupWorkAreaBottom();
375 EXPECT_EQ(bottom, bottom_auto_shown);
377 // Create the system tray during auto-hide.
378 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
379 TestItem* test_item = new TestItem;
380 GetSystemTray()->AddTrayItem(test_item);
381 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
383 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
384 EXPECT_TRUE(GetTray()->IsPopupVisible());
385 int bottom_with_tray = GetPopupWorkAreaBottom();
386 EXPECT_GT(bottom_auto_shown, bottom_with_tray);
388 // Create tray notification.
389 GetSystemTray()->ShowNotificationView(test_item);
390 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
391 int bottom_with_tray_notification = GetPopupWorkAreaBottom();
392 EXPECT_GT(bottom_with_tray, bottom_with_tray_notification);
394 // Close the system tray.
395 GetSystemTray()->ClickedOutsideBubble();
396 shelf->UpdateAutoHideState();
397 RunAllPendingInMessageLoop();
398 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
399 int bottom_hidden_with_tray_notification = GetPopupWorkAreaBottom();
400 EXPECT_LT(bottom_with_tray_notification,
401 bottom_hidden_with_tray_notification);
402 EXPECT_GT(bottom_auto_hidden, bottom_hidden_with_tray_notification);
404 // Close the window again, which shows the shelf.
405 window.reset();
406 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
407 int bottom_shown_with_tray_notification = GetPopupWorkAreaBottom();
408 EXPECT_GT(bottom_hidden_with_tray_notification,
409 bottom_shown_with_tray_notification);
410 EXPECT_GT(bottom_auto_shown, bottom_shown_with_tray_notification);
413 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) {
414 AddNotification("test_id");
415 EXPECT_TRUE(IsPopupVisible());
416 int bottom = GetPopupWorkAreaBottom();
418 // Checks the work area for normal auto-hidden state.
419 scoped_ptr<aura::Window> window(
420 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
421 ShelfLayoutManager* shelf =
422 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
423 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
424 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
425 int bottom_auto_hidden = GetPopupWorkAreaBottom();
426 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
428 // Put |window| into fullscreen without forcing the shelf to hide. Currently,
429 // this is used by immersive fullscreen and forces the shelf to be auto
430 // hidden.
431 wm::GetWindowState(window.get())->set_hide_shelf_when_fullscreen(false);
432 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
433 RunAllPendingInMessageLoop();
435 // The work area for auto-hidden status of fullscreen is a bit larger
436 // since it doesn't even have the 3-pixel width.
437 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
438 int bottom_fullscreen_hidden = GetPopupWorkAreaBottom();
439 EXPECT_EQ(bottom_auto_hidden, bottom_fullscreen_hidden);
441 // Move the mouse cursor at the bottom, which shows the shelf.
442 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
443 gfx::Point bottom_right =
444 Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom_right();
445 bottom_right.Offset(-1, -1);
446 generator.MoveMouseTo(bottom_right);
447 shelf->UpdateAutoHideStateNow();
448 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
449 EXPECT_EQ(bottom, GetPopupWorkAreaBottom());
451 generator.MoveMouseTo(
452 Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint());
453 shelf->UpdateAutoHideStateNow();
454 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
455 EXPECT_EQ(bottom_auto_hidden, GetPopupWorkAreaBottom());
458 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTrayMultiDisplay) {
459 UpdateDisplay("800x600,600x400");
461 AddNotification("test_id");
462 int bottom = GetPopupWorkAreaBottom();
463 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray());
465 // System tray is created on the primary display. The popups in the secondary
466 // tray aren't affected.
467 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
468 EXPECT_GT(bottom, GetPopupWorkAreaBottom());
469 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray()));
472 // TODO(jonross): Replace manually creating TouchEvent with
473 // EventGenerator.PressTouch/ReleaseTouch. Currently they set a width on the
474 // touch event causing the gesture recognizer to target a different view.
475 #if defined(OS_CHROMEOS)
476 // Tests that there is visual feedback for touch presses.
477 TEST_F(WebNotificationTrayTest, TouchFeedback) {
478 AddNotification("test_id");
479 RunAllPendingInMessageLoop();
480 WebNotificationTray* tray = GetTray();
481 EXPECT_TRUE(tray->visible());
483 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
484 const int touch_id = 0;
485 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint();
487 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id,
488 generator.Now());
489 generator.Dispatch(&press);
490 EXPECT_TRUE(tray->draw_background_as_active());
492 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center_point, touch_id,
493 press.time_stamp() + base::TimeDelta::FromMilliseconds(50));
494 generator.Dispatch(&release);
495 EXPECT_TRUE(tray->draw_background_as_active());
496 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible());
498 generator.GestureTapAt(center_point);
499 EXPECT_FALSE(tray->draw_background_as_active());
500 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
503 // Tests that while touch presses trigger visual feedback, that subsequent non
504 // tap gestures cancel the feedback without triggering the message center.
505 TEST_F(WebNotificationTrayTest, TouchFeedbackCancellation) {
506 AddNotification("test_id");
507 RunAllPendingInMessageLoop();
508 WebNotificationTray* tray = GetTray();
509 EXPECT_TRUE(tray->visible());
511 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
512 const int touch_id = 0;
513 gfx::Rect bounds = tray->GetBoundsInScreen();
514 gfx::Point center_point = bounds.CenterPoint();
516 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id,
517 generator.Now());
518 generator.Dispatch(&press);
519 EXPECT_TRUE(tray->draw_background_as_active());
521 gfx::Point out_of_bounds(bounds.x() - 1, center_point.y());
522 ui::TouchEvent move(ui::ET_TOUCH_MOVED, out_of_bounds, touch_id,
523 press.time_stamp()+base::TimeDelta::FromMilliseconds(50));
524 generator.Dispatch(&move);
525 EXPECT_FALSE(tray->draw_background_as_active());
527 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id,
528 move.time_stamp()+base::TimeDelta::FromMilliseconds(50));
529 generator.Dispatch(&release);
530 EXPECT_FALSE(tray->draw_background_as_active());
531 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
534 #endif // OS_CHROMEOS
536 } // namespace ash