OLD | NEW |
1 // Copyright (c) 2011 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_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "chrome/browser/notifications/balloon_collection_impl.h" | 13 #include "chrome/browser/notifications/balloon_collection_impl.h" |
14 #include "chrome/browser/notifications/desktop_notification_service.h" | 14 #include "chrome/browser/notifications/desktop_notification_service.h" |
15 #include "chrome/browser/notifications/notification.h" | 15 #include "chrome/browser/notifications/notification.h" |
16 #include "chrome/browser/notifications/notification_test_util.h" | 16 #include "chrome/browser/notifications/notification_test_util.h" |
17 #include "chrome/browser/notifications/notification_ui_manager.h" | 17 #include "chrome/browser/notifications/notification_ui_manager.h" |
18 #include "chrome/browser/notifications/notifications_prefs_cache.h" | 18 #include "chrome/browser/notifications/notifications_prefs_cache.h" |
19 #include "chrome/test/base/testing_browser_process_test.h" | |
20 #include "chrome/test/base/testing_pref_service.h" | 19 #include "chrome/test/base/testing_pref_service.h" |
21 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
22 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
24 | 23 |
25 class DesktopNotificationsTest; | 24 class DesktopNotificationsTest; |
26 typedef LoggingNotificationDelegate<DesktopNotificationsTest> | 25 typedef LoggingNotificationDelegate<DesktopNotificationsTest> |
27 LoggingNotificationProxy; | 26 LoggingNotificationProxy; |
28 | 27 |
29 // Test version of the balloon collection which counts the number | 28 // Test version of the balloon collection which counts the number |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 60 |
62 // Returns the bounding box. | 61 // Returns the bounding box. |
63 gfx::Rect GetBalloonsBoundingBox() { | 62 gfx::Rect GetBalloonsBoundingBox() { |
64 return BalloonCollectionImpl::GetBalloonsBoundingBox(); | 63 return BalloonCollectionImpl::GetBalloonsBoundingBox(); |
65 } | 64 } |
66 | 65 |
67 private: | 66 private: |
68 std::deque<Balloon*> balloons_; | 67 std::deque<Balloon*> balloons_; |
69 }; | 68 }; |
70 | 69 |
71 class DesktopNotificationsTest : public TestingBrowserProcessTest { | 70 class DesktopNotificationsTest : public testing::Test { |
72 public: | 71 public: |
73 DesktopNotificationsTest(); | 72 DesktopNotificationsTest(); |
74 virtual ~DesktopNotificationsTest(); | 73 virtual ~DesktopNotificationsTest(); |
75 | 74 |
76 static void log(const std::string& message) { | 75 static void log(const std::string& message) { |
77 log_output_.append(message); | 76 log_output_.append(message); |
78 } | 77 } |
79 | 78 |
80 Profile* profile() { return profile_.get(); } | 79 Profile* profile() { return profile_.get(); } |
81 | 80 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 scoped_ptr<NotificationUIManager> ui_manager_; | 116 scoped_ptr<NotificationUIManager> ui_manager_; |
118 | 117 |
119 // Real DesktopNotificationService | 118 // Real DesktopNotificationService |
120 scoped_ptr<DesktopNotificationService> service_; | 119 scoped_ptr<DesktopNotificationService> service_; |
121 | 120 |
122 // Contains the cumulative output of the unit test. | 121 // Contains the cumulative output of the unit test. |
123 static std::string log_output_; | 122 static std::string log_output_; |
124 }; | 123 }; |
125 | 124 |
126 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 125 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
OLD | NEW |