| 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_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/chromeos/cros/cros_library.h" | 14 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 15 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" | 15 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" |
| 16 #include "chrome/browser/notifications/balloon.h" | 16 #include "chrome/browser/notifications/balloon.h" |
| 17 #include "chrome/browser/notifications/desktop_notification_service.h" | 17 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 18 #include "chrome/browser/notifications/notification.h" | 18 #include "chrome/browser/notifications/notification.h" |
| 19 #include "chrome/browser/notifications/notification_test_util.h" | 19 #include "chrome/browser/notifications/notification_test_util.h" |
| 20 #include "chrome/browser/notifications/notification_ui_manager.h" | 20 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/test/base/testing_pref_service.h" | 22 #include "chrome/test/base/testing_pref_service.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 24 #include "content/test/test_browser_thread.h" | 24 #include "content/test/test_browser_thread.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 struct DesktopNotificationHostMsg_Show_Params; | 27 namespace content { |
| 28 struct ShowDesktopNotificationHostMsgParams; |
| 29 } |
| 28 | 30 |
| 29 namespace chromeos { | 31 namespace chromeos { |
| 30 | 32 |
| 31 class DesktopNotificationsTest; | 33 class DesktopNotificationsTest; |
| 32 typedef LoggingNotificationDelegate<DesktopNotificationsTest> | 34 typedef LoggingNotificationDelegate<DesktopNotificationsTest> |
| 33 LoggingNotificationProxy; | 35 LoggingNotificationProxy; |
| 34 | 36 |
| 35 // Test version of the balloon collection which counts the number | 37 // Test version of the balloon collection which counts the number |
| 36 // of notifications that are added to it. | 38 // of notifications that are added to it. |
| 37 class MockBalloonCollection : public BalloonCollectionImpl { | 39 class MockBalloonCollection : public BalloonCollectionImpl { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 81 |
| 80 void DenyOrigin(const GURL& origin) { | 82 void DenyOrigin(const GURL& origin) { |
| 81 service_->DenyPermission(origin); | 83 service_->DenyPermission(origin); |
| 82 } | 84 } |
| 83 | 85 |
| 84 int HasPermission(const GURL& origin) { | 86 int HasPermission(const GURL& origin) { |
| 85 return service_->HasPermission(origin); | 87 return service_->HasPermission(origin); |
| 86 } | 88 } |
| 87 | 89 |
| 88 // Constructs a notification parameter structure for use in tests. | 90 // Constructs a notification parameter structure for use in tests. |
| 89 DesktopNotificationHostMsg_Show_Params StandardTestNotification(); | 91 content::ShowDesktopNotificationHostMsgParams StandardTestNotification(); |
| 90 | 92 |
| 91 // Create a message loop to allow notifications code to post tasks, | 93 // Create a message loop to allow notifications code to post tasks, |
| 92 // and a thread so that notifications code runs on the expected thread. | 94 // and a thread so that notifications code runs on the expected thread. |
| 93 MessageLoopForUI message_loop_; | 95 MessageLoopForUI message_loop_; |
| 94 content::TestBrowserThread ui_thread_; | 96 content::TestBrowserThread ui_thread_; |
| 95 | 97 |
| 96 // Mock local state. | 98 // Mock local state. |
| 97 TestingPrefService local_state_; | 99 TestingPrefService local_state_; |
| 98 | 100 |
| 99 // Test profile. | 101 // Test profile. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 111 // Contains the cumulative output of the unit test. | 113 // Contains the cumulative output of the unit test. |
| 112 static std::string log_output_; | 114 static std::string log_output_; |
| 113 | 115 |
| 114 // Initializes / shuts down a stub CrosLibrary. | 116 // Initializes / shuts down a stub CrosLibrary. |
| 115 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 117 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 } // namespace chromeos | 120 } // namespace chromeos |
| 119 | 121 |
| 120 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_
H_ | 122 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_
H_ |
| OLD | NEW |