Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Side by Side Diff: chrome/browser/notifications/desktop_notifications_unittest.h

Issue 7810017: Revert 98938 - Migrate Obsolete NotificationsSettings and remove content_settings::NotificationsP... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/test/base/testing_pref_service.h" 19 #include "chrome/test/base/testing_pref_service.h"
19 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
20 #include "content/browser/browser_thread.h" 21 #include "content/browser/browser_thread.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 23
23 class DesktopNotificationsTest; 24 class DesktopNotificationsTest;
24 typedef LoggingNotificationDelegate<DesktopNotificationsTest> 25 typedef LoggingNotificationDelegate<DesktopNotificationsTest>
25 LoggingNotificationProxy; 26 LoggingNotificationProxy;
26 27
27 // Test version of the balloon collection which counts the number 28 // Test version of the balloon collection which counts the number
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 virtual void TearDown(); 84 virtual void TearDown();
84 85
85 void AllowOrigin(const GURL& origin) { 86 void AllowOrigin(const GURL& origin) {
86 service_->GrantPermission(origin); 87 service_->GrantPermission(origin);
87 } 88 }
88 89
89 void DenyOrigin(const GURL& origin) { 90 void DenyOrigin(const GURL& origin) {
90 service_->DenyPermission(origin); 91 service_->DenyPermission(origin);
91 } 92 }
92 93
94 int HasPermission(const GURL& origin) {
95 return service_->prefs_cache()->HasPermission(origin);
96 }
97
93 // Constructs a notification parameter structure for use in tests. 98 // Constructs a notification parameter structure for use in tests.
94 DesktopNotificationHostMsg_Show_Params StandardTestNotification(); 99 DesktopNotificationHostMsg_Show_Params StandardTestNotification();
95 100
96 // Create a message loop to allow notifications code to post tasks, 101 // Create a message loop to allow notifications code to post tasks,
97 // and a thread so that notifications code runs on the expected thread. 102 // and a thread so that notifications code runs on the expected thread.
98 MessageLoopForUI message_loop_; 103 MessageLoopForUI message_loop_;
99 BrowserThread ui_thread_; 104 BrowserThread ui_thread_;
100 105
101 // Local state mock. 106 // Local state mock.
102 TestingPrefService local_state_; 107 TestingPrefService local_state_;
103 108
104 // Test profile. 109 // Test profile.
105 scoped_ptr<TestingProfile> profile_; 110 scoped_ptr<TestingProfile> profile_;
106 111
107 // Mock balloon collection -- owned by the NotificationUIManager 112 // Mock balloon collection -- owned by the NotificationUIManager
108 MockBalloonCollection* balloon_collection_; 113 MockBalloonCollection* balloon_collection_;
109 114
110 // Real UI manager. 115 // Real UI manager.
111 scoped_ptr<NotificationUIManager> ui_manager_; 116 scoped_ptr<NotificationUIManager> ui_manager_;
112 117
113 // Real DesktopNotificationService 118 // Real DesktopNotificationService
114 scoped_ptr<DesktopNotificationService> service_; 119 scoped_ptr<DesktopNotificationService> service_;
115 120
116 // Contains the cumulative output of the unit test. 121 // Contains the cumulative output of the unit test.
117 static std::string log_output_; 122 static std::string log_output_;
118 }; 123 };
119 124
120 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ 125 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698