OLD | NEW |
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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chrome_notification_types.h" | |
15 #include "chrome/browser/notifications/message_center_notification_manager.h" | 14 #include "chrome/browser/notifications/message_center_notification_manager.h" |
16 #include "chrome/browser/notifications/notification.h" | 15 #include "chrome/browser/notifications/notification.h" |
17 #include "chrome/browser/notifications/notification_ui_manager.h" | 16 #include "chrome/browser/notifications/notification_ui_manager.h" |
18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "chrome/test/base/test_switches.h" | 20 #include "chrome/test/base/test_switches.h" |
22 #include "content/public/browser/notification_details.h" | |
23 #include "content/public/browser/notification_observer.h" | |
24 #include "content/public/browser/notification_source.h" | |
25 #include "ui/message_center/message_center.h" | 21 #include "ui/message_center/message_center.h" |
26 #include "ui/message_center/message_center_types.h" | 22 #include "ui/message_center/message_center_types.h" |
27 | 23 |
28 class TestAddObserver : public message_center::MessageCenterObserver { | 24 class TestAddObserver : public message_center::MessageCenterObserver { |
29 public: | 25 public: |
30 explicit TestAddObserver(message_center::MessageCenter* message_center) | 26 explicit TestAddObserver(message_center::MessageCenter* message_center) |
31 : message_center_(message_center) { | 27 : message_center_(message_center) { |
32 message_center_->AddObserver(this); | 28 message_center_->AddObserver(this); |
33 } | 29 } |
34 | 30 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 observer.reset_logs(); | 334 observer.reset_logs(); |
339 notification.set_progress(50); | 335 notification.set_progress(50); |
340 manager()->Update(notification, profile()); | 336 manager()->Update(notification, profile()); |
341 | 337 |
342 // Expect that the progress notification update is performed. | 338 // Expect that the progress notification update is performed. |
343 EXPECT_EQ("update-n", observer.log("n")); | 339 EXPECT_EQ("update-n", observer.log("n")); |
344 | 340 |
345 delegate->Release(); | 341 delegate->Release(); |
346 } | 342 } |
347 | 343 |
348 #if !defined(OS_CHROMEOS) | |
349 #define MAYBE_HideWhenFullscreenEnabled HideWhenFullscreenEnabled | |
350 #else | |
351 #define MAYBE_HideWhenFullscreenEnabled DISABLED_HideWhenFullscreenEnabled | |
352 #endif | |
353 | |
354 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | |
355 MAYBE_HideWhenFullscreenEnabled) { | |
356 TestDelegate* delegate; | |
357 manager()->Add(CreateTestNotification("n", &delegate), profile()); | |
358 | |
359 EXPECT_EQ("Display_", delegate->log()); | |
360 EXPECT_TRUE(message_center()->HasPopupNotifications()); | |
361 bool is_fullscreen = true; | |
362 // Cast so that Observe() is public. | |
363 content::NotificationObserver* observer = | |
364 static_cast<content::NotificationObserver*>(manager()); | |
365 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, | |
366 content::Source<Profile>(profile()), | |
367 content::Details<bool>(&is_fullscreen)); | |
368 EXPECT_FALSE(message_center()->HasPopupNotifications()); | |
369 } | |
370 | |
371 #endif // !defined(OS_MACOSX) | 344 #endif // !defined(OS_MACOSX) |
OLD | NEW |