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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service_unittest.cc

Issue 7831075: Delegating the "are images allowed" decision to renderer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased. Created 9 years, 2 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 #include "chrome/browser/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "chrome/browser/content_settings/host_content_settings_map.h"
12 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 11 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
15 #include "content/browser/browser_thread.h" 14 #include "content/browser/browser_thread.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen ter.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen ter.h"
18 17
19 namespace { 18 namespace {
20 19
21 // The HasPermission method of the DesktopNotificationService wants to be called 20 // The HasPermission method of the DesktopNotificationService wants to be called
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionAllowed, 154 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionAllowed,
156 proxy_->ServiceHasPermission(service_, https_url)); 155 proxy_->ServiceHasPermission(service_, https_url));
157 } 156 }
158 157
159 TEST_F(DesktopNotificationServiceTest, GetNotificationsSettings) { 158 TEST_F(DesktopNotificationServiceTest, GetNotificationsSettings) {
160 service_->GrantPermission(GURL("http://allowed2.com")); 159 service_->GrantPermission(GURL("http://allowed2.com"));
161 service_->GrantPermission(GURL("http://allowed.com")); 160 service_->GrantPermission(GURL("http://allowed.com"));
162 service_->DenyPermission(GURL("http://denied2.com")); 161 service_->DenyPermission(GURL("http://denied2.com"));
163 service_->DenyPermission(GURL("http://denied.com")); 162 service_->DenyPermission(GURL("http://denied.com"));
164 163
165 HostContentSettingsMap::SettingsForOneType settings; 164 ContentSettingsForOneType settings;
166 service_->GetNotificationsSettings(&settings); 165 service_->GetNotificationsSettings(&settings);
167 ASSERT_EQ(4u, settings.size()); 166 ASSERT_EQ(4u, settings.size());
168 167
169 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard( 168 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
170 GURL("http://allowed.com")), 169 GURL("http://allowed.com")),
171 settings[0].a); 170 settings[0].a);
172 EXPECT_EQ(CONTENT_SETTING_ALLOW, 171 EXPECT_EQ(CONTENT_SETTING_ALLOW,
173 settings[0].c); 172 settings[0].c);
174 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard( 173 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
175 GURL("http://allowed2.com")), 174 GURL("http://allowed2.com")),
176 settings[1].a); 175 settings[1].a);
177 EXPECT_EQ(CONTENT_SETTING_ALLOW, 176 EXPECT_EQ(CONTENT_SETTING_ALLOW,
178 settings[1].c); 177 settings[1].c);
179 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard( 178 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
180 GURL("http://denied.com")), 179 GURL("http://denied.com")),
181 settings[2].a); 180 settings[2].a);
182 EXPECT_EQ(CONTENT_SETTING_BLOCK, 181 EXPECT_EQ(CONTENT_SETTING_BLOCK,
183 settings[2].c); 182 settings[2].c);
184 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard( 183 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
185 GURL("http://denied2.com")), 184 GURL("http://denied2.com")),
186 settings[3].a); 185 settings[3].a);
187 EXPECT_EQ(CONTENT_SETTING_BLOCK, 186 EXPECT_EQ(CONTENT_SETTING_BLOCK,
188 settings[3].c); 187 settings[3].c);
189 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698