| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_thread.h" | 15 #include "chrome/browser/browser_thread.h" |
| 16 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" | 16 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" |
| 17 #include "chrome/browser/notifications/balloon.h" | 17 #include "chrome/browser/notifications/balloon.h" |
| 18 #include "chrome/browser/notifications/desktop_notification_service.h" | 18 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 19 #include "chrome/browser/notifications/notification.h" | 19 #include "chrome/browser/notifications/notification.h" |
| 20 #include "chrome/browser/notifications/notification_test_util.h" | 20 #include "chrome/browser/notifications/notification_test_util.h" |
| 21 #include "chrome/browser/notifications/notification_ui_manager.h" | 21 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 22 #include "chrome/browser/notifications/notifications_prefs_cache.h" | 22 #include "chrome/browser/notifications/notifications_prefs_cache.h" |
| 23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
| 24 #include "chrome/test/testing_pref_service.h" |
| 24 #include "chrome/test/testing_profile.h" | 25 #include "chrome/test/testing_profile.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 27 |
| 27 namespace chromeos { | 28 namespace chromeos { |
| 28 | 29 |
| 29 class DesktopNotificationsTest; | 30 class DesktopNotificationsTest; |
| 30 typedef LoggingNotificationDelegate<DesktopNotificationsTest> | 31 typedef LoggingNotificationDelegate<DesktopNotificationsTest> |
| 31 LoggingNotificationProxy; | 32 LoggingNotificationProxy; |
| 32 | 33 |
| 33 // Test version of the balloon collection which counts the number | 34 // Test version of the balloon collection which counts the number |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 84 } |
| 84 | 85 |
| 85 // Constructs a notification parameter structure for use in tests. | 86 // Constructs a notification parameter structure for use in tests. |
| 86 ViewHostMsg_ShowNotification_Params StandardTestNotification(); | 87 ViewHostMsg_ShowNotification_Params StandardTestNotification(); |
| 87 | 88 |
| 88 // Create a message loop to allow notifications code to post tasks, | 89 // Create a message loop to allow notifications code to post tasks, |
| 89 // and a thread so that notifications code runs on the expected thread. | 90 // and a thread so that notifications code runs on the expected thread. |
| 90 MessageLoopForUI message_loop_; | 91 MessageLoopForUI message_loop_; |
| 91 BrowserThread ui_thread_; | 92 BrowserThread ui_thread_; |
| 92 | 93 |
| 94 // Mock local state. |
| 95 TestingPrefService local_state_; |
| 96 |
| 93 // Test profile. | 97 // Test profile. |
| 94 scoped_ptr<TestingProfile> profile_; | 98 scoped_ptr<TestingProfile> profile_; |
| 95 | 99 |
| 96 // Mock balloon collection -- owned by the NotificationUIManager | 100 // Mock balloon collection -- owned by the NotificationUIManager |
| 97 MockBalloonCollection* balloon_collection_; | 101 MockBalloonCollection* balloon_collection_; |
| 98 | 102 |
| 99 // Real UI manager. | 103 // Real UI manager. |
| 100 scoped_ptr<NotificationUIManager> ui_manager_; | 104 scoped_ptr<NotificationUIManager> ui_manager_; |
| 101 | 105 |
| 102 // Real DesktopNotificationService | 106 // Real DesktopNotificationService |
| 103 scoped_ptr<DesktopNotificationService> service_; | 107 scoped_ptr<DesktopNotificationService> service_; |
| 104 | 108 |
| 105 // Contains the cumulative output of the unit test. | 109 // Contains the cumulative output of the unit test. |
| 106 static std::string log_output_; | 110 static std::string log_output_; |
| 107 }; | 111 }; |
| 108 | 112 |
| 109 } // namespace chromeos | 113 } // namespace chromeos |
| 110 | 114 |
| 111 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_
H_ | 115 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_
H_ |
| OLD | NEW |