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

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

Issue 661643002: Adds a context message of the security origin for web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses peter's comments. Created 6 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/bind.h"
6 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
7 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "chrome/test/base/testing_profile.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 class DesktopNotificationServiceTest : public ChromeRenderViewHostTestHarness {
12 protected:
13 virtual void SetUp() {
14 ChromeRenderViewHostTestHarness::SetUp();
15 }
16 };
17
18
19 TEST_F(DesktopNotificationServiceTest, GetNotificationsSettings) {
20 DesktopNotificationProfileUtil::GrantPermission(profile(),
21 GURL("http://allowed2.com"));
22 DesktopNotificationProfileUtil::GrantPermission(profile(),
23 GURL("http://allowed.com"));
24 DesktopNotificationProfileUtil::DenyPermission(profile(),
25 GURL("http://denied2.com"));
26 DesktopNotificationProfileUtil::DenyPermission(profile(),
27 GURL("http://denied.com"));
28
29 ContentSettingsForOneType settings;
30 DesktopNotificationProfileUtil::GetNotificationsSettings(
31 profile(), &settings);
32 // |settings| contains the default setting and 4 exceptions.
33 ASSERT_EQ(5u, settings.size());
34
35 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
36 GURL("http://allowed.com")),
37 settings[0].primary_pattern);
38 EXPECT_EQ(CONTENT_SETTING_ALLOW,
39 settings[0].setting);
40 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
41 GURL("http://allowed2.com")),
42 settings[1].primary_pattern);
43 EXPECT_EQ(CONTENT_SETTING_ALLOW,
44 settings[1].setting);
45 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
46 GURL("http://denied.com")),
47 settings[2].primary_pattern);
48 EXPECT_EQ(CONTENT_SETTING_BLOCK,
49 settings[2].setting);
50 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
51 GURL("http://denied2.com")),
52 settings[3].primary_pattern);
53 EXPECT_EQ(CONTENT_SETTING_BLOCK,
54 settings[3].setting);
55 EXPECT_EQ(ContentSettingsPattern::Wildcard(),
56 settings[4].primary_pattern);
57 EXPECT_EQ(CONTENT_SETTING_ASK,
58 settings[4].setting);
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698