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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1079 ASSERT_TRUE(RunScript("permissionState()", &script_result)); | 1079 ASSERT_TRUE(RunScript("permissionState()", &script_result)); |
1080 EXPECT_EQ("permission status - granted", script_result); | 1080 EXPECT_EQ("permission status - granted", script_result); |
1081 | 1081 |
1082 scoped_refptr<content::MessageLoopRunner> message_loop_runner = | 1082 scoped_refptr<content::MessageLoopRunner> message_loop_runner = |
1083 new content::MessageLoopRunner; | 1083 new content::MessageLoopRunner; |
1084 push_service()->SetContentSettingChangedCallbackForTesting( | 1084 push_service()->SetContentSettingChangedCallbackForTesting( |
1085 base::BarrierClosure(4, message_loop_runner->QuitClosure())); | 1085 base::BarrierClosure(4, message_loop_runner->QuitClosure())); |
1086 | 1086 |
1087 GURL origin = https_server()->GetURL("/").GetOrigin(); | 1087 GURL origin = https_server()->GetURL("/").GetOrigin(); |
1088 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) | 1088 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
1089 ->SetContentSetting(ContentSettingsPattern::Wildcard(), | 1089 ->SetContentSettingCustomScope(ContentSettingsPattern::Wildcard(), |
raymes
2016/03/21 06:07:20
nit: I think we could use SetDefaultContentSetting
lshang
2016/03/22 01:26:53
Done.
| |
1090 ContentSettingsPattern::Wildcard(), | 1090 ContentSettingsPattern::Wildcard(), |
1091 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), | 1091 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
1092 CONTENT_SETTING_ALLOW); | 1092 std::string(), CONTENT_SETTING_ALLOW); |
1093 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) | 1093 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
1094 ->SetContentSetting(ContentSettingsPattern::FromString("https://*"), | 1094 ->SetContentSettingCustomScope( |
1095 ContentSettingsPattern::FromString("https://*"), | 1095 ContentSettingsPattern::FromString("https://*"), |
1096 CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, std::string(), | 1096 ContentSettingsPattern::FromString("https://*"), |
1097 CONTENT_SETTING_ALLOW); | 1097 CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, std::string(), |
1098 CONTENT_SETTING_ALLOW); | |
1098 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) | 1099 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
1099 ->SetContentSettingDefaultScope(origin, GURL(), | 1100 ->SetContentSettingDefaultScope(origin, GURL(), |
1100 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 1101 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
1101 std::string(), CONTENT_SETTING_DEFAULT); | 1102 std::string(), CONTENT_SETTING_DEFAULT); |
1102 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) | 1103 HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
1103 ->SetContentSettingDefaultScope(origin, origin, | 1104 ->SetContentSettingDefaultScope(origin, origin, |
1104 CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, | 1105 CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, |
1105 std::string(), CONTENT_SETTING_DEFAULT); | 1106 std::string(), CONTENT_SETTING_DEFAULT); |
1106 | 1107 |
1107 message_loop_runner->Run(); | 1108 message_loop_runner->Run(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1294 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1295 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
1295 | 1296 |
1296 // After dropping the last subscription background mode is still inactive. | 1297 // After dropping the last subscription background mode is still inactive. |
1297 std::string script_result; | 1298 std::string script_result; |
1298 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); | 1299 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); |
1299 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 1300 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
1300 EXPECT_EQ("unsubscribe result: true", script_result); | 1301 EXPECT_EQ("unsubscribe result: true", script_result); |
1301 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1302 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
1302 } | 1303 } |
1303 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 1304 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
OLD | NEW |