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

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

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

Powered by Google App Engine
This is Rietveld 408576698