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

Side by Side Diff: chrome/browser/notifications/message_center_notifications_browsertest.cc

Issue 19027005: Hide notifications popups when entering fullscreen mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining testing issues Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/notifications/message_center_notification_manager.h" 14 #include "chrome/browser/notifications/message_center_notification_manager.h"
14 #include "chrome/browser/notifications/notification.h" 15 #include "chrome/browser/notifications/notification.h"
15 #include "chrome/browser/notifications/notification_ui_manager.h" 16 #include "chrome/browser/notifications/notification_ui_manager.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
18 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/test_switches.h" 20 #include "chrome/test/base/test_switches.h"
21 #include "content/public/browser/notification_details.h"
22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_source.h"
20 #include "ui/message_center/message_center.h" 24 #include "ui/message_center/message_center.h"
21 #include "ui/message_center/message_center_switches.h" 25 #include "ui/message_center/message_center_switches.h"
22 #include "ui/message_center/message_center_util.h" 26 #include "ui/message_center/message_center_util.h"
23 27
24 class TestAddObserver : public message_center::MessageCenterObserver { 28 class TestAddObserver : public message_center::MessageCenterObserver {
25 public: 29 public:
26 explicit TestAddObserver(message_center::MessageCenter* message_center) 30 explicit TestAddObserver(message_center::MessageCenter* message_center)
27 : message_center_(message_center) { 31 : message_center_(message_center) {
28 message_center_->AddObserver(this); 32 message_center_->AddObserver(this);
29 } 33 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 observer.reset_log(); 402 observer.reset_log();
399 notification.set_progress(50); 403 notification.set_progress(50);
400 manager()->Update(notification, profile()); 404 manager()->Update(notification, profile());
401 405
402 // Expect that the progress notification update is performed. 406 // Expect that the progress notification update is performed.
403 EXPECT_EQ("update-n", observer.log()); 407 EXPECT_EQ("update-n", observer.log());
404 408
405 delegate->Release(); 409 delegate->Release();
406 } 410 }
407 411
412 #if !defined(OS_CHROMEOS) && defined(RUN_MESSAGE_CENTER_TESTS)
413 #define MAYBE_HideWhenFullscreenEnabled HideWhenFullscreenEnabled
414 #else
415 #define MAYBE_HideWhenFullscreenEnabled DISABLED_HideWhenFullscreenEnabled
416 #endif
417
418 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest,
419 MAYBE_HideWhenFullscreenEnabled) {
420 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter());
421
422 TestDelegate* delegate;
423 manager()->Add(CreateTestNotification("n", &delegate), profile());
424
425 EXPECT_EQ("Display_", delegate->log());
426 EXPECT_TRUE(message_center()->HasPopupNotifications());
427 bool is_fullscreen = true;
428 // Cast so that Observe() is public.
429 content::NotificationObserver* observer =
430 static_cast<content::NotificationObserver*>(manager());
431 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED,
432 content::Source<Profile>(profile()),
433 content::Details<bool>(&is_fullscreen));
434 EXPECT_FALSE(message_center()->HasPopupNotifications());
435 }
436
408 #endif // !defined(OS_MACOSX) 437 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698