OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/push_messaging/push_messaging_permission_context.h" | 5 #include "chrome/browser/push_messaging/push_messaging_permission_context.h" |
| 6 |
| 7 #include "chrome/browser/permissions/permission_request_id.h" |
6 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
7 #include "components/content_settings/core/browser/host_content_settings_map.h" | 9 #include "components/content_settings/core/browser/host_content_settings_map.h" |
8 #include "components/content_settings/core/common/content_settings.h" | 10 #include "components/content_settings/core/common/content_settings.h" |
9 #include "components/content_settings/core/common/content_settings_types.h" | 11 #include "components/content_settings/core/common/content_settings_types.h" |
10 #include "components/content_settings/core/common/permission_request_id.h" | |
11 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 const char kOriginA[] = "https://origina.org"; | 15 const char kOriginA[] = "https://origina.org"; |
15 const char kOriginB[] = "https://originb.org"; | 16 const char kOriginB[] = "https://originb.org"; |
16 | 17 |
17 class TestPushMessagingPermissionContext | 18 class TestPushMessagingPermissionContext |
18 : public PushMessagingPermissionContext { | 19 : public PushMessagingPermissionContext { |
19 public: | 20 public: |
20 explicit TestPushMessagingPermissionContext(Profile* profile) | 21 explicit TestPushMessagingPermissionContext(Profile* profile) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 EXPECT_TRUE(context.was_persisted()); | 154 EXPECT_TRUE(context.was_persisted()); |
154 EXPECT_FALSE(context.was_granted()); | 155 EXPECT_FALSE(context.was_granted()); |
155 | 156 |
156 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, | 157 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, |
157 CONTENT_SETTING_ASK); | 158 CONTENT_SETTING_ASK); |
158 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA), | 159 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA), |
159 callback, CONTENT_SETTING_ALLOW); | 160 callback, CONTENT_SETTING_ALLOW); |
160 EXPECT_TRUE(context.was_persisted()); | 161 EXPECT_TRUE(context.was_persisted()); |
161 EXPECT_TRUE(context.was_granted()); | 162 EXPECT_TRUE(context.was_granted()); |
162 } | 163 } |
OLD | NEW |