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

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

Issue 1442083002: Stop inheriting push notification permissions from regular to incognito (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/notification_permission_context.h" 5 #include "chrome/browser/notifications/notification_permission_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 8 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 NotificationPermissionContext context(&profile); 54 NotificationPermissionContext context(&profile);
55 EXPECT_EQ(CONTENT_SETTING_ASK, 55 EXPECT_EQ(CONTENT_SETTING_ASK,
56 context.GetPermissionStatus(origin, origin)); 56 context.GetPermissionStatus(origin, origin));
57 57
58 context.UpdateContentSetting(origin, origin, CONTENT_SETTING_ALLOW); 58 context.UpdateContentSetting(origin, origin, CONTENT_SETTING_ALLOW);
59 59
60 EXPECT_EQ(CONTENT_SETTING_ALLOW, 60 EXPECT_EQ(CONTENT_SETTING_ALLOW,
61 context.GetPermissionStatus(origin, origin)); 61 context.GetPermissionStatus(origin, origin));
62 } 62 }
63
64 TEST(NotificationPermissionContextTest, NotInheritedInIncognito) {
65 content::TestBrowserThreadBundle thread_bundle;
66 TestingProfile regular_profile;
67 Profile* incognito_profile = regular_profile.GetOffTheRecordProfile();
68
69 GURL origin("http://example.com");
70
71 NotificationPermissionContext regular_context(&regular_profile);
72 NotificationPermissionContext incognito_context(incognito_profile);
73 EXPECT_EQ(CONTENT_SETTING_ASK,
74 regular_context.GetPermissionStatus(origin, origin));
75 EXPECT_EQ(CONTENT_SETTING_ASK,
76 incognito_context.GetPermissionStatus(origin, origin));
77
78 regular_context.UpdateContentSetting(origin, origin, CONTENT_SETTING_ALLOW);
79
80 EXPECT_EQ(CONTENT_SETTING_ALLOW,
81 regular_context.GetPermissionStatus(origin, origin));
82 EXPECT_EQ(CONTENT_SETTING_ASK,
83 incognito_context.GetPermissionStatus(origin, origin));
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698