| 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 <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" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 message_center::NotifierId( | 143 message_center::NotifierId( |
| 144 message_center::NotifierId::APPLICATION, | 144 message_center::NotifierId::APPLICATION, |
| 145 "extension_id"), | 145 "extension_id"), |
| 146 UTF8ToUTF16("chrome-test://testing/"), | 146 UTF8ToUTF16("chrome-test://testing/"), |
| 147 UTF8ToUTF16("REPLACE-ME"), | 147 UTF8ToUTF16("REPLACE-ME"), |
| 148 data, | 148 data, |
| 149 new_delegate); | 149 new_delegate); |
| 150 } | 150 } |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 // TODO(rsesek): Implement Message Center on Mac and get these tests passing | |
| 154 // for real. http://crbug.com/179904 | |
| 155 #if !defined(OS_MACOSX) | |
| 156 | |
| 157 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, RetrieveBaseParts) { | 153 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, RetrieveBaseParts) { |
| 158 // Make sure comamnd-line switch has an effect. | 154 // Make sure comamnd-line switch has an effect. |
| 159 EXPECT_EQ(NotificationUIManager::DelegatesToMessageCenter(), | 155 EXPECT_EQ(NotificationUIManager::DelegatesToMessageCenter(), |
| 160 message_center::IsRichNotificationEnabled()); | 156 message_center::IsRichNotificationEnabled()); |
| 161 EXPECT_TRUE(manager()); | 157 EXPECT_TRUE(manager()); |
| 162 EXPECT_TRUE(message_center()); | 158 EXPECT_TRUE(message_center()); |
| 163 } | 159 } |
| 164 | 160 |
| 165 // MessaceCenter-specific test. | 161 // MessaceCenter-specific test. |
| 166 #if defined(RUN_MESSAGE_CENTER_TESTS) | 162 #if defined(RUN_MESSAGE_CENTER_TESTS) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 observer.reset_log(); | 401 observer.reset_log(); |
| 406 notification.set_progress(50); | 402 notification.set_progress(50); |
| 407 manager()->Update(notification, profile()); | 403 manager()->Update(notification, profile()); |
| 408 | 404 |
| 409 // Expect that the progress notification update is performed. | 405 // Expect that the progress notification update is performed. |
| 410 EXPECT_EQ("update-n", observer.log()); | 406 EXPECT_EQ("update-n", observer.log()); |
| 411 | 407 |
| 412 delegate->Release(); | 408 delegate->Release(); |
| 413 } | 409 } |
| 414 | 410 |
| 415 #if !defined(OS_CHROMEOS) && defined(RUN_MESSAGE_CENTER_TESTS) | 411 #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX) && \ |
| 412 defined(RUN_MESSAGE_CENTER_TESTS) |
| 416 #define MAYBE_HideWhenFullscreenEnabled HideWhenFullscreenEnabled | 413 #define MAYBE_HideWhenFullscreenEnabled HideWhenFullscreenEnabled |
| 417 #else | 414 #else |
| 418 #define MAYBE_HideWhenFullscreenEnabled DISABLED_HideWhenFullscreenEnabled | 415 #define MAYBE_HideWhenFullscreenEnabled DISABLED_HideWhenFullscreenEnabled |
| 419 #endif | 416 #endif |
| 420 | 417 |
| 421 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | 418 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, |
| 422 MAYBE_HideWhenFullscreenEnabled) { | 419 MAYBE_HideWhenFullscreenEnabled) { |
| 423 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | 420 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); |
| 424 | 421 |
| 425 TestDelegate* delegate; | 422 TestDelegate* delegate; |
| 426 manager()->Add(CreateTestNotification("n", &delegate), profile()); | 423 manager()->Add(CreateTestNotification("n", &delegate), profile()); |
| 427 | 424 |
| 428 EXPECT_EQ("Display_", delegate->log()); | 425 EXPECT_EQ("Display_", delegate->log()); |
| 429 EXPECT_TRUE(message_center()->HasPopupNotifications()); | 426 EXPECT_TRUE(message_center()->HasPopupNotifications()); |
| 430 bool is_fullscreen = true; | 427 bool is_fullscreen = true; |
| 431 // Cast so that Observe() is public. | 428 // Cast so that Observe() is public. |
| 432 content::NotificationObserver* observer = | 429 content::NotificationObserver* observer = |
| 433 static_cast<content::NotificationObserver*>(manager()); | 430 static_cast<content::NotificationObserver*>(manager()); |
| 434 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 431 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 435 content::Source<Profile>(profile()), | 432 content::Source<Profile>(profile()), |
| 436 content::Details<bool>(&is_fullscreen)); | 433 content::Details<bool>(&is_fullscreen)); |
| 437 EXPECT_FALSE(message_center()->HasPopupNotifications()); | 434 EXPECT_FALSE(message_center()->HasPopupNotifications()); |
| 438 } | 435 } |
| 439 | |
| 440 #endif // !defined(OS_MACOSX) | |
| OLD | NEW |