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"
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/command_line.h"
23 #include "base/strings/stringprintf.h"
24 #include "base/strings/utf_string_conversions.h"
25 #include "ui/aura/client/aura_constants.h"
26 #include "ui/aura/window.h"
27 #include "ui/base/ui_base_switches.h"
28 #include "ui/events/event.h"
29 #include "ui/events/test/event_generator.h"
30 #include "ui/gfx/display.h"
31 #include "ui/gfx/point.h"
32 #include "ui/gfx/rect.h"
33 #include "ui/gfx/screen.h"
34 #include "ui/message_center/message_center_style.h"
35 #include "ui/message_center/message_center_tray.h"
36 #include "ui/message_center/notification_list.h"
37 #include "ui/message_center/notification_types.h"
38 #include "ui/message_center/views/message_center_bubble.h"
39 #include "ui/message_center/views/message_popup_collection.h"
40 #include "ui/views/controls/label.h"
41 #include "ui/views/layout/fill_layout.h"
42 #include "ui/views/view.h"
43 #include "ui/views/widget/widget.h"
49 WebNotificationTray* GetTray() {
50 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->
51 web_notification_tray();
54 WebNotificationTray* GetSecondaryTray() {
55 StatusAreaWidget* status_area_widget =
56 StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget();
57 if (status_area_widget)
58 return status_area_widget->web_notification_tray();
62 message_center::MessageCenter* GetMessageCenter() {
63 return GetTray()->message_center();
66 SystemTray* GetSystemTray() {
67 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray();
70 // Trivial item implementation for testing PopupAndSystemTray test case.
71 class TestItem : public SystemTrayItem {
73 TestItem() : SystemTrayItem(GetSystemTray()) {}
75 views::View* CreateDefaultView(user::LoginStatus status) override {
76 views::View* default_view = new views::View;
77 default_view->SetLayoutManager(new views::FillLayout);
78 default_view->AddChildView(new views::Label(base::UTF8ToUTF16("Default")));
82 views::View* CreateNotificationView(user::LoginStatus status) override {
83 return new views::View;
87 DISALLOW_COPY_AND_ASSIGN(TestItem);
92 class WebNotificationTrayTest : public test::AshTestBase {
94 WebNotificationTrayTest() {}
95 ~WebNotificationTrayTest() override {}
97 void SetUp() override {
98 base::CommandLine::ForCurrentProcess()->AppendSwitch(
99 switches::kEnableTouchFeedback);
100 test::AshTestBase::SetUp();
103 void TearDown() override {
104 GetMessageCenter()->RemoveAllNotifications(false);
105 test::AshTestBase::TearDown();
109 void AddNotification(const std::string& id) {
110 scoped_ptr<message_center::Notification> notification;
111 notification.reset(new message_center::Notification(
112 message_center::NOTIFICATION_TYPE_SIMPLE,
114 base::ASCIIToUTF16("Test Web Notification"),
115 base::ASCIIToUTF16("Notification message body."),
117 base::ASCIIToUTF16("www.test.org"),
118 message_center::NotifierId(),
119 message_center::RichNotificationData(),
120 NULL /* delegate */));
121 GetMessageCenter()->AddNotification(notification.Pass());
124 void UpdateNotification(const std::string& old_id,
125 const std::string& new_id) {
126 scoped_ptr<message_center::Notification> notification;
127 notification.reset(new message_center::Notification(
128 message_center::NOTIFICATION_TYPE_SIMPLE,
130 base::ASCIIToUTF16("Updated Web Notification"),
131 base::ASCIIToUTF16("Updated message body."),
133 base::ASCIIToUTF16("www.test.org"),
134 message_center::NotifierId(),
135 message_center::RichNotificationData(),
136 NULL /* delegate */));
137 GetMessageCenter()->UpdateNotification(old_id, notification.Pass());
140 void RemoveNotification(const std::string& id) {
141 GetMessageCenter()->RemoveNotification(id, false);
144 views::Widget* GetWidget() {
145 return GetTray()->GetWidget();
148 int GetPopupWorkAreaBottom() {
149 return GetPopupWorkAreaBottomForTray(GetTray());
152 int GetPopupWorkAreaBottomForTray(WebNotificationTray* tray) {
153 return tray->popup_alignment_delegate_->GetWorkAreaBottom();
156 bool IsPopupVisible() {
157 return GetTray()->IsPopupVisible();
161 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest);
164 TEST_F(WebNotificationTrayTest, WebNotifications) {
165 // TODO(mukai): move this test case to ui/message_center.
166 ASSERT_TRUE(GetWidget());
168 // Add a notification.
169 AddNotification("test_id1");
170 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount());
171 EXPECT_TRUE(GetMessageCenter()->FindVisibleNotificationById("test_id1"));
172 AddNotification("test_id2");
173 AddNotification("test_id2");
174 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount());
175 EXPECT_TRUE(GetMessageCenter()->FindVisibleNotificationById("test_id2"));
177 // Ensure that updating a notification does not affect the count.
178 UpdateNotification("test_id2", "test_id3");
179 UpdateNotification("test_id3", "test_id3");
180 EXPECT_EQ(2u, GetMessageCenter()->NotificationCount());
181 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id2"));
183 // Ensure that Removing the first notification removes it from the tray.
184 RemoveNotification("test_id1");
185 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id1"));
186 EXPECT_EQ(1u, GetMessageCenter()->NotificationCount());
188 // Remove the remianing notification.
189 RemoveNotification("test_id3");
190 EXPECT_EQ(0u, GetMessageCenter()->NotificationCount());
191 EXPECT_FALSE(GetMessageCenter()->FindVisibleNotificationById("test_id3"));
194 TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) {
195 // TODO(mukai): move this test case to ui/message_center.
196 ASSERT_TRUE(GetWidget());
198 // Adding a notification should show the popup bubble.
199 AddNotification("test_id1");
200 EXPECT_TRUE(GetTray()->IsPopupVisible());
202 // Updating a notification should not hide the popup bubble.
203 AddNotification("test_id2");
204 UpdateNotification("test_id2", "test_id3");
205 EXPECT_TRUE(GetTray()->IsPopupVisible());
207 // Removing the first notification should not hide the popup bubble.
208 RemoveNotification("test_id1");
209 EXPECT_TRUE(GetTray()->IsPopupVisible());
211 // Removing the visible notification should hide the popup bubble.
212 RemoveNotification("test_id3");
213 EXPECT_FALSE(GetTray()->IsPopupVisible());
215 // Now test that we can show multiple popups and then show the message center.
216 AddNotification("test_id4");
217 AddNotification("test_id5");
218 EXPECT_TRUE(GetTray()->IsPopupVisible());
220 GetTray()->message_center_tray_->ShowMessageCenterBubble();
221 GetTray()->message_center_tray_->HideMessageCenterBubble();
223 EXPECT_FALSE(GetTray()->IsPopupVisible());
226 using message_center::NotificationList;
229 // Flakily fails. http://crbug.com/229791
230 TEST_F(WebNotificationTrayTest, DISABLED_ManyMessageCenterNotifications) {
231 // Add the max visible notifications +1, ensure the correct visible number.
232 size_t notifications_to_add =
233 message_center::kMaxVisibleMessageCenterNotifications + 1;
234 for (size_t i = 0; i < notifications_to_add; ++i) {
235 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
238 bool shown = GetTray()->message_center_tray_->ShowMessageCenterBubble();
240 RunAllPendingInMessageLoop();
241 EXPECT_TRUE(GetTray()->message_center_bubble() != NULL);
242 EXPECT_EQ(notifications_to_add,
243 GetMessageCenter()->NotificationCount());
244 EXPECT_EQ(message_center::kMaxVisibleMessageCenterNotifications,
245 GetTray()->GetMessageCenterBubbleForTest()->
246 NumMessageViewsForTest());
249 // Flakily times out. http://crbug.com/229792
250 TEST_F(WebNotificationTrayTest, DISABLED_ManyPopupNotifications) {
251 // Add the max visible popup notifications +1, ensure the correct num visible.
252 size_t notifications_to_add =
253 message_center::kMaxVisiblePopupNotifications + 1;
254 for (size_t i = 0; i < notifications_to_add; ++i) {
255 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
258 GetTray()->ShowPopups();
259 EXPECT_TRUE(GetTray()->IsPopupVisible());
260 EXPECT_EQ(notifications_to_add,
261 GetMessageCenter()->NotificationCount());
262 NotificationList::PopupNotifications popups =
263 GetMessageCenter()->GetPopupNotifications();
264 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size());
267 #if defined(OS_CHROMEOS)
268 // Display notification is ChromeOS only.
269 #define MAYBE_PopupShownOnBothDisplays PopupShownOnBothDisplays
270 #define MAYBE_PopupAndSystemTrayMultiDisplay PopupAndSystemTrayMultiDisplay
272 #define MAYBE_PopupShownOnBothDisplays DISABLED_PopupShownOnBothDisplays
273 #define MAYBE_PopupAndSystemTrayMultiDisplay \
274 DISABLED_PopupAndSystemTrayMultiDisplay
277 // Verifies if the notification appears on both displays when extended mode.
278 TEST_F(WebNotificationTrayTest, MAYBE_PopupShownOnBothDisplays) {
279 if (!SupportsMultipleDisplays())
282 // Enables to appear the notification for display changes.
283 test::TestSystemTrayDelegate* tray_delegate =
284 static_cast<test::TestSystemTrayDelegate*>(
285 Shell::GetInstance()->system_tray_delegate());
286 tray_delegate->set_should_show_display_notification(true);
288 UpdateDisplay("400x400,200x200");
289 // UpdateDisplay() creates the display notifications, so popup is visible.
290 EXPECT_TRUE(GetTray()->IsPopupVisible());
291 WebNotificationTray* secondary_tray = GetSecondaryTray();
292 ASSERT_TRUE(secondary_tray);
293 EXPECT_TRUE(secondary_tray->IsPopupVisible());
295 // Transition to mirroring and then back to extended display, which recreates
296 // root window controller and shelf with having notifications. This code
297 // verifies it doesn't cause crash and popups are still visible. See
298 // http://crbug.com/263664
299 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
301 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING);
302 UpdateDisplay("400x400,200x200");
303 EXPECT_TRUE(GetTray()->IsPopupVisible());
304 EXPECT_FALSE(GetSecondaryTray());
306 display_manager->SetSecondDisplayMode(DisplayManager::EXTENDED);
307 UpdateDisplay("400x400,200x200");
308 EXPECT_TRUE(GetTray()->IsPopupVisible());
309 secondary_tray = GetSecondaryTray();
310 ASSERT_TRUE(secondary_tray);
311 EXPECT_TRUE(secondary_tray->IsPopupVisible());
314 #if defined(OS_CHROMEOS)
315 // PopupAndSystemTray may fail in platforms other than ChromeOS because the
316 // RootWindow's bound can be bigger than gfx::Display's work area so that
317 // openingsystem tray doesn't affect at all the work area of popups.
318 #define MAYBE_PopupAndSystemTray PopupAndSystemTray
319 #define MAYBE_PopupAndAutoHideShelf PopupAndAutoHideShelf
320 #define MAYBE_PopupAndFullscreen PopupAndFullscreen
322 #define MAYBE_PopupAndSystemTray DISABLED_PopupAndSystemTray
323 #define MAYBE_PopupAndAutoHideShelf DISABLED_PopupAndAutoHideShelf
324 #define MAYBE_PopupAndFullscreen DISABLED_PopupAndFullscreen
327 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTray) {
328 TestItem* test_item = new TestItem;
329 GetSystemTray()->AddTrayItem(test_item);
331 AddNotification("test_id");
332 EXPECT_TRUE(GetTray()->IsPopupVisible());
333 int bottom = GetPopupWorkAreaBottom();
335 // System tray is created, the popup's work area should be narrowed but still
337 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
338 EXPECT_TRUE(GetTray()->IsPopupVisible());
339 int bottom_with_tray = GetPopupWorkAreaBottom();
340 EXPECT_GT(bottom, bottom_with_tray);
342 // System tray notification is also created, the popup's work area is narrowed
343 // even more, but still visible.
344 GetSystemTray()->ShowNotificationView(test_item);
345 EXPECT_TRUE(GetTray()->IsPopupVisible());
346 int bottom_with_tray_notification = GetPopupWorkAreaBottom();
347 EXPECT_GT(bottom, bottom_with_tray_notification);
348 EXPECT_GT(bottom_with_tray, bottom_with_tray_notification);
350 // Close system tray, only system tray notifications.
351 GetSystemTray()->ClickedOutsideBubble();
352 EXPECT_TRUE(GetTray()->IsPopupVisible());
353 int bottom_with_notification = GetPopupWorkAreaBottom();
354 EXPECT_GT(bottom, bottom_with_notification);
355 EXPECT_LT(bottom_with_tray_notification, bottom_with_notification);
357 // Close the system tray notifications.
358 GetSystemTray()->HideNotificationView(test_item);
359 EXPECT_TRUE(GetTray()->IsPopupVisible());
360 EXPECT_EQ(bottom, GetPopupWorkAreaBottom());
363 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndAutoHideShelf) {
364 AddNotification("test_id");
365 EXPECT_TRUE(GetTray()->IsPopupVisible());
366 int bottom = GetPopupWorkAreaBottom();
368 // Shelf's auto-hide state won't be HIDDEN unless window exists.
369 scoped_ptr<aura::Window> window(
370 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
371 ShelfLayoutManager* shelf =
372 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
373 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
375 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
376 int bottom_auto_hidden = GetPopupWorkAreaBottom();
377 EXPECT_LT(bottom, bottom_auto_hidden);
379 // Close the window, which shows the shelf.
381 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
382 int bottom_auto_shown = GetPopupWorkAreaBottom();
383 EXPECT_EQ(bottom, bottom_auto_shown);
385 // Create the system tray during auto-hide.
386 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
387 TestItem* test_item = new TestItem;
388 GetSystemTray()->AddTrayItem(test_item);
389 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
391 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
392 EXPECT_TRUE(GetTray()->IsPopupVisible());
393 int bottom_with_tray = GetPopupWorkAreaBottom();
394 EXPECT_GT(bottom_auto_shown, bottom_with_tray);
396 // Create tray notification.
397 GetSystemTray()->ShowNotificationView(test_item);
398 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
399 int bottom_with_tray_notification = GetPopupWorkAreaBottom();
400 EXPECT_GT(bottom_with_tray, bottom_with_tray_notification);
402 // Close the system tray.
403 GetSystemTray()->ClickedOutsideBubble();
404 shelf->UpdateAutoHideState();
405 RunAllPendingInMessageLoop();
406 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
407 int bottom_hidden_with_tray_notification = GetPopupWorkAreaBottom();
408 EXPECT_LT(bottom_with_tray_notification,
409 bottom_hidden_with_tray_notification);
410 EXPECT_GT(bottom_auto_hidden, bottom_hidden_with_tray_notification);
412 // Close the window again, which shows the shelf.
414 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
415 int bottom_shown_with_tray_notification = GetPopupWorkAreaBottom();
416 EXPECT_GT(bottom_hidden_with_tray_notification,
417 bottom_shown_with_tray_notification);
418 EXPECT_GT(bottom_auto_shown, bottom_shown_with_tray_notification);
421 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) {
422 AddNotification("test_id");
423 EXPECT_TRUE(IsPopupVisible());
424 int bottom = GetPopupWorkAreaBottom();
426 // Checks the work area for normal auto-hidden state.
427 scoped_ptr<aura::Window> window(
428 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
429 ShelfLayoutManager* shelf =
430 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
431 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
432 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
433 int bottom_auto_hidden = GetPopupWorkAreaBottom();
434 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
436 // Put |window| into fullscreen without forcing the shelf to hide. Currently,
437 // this is used by immersive fullscreen and forces the shelf to be auto
439 wm::GetWindowState(window.get())->set_hide_shelf_when_fullscreen(false);
440 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
441 RunAllPendingInMessageLoop();
443 // The work area for auto-hidden status of fullscreen is a bit larger
444 // since it doesn't even have the 3-pixel width.
445 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
446 int bottom_fullscreen_hidden = GetPopupWorkAreaBottom();
447 EXPECT_EQ(bottom_auto_hidden, bottom_fullscreen_hidden);
449 // Move the mouse cursor at the bottom, which shows the shelf.
450 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
451 gfx::Point bottom_right =
452 Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom_right();
453 bottom_right.Offset(-1, -1);
454 generator.MoveMouseTo(bottom_right);
455 shelf->UpdateAutoHideStateNow();
456 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
457 EXPECT_EQ(bottom, GetPopupWorkAreaBottom());
459 generator.MoveMouseTo(
460 Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint());
461 shelf->UpdateAutoHideStateNow();
462 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
463 EXPECT_EQ(bottom_auto_hidden, GetPopupWorkAreaBottom());
466 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndSystemTrayMultiDisplay) {
467 UpdateDisplay("800x600,600x400");
469 AddNotification("test_id");
470 int bottom = GetPopupWorkAreaBottom();
471 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray());
473 // System tray is created on the primary display. The popups in the secondary
474 // tray aren't affected.
475 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
476 EXPECT_GT(bottom, GetPopupWorkAreaBottom());
477 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray()));
480 // TODO(jonross): This test is failing on ASAN bots, fix the failure and
481 // re-enable. (crbug.com/411881)
482 // TODO(jonross): Replace manually creating TouchEvent with
483 // EventGenerator.PressTouch/ReleaseTouch. Currently they set a width on the
484 // touch event causing the gesture recognizer to target a different view.
485 #if defined(OS_CHROMEOS)
486 // Tests that there is visual feedback for touch presses.
487 TEST_F(WebNotificationTrayTest, DISABLED_TouchFeedback) {
488 AddNotification("test_id");
489 RunAllPendingInMessageLoop();
490 WebNotificationTray* tray = GetTray();
491 EXPECT_TRUE(tray->visible());
493 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
494 const int touch_id = 0;
495 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint();
497 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id,
499 generator.Dispatch(&press);
500 RunAllPendingInMessageLoop();
501 EXPECT_TRUE(tray->draw_background_as_active());
503 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center_point, touch_id,
504 press.time_stamp() + base::TimeDelta::FromMilliseconds(50));
505 generator.Dispatch(&release);
506 RunAllPendingInMessageLoop();
507 EXPECT_TRUE(tray->draw_background_as_active());
508 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible());
510 generator.GestureTapAt(center_point);
511 RunAllPendingInMessageLoop();
512 EXPECT_FALSE(tray->draw_background_as_active());
513 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
516 // TODO(jonross): This test is failing on ASAN bots, fix the failure and
517 // re-enable. (crbug.com/411881)
518 // Tests that while touch presses trigger visual feedback, that subsequent non
519 // tap gestures cancel the feedback without triggering the message center.
520 TEST_F(WebNotificationTrayTest, DISABLED_TouchFeedbackCancellation) {
521 AddNotification("test_id");
522 RunAllPendingInMessageLoop();
523 WebNotificationTray* tray = GetTray();
524 EXPECT_TRUE(tray->visible());
526 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
527 const int touch_id = 0;
528 gfx::Rect bounds = tray->GetBoundsInScreen();
529 gfx::Point center_point = bounds.CenterPoint();
531 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id,
533 generator.Dispatch(&press);
534 RunAllPendingInMessageLoop();
535 EXPECT_TRUE(tray->draw_background_as_active());
537 gfx::Point out_of_bounds(bounds.x() - 1, center_point.y());
538 ui::TouchEvent move(ui::ET_TOUCH_MOVED, out_of_bounds, touch_id,
539 press.time_stamp()+base::TimeDelta::FromMilliseconds(50));
540 generator.Dispatch(&move);
541 RunAllPendingInMessageLoop();
542 EXPECT_FALSE(tray->draw_background_as_active());
544 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id,
545 move.time_stamp()+base::TimeDelta::FromMilliseconds(50));
546 generator.Dispatch(&release);
547 RunAllPendingInMessageLoop();
548 EXPECT_FALSE(tray->draw_background_as_active());
549 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
552 #endif // OS_CHROMEOS