Chromium Code Reviews| Index: chrome/browser/push_messaging/push_messaging_browsertest.cc |
| diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc |
| index 2543d79dd4824a2ae26f2cd7165fd98a6125ee35..9f802210df3d613dc28131d0233cce8aaf867eef 100644 |
| --- a/chrome/browser/push_messaging/push_messaging_browsertest.cc |
| +++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc |
| @@ -55,6 +55,17 @@ |
| #endif |
| namespace { |
| + |
| +// NIST P-256 public key made available to tests. Must be an uncompressed |
| +// point in accordance with SEC1 2.3.3. |
| +const uint8_t kApplicationServerKey[65] = { |
| + 0x04, 0x55, 0x52, 0x6A, 0xA5, 0x6E, 0x8E, 0xAA, 0x47, 0x97, 0x36, |
| + 0x10, 0xC1, 0x66, 0x3C, 0x1E, 0x65, 0xBF, 0xA1, 0x7B, 0xEE, 0x48, |
| + 0xC9, 0xC6, 0xBB, 0xBF, 0x02, 0x18, 0x53, 0x72, 0x1D, 0x0C, 0x7B, |
| + 0xA9, 0xE3, 0x11, 0xB7, 0x03, 0x52, 0x21, 0xD3, 0x71, 0x90, 0x13, |
| + 0xA8, 0xC1, 0xCF, 0xED, 0x20, 0xF7, 0x1F, 0xD1, 0x7F, 0xF2, 0x76, |
| + 0xB6, 0x01, 0x20, 0xD8, 0x35, 0xA5, 0xD9, 0x3C, 0x43, 0xFD}; |
| + |
| // Class to instantiate on the stack that is meant to be used with |
| // FakeGCMProfileService. The ::Run() method follows the signature of |
| // FakeGCMProfileService::UnregisterCallback. |
| @@ -101,7 +112,7 @@ class PushMessagingBrowserTest : public InProcessBrowserTest { |
| } |
| void SetUpCommandLine(base::CommandLine* command_line) override { |
| - // Enable experiemntal features for subscription restrictions. |
| + // Enable experimental features for subscription restrictions. |
| command_line->AppendSwitch( |
| switches::kEnableExperimentalWebPlatformFeatures); |
| InProcessBrowserTest::SetUpCommandLine(command_line); |
| @@ -265,10 +276,13 @@ void PushMessagingBrowserTest::TryToSubscribeSuccessfully( |
| RequestAndAcceptPermission(); |
| if (use_key) { |
| - EXPECT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("removeManifest()", &script_result)); |
| + ASSERT_EQ("manifest removed", script_result); |
| + |
| + EXPECT_TRUE(RunScript("documentSubscribePush()", &script_result)); |
| } else { |
| // Test backwards compatibility with old ID based subscriptions. |
| - EXPECT_TRUE(RunScript("subscribePushWithoutKey()", &script_result)); |
| + EXPECT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); |
| } |
| EXPECT_EQ(GetEndpointForSubscriptionId(expected_push_subscription_info), |
| @@ -312,7 +326,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
|
Michael van Ouwerkerk
2016/03/30 09:50:04
nit: a small helper function like "getTestApplicat
harkness
2016/03/30 10:51:49
Done.
|
| + gcm_service()->last_registered_sender_ids()[0]); |
| } |
| IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| @@ -324,13 +339,14 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| GetPermissionBubbleManager()->set_auto_response_for_test( |
| PermissionBubbleManager::ACCEPT_ALL); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePush()", &script_result)); |
| EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result); |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| } |
| IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureBadKey) { |
| @@ -341,7 +357,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureBadKey) { |
| RequestAndAcceptPermission(); |
| - ASSERT_TRUE(RunScript("subscribePushBadKey()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePushBadKey()", &script_result)); |
| EXPECT_EQ( |
| "InvalidAccessError - Failed to execute 'subscribe' on 'PushManager': " |
| "The provided applicationServerKey is not valid.", |
| @@ -357,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| RequestAndDenyPermission(); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePush()", &script_result)); |
| EXPECT_EQ("PermissionDeniedError - Registration failed - permission denied", |
| script_result); |
| } |
| @@ -373,7 +389,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureNoManifest) { |
| ASSERT_TRUE(RunScript("removeManifest()", &script_result)); |
| ASSERT_EQ("manifest removed", script_result); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); |
| EXPECT_EQ("AbortError - Registration failed - manifest empty or missing", |
| script_result); |
| } |
| @@ -389,14 +405,12 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureNoSenderId) { |
| ASSERT_TRUE(RunScript("swapManifestNoSenderId()", &script_result)); |
| ASSERT_EQ("sender id removed from manifest", script_result); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); |
| EXPECT_EQ( |
| "AbortError - Registration failed - gcm_sender_id not found in manifest", |
| script_result); |
| } |
| -// TODO(johnme): Test subscribing from a worker - see https://crbug.com/437298. |
| - |
| IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTestEmptySubscriptionOptions, |
| RegisterFailureEmptyPushSubscriptionOptions) { |
| std::string script_result; |
| @@ -406,11 +420,87 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTestEmptySubscriptionOptions, |
| RequestAndAcceptPermission(); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePush()", &script_result)); |
| EXPECT_EQ("PermissionDeniedError - Registration failed - permission denied", |
| script_result); |
| } |
| +IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeWorker) { |
| + std::string script_result; |
| + |
| + ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
| + ASSERT_EQ("ok - service worker registered", script_result); |
| + |
| + RequestAndAcceptPermission(); |
| + |
| + LoadTestPage(); // Reload to become controlled. |
| + |
| + ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| + ASSERT_EQ("true - is controlled", script_result); |
| + |
| + // Try to subscribe from a worker without a key. This should fail. |
| + ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| + EXPECT_EQ( |
| + "AbortError - Registration failed - gcm_sender_id not found in manifest", |
| + script_result); |
| + // Now run the subscribe from the service worker with a key. This |
| + // should succeed, and write the key to the datastore. |
| + ASSERT_TRUE(RunScript("workerSubscribePush()", &script_result)); |
| + EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result); |
| + |
| + ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| + EXPECT_EQ("unsubscribe result: true", script_result); |
| + EXPECT_NE(push_service(), GetAppHandler()); |
| + |
| + // Now run the subscribe from the service worker without a key. |
| + // In this case, the key will be read from the datastore. |
| + ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| + EXPECT_EQ(GetEndpointForSubscriptionId("1-1"), script_result); |
| + |
| + ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| + EXPECT_EQ("unsubscribe result: true", script_result); |
| + EXPECT_NE(push_service(), GetAppHandler()); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeWorkerUsingManifest) { |
| + std::string script_result; |
| + |
| + ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
| + ASSERT_EQ("ok - service worker registered", script_result); |
| + |
| + RequestAndAcceptPermission(); |
| + |
| + LoadTestPage(); // Reload to become controlled. |
| + |
| + ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| + ASSERT_EQ("true - is controlled", script_result); |
| + |
| + // Try to subscribe from a worker without a key. This should fail. |
| + ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| + EXPECT_EQ( |
| + "AbortError - Registration failed - gcm_sender_id not found in manifest", |
| + script_result); |
| + EXPECT_NE(push_service(), GetAppHandler()); |
| + |
| + // Run the subscription from the document without a key, this will |
| + // trigger the code to read the manifest and will write to the datastore. |
| + ASSERT_TRUE(RunScript("documentSubscribePushWithoutKey()", &script_result)); |
| + EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result); |
| + |
| + ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| + EXPECT_EQ("unsubscribe result: true", script_result); |
| + EXPECT_NE(push_service(), GetAppHandler()); |
| + |
| + // Now run the subscribe from the service worker without a key. |
| + // In this case, the key will be read from the datastore. |
|
Michael van Ouwerkerk
2016/03/30 09:50:04
nit: be a bit more explicit by calling out this is
harkness
2016/03/30 10:51:49
Done.
|
| + ASSERT_TRUE(RunScript("workerSubscribePushNoKey()", &script_result)); |
| + EXPECT_EQ(GetEndpointForSubscriptionId("1-1"), script_result); |
| + |
| + ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| + EXPECT_EQ("unsubscribe result: true", script_result); |
| + EXPECT_NE(push_service(), GetAppHandler()); |
| +} |
| + |
| // Disabled on Windows and Linux due to flakiness (http://crbug.com/554003). |
| #if defined(OS_WIN) || defined(OS_LINUX) |
| #define MAYBE_SubscribePersisted DISABLED_SubscribePersisted |
| @@ -506,7 +596,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventSuccess) { |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| ASSERT_EQ("false - is not controlled", script_result); |
| @@ -517,7 +608,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventSuccess) { |
| ASSERT_EQ("true - is controlled", script_result); |
| gcm::IncomingMessage message; |
| - message.sender_id = "1234567890"; |
| + message.sender_id = |
| + std::string(reinterpret_cast<const char*>(kApplicationServerKey)); |
| message.raw_data = "testdata"; |
| message.decrypted = true; |
| push_service()->OnMessage(app_identifier.app_id(), message); |
| @@ -533,7 +625,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventWithoutPayload) { |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| ASSERT_EQ("false - is not controlled", script_result); |
| @@ -544,7 +637,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventWithoutPayload) { |
| ASSERT_EQ("true - is controlled", script_result); |
| gcm::IncomingMessage message; |
| - message.sender_id = "1234567890"; |
| + message.sender_id = |
| + std::string(reinterpret_cast<const char*>(kApplicationServerKey)); |
| message.decrypted = false; |
| push_service()->OnMessage(app_identifier.app_id(), message); |
| @@ -560,7 +654,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoServiceWorker) { |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| ASSERT_EQ("false - is not controlled", script_result); |
| @@ -581,7 +676,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoServiceWorker) { |
| base::Bind(&UnregistrationCallback::Run, base::Unretained(&callback))); |
| gcm::IncomingMessage message; |
| - message.sender_id = "1234567890"; |
| + message.sender_id = |
| + std::string(reinterpret_cast<const char*>(kApplicationServerKey)); |
| message.raw_data = "testdata"; |
| message.decrypted = true; |
| push_service()->OnMessage(app_identifier.app_id(), message); |
| @@ -604,7 +700,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| ASSERT_EQ("false - is not controlled", script_result); |
| @@ -625,7 +722,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| // If the site is visible in an active tab, we should not force a notification |
| // to be shown. Try it twice, since we allow one mistake per 10 push events. |
| gcm::IncomingMessage message; |
| - message.sender_id = "1234567890"; |
| + message.sender_id = |
| + std::string(reinterpret_cast<const char*>(kApplicationServerKey)); |
| message.decrypted = true; |
| for (int n = 0; n < 2; n++) { |
| message.raw_data = "testdata"; |
| @@ -711,7 +809,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| ASSERT_EQ("false - is not controlled", script_result); |
| @@ -729,7 +828,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| std::vector<size_t> number_of_notifications_shown; |
| gcm::IncomingMessage message; |
| - message.sender_id = "1234567890"; |
| + message.sender_id = |
| + std::string(reinterpret_cast<const char*>(kApplicationServerKey)); |
| message.decrypted = true; |
| { |
| @@ -764,7 +864,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| PushMessagingAppIdentifier app_identifier = |
| GetAppIdentifierForServiceWorkerRegistration(0LL); |
| EXPECT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id()); |
| - EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); |
| + EXPECT_EQ(reinterpret_cast<const char*>(kApplicationServerKey), |
| + gcm_service()->last_registered_sender_ids()[0]); |
| ASSERT_TRUE(RunScript("isControlled()", &script_result)); |
| ASSERT_EQ("false - is not controlled", script_result); |
| @@ -780,7 +881,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| message_loop_runner->QuitClosure()); |
| gcm::IncomingMessage message; |
| - message.sender_id = "1234567890"; |
| + message.sender_id = |
| + std::string(reinterpret_cast<const char*>(kApplicationServerKey)); |
| message.raw_data = "shownotification-without-waituntil"; |
| message.decrypted = true; |
| push_service()->OnMessage(app_identifier.app_id(), message); |
| @@ -817,7 +919,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysGranted) { |
| RequestAndAcceptPermission(); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePush()", &script_result)); |
| EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result); |
| ASSERT_TRUE(RunScript("permissionState()", &script_result)); |
| @@ -832,7 +934,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysDenied) { |
| RequestAndDenyPermission(); |
| - ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
| + ASSERT_TRUE(RunScript("documentSubscribePush()", &script_result)); |
| EXPECT_EQ("PermissionDeniedError - Registration failed - permission denied", |
| script_result); |
| @@ -847,7 +949,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) { |
| EXPECT_EQ("ok - service worker registered", script_result); |
| // Resolves true if there was a subscription. |
| - TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */); |
| + TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */, false); |
| gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); |
| ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| EXPECT_EQ("unsubscribe result: true", script_result); |
| @@ -858,7 +960,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) { |
| // Doesn't reject if there was a network error (deactivates subscription |
| // locally anyway). |
| - TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */); |
| + TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */, false); |
| gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::NETWORK_ERROR); |
| ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| EXPECT_EQ("unsubscribe result: true", script_result); |
| @@ -867,7 +969,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) { |
| // Doesn't reject if there were other push service errors (deactivates |
| // subscription locally anyway). |
| - TryToSubscribeSuccessfully("1-2" /* expected_push_subscription_id */); |
| + TryToSubscribeSuccessfully("1-2" /* expected_push_subscription_id */, false); |
| gcm_service()->AddExpectedUnregisterResponse( |
| gcm::GCMClient::INVALID_PARAMETER); |
| ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| @@ -875,7 +977,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) { |
| // Unsubscribing (with an existing reference to a PushSubscription), after |
| // unregistering the Service Worker, just means push subscription isn't found. |
| - TryToSubscribeSuccessfully("1-3" /* expected_push_subscription_id */); |
| + TryToSubscribeSuccessfully("1-3" /* expected_push_subscription_id */, false); |
| ASSERT_TRUE(RunScript("unregisterServiceWorker()", &script_result)); |
| ASSERT_EQ("service worker unregistration status: true", script_result); |
| ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| @@ -902,6 +1004,9 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
| ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_PUSH_MESSAGING); |
| + HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
| + ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| + |
| message_loop_runner->Run(); |
| ASSERT_TRUE(RunScript("permissionState()", &script_result)); |
| @@ -933,6 +1038,10 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| ->SetContentSettingDefaultScope(origin, origin, |
| CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, |
| std::string(), CONTENT_SETTING_DEFAULT); |
| + HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
| + ->SetContentSettingDefaultScope(origin, origin, |
| + CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| + std::string(), CONTENT_SETTING_DEFAULT); |
| message_loop_runner->Run(); |
| @@ -1192,6 +1301,8 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| // TODO(johnme): Get this test running on Android, which has a different |
| // codepath due to sender_id being required for unsubscribing there. |
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
| + ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
| + HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile()) |
| ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_PUSH_MESSAGING); |
| run_loop.Run(); |
| @@ -1204,7 +1315,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, |
| } |
| IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, EncryptionKeyUniqueness) { |
| - TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */); |
| + TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */, false); |
| std::string first_public_key; |
| ASSERT_TRUE(RunScript("GetP256dh()", &first_public_key)); |