| 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..c89a414ab520a57e2acf52fc1463f303459a11b5 100644
|
| --- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
|
| +++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
|
| @@ -55,6 +55,23 @@
|
| #endif
|
|
|
| namespace {
|
| +
|
| +// NIST P-256 public key made available to tests. Must be an uncompressed
|
| +// point in accordance with SEC1 2.3.3.
|
| +// Note: Although the key itself is only 65 bytes, we pad it with a 0x00 to
|
| +// make dcheck happy when it compares input and output as strings.
|
| +const uint8_t kApplicationServerKey[66] = {
|
| + 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, 0x00};
|
| +
|
| +const char* getTestApplicationServerKey() {
|
| + return reinterpret_cast<const char*>(kApplicationServerKey);
|
| +}
|
| +
|
| // 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 +118,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 +282,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 +332,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| @@ -324,13 +345,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureBadKey) {
|
| @@ -341,7 +363,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 +379,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 +395,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 +411,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 +426,88 @@ 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 sender id from the manifest and will write it 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 sender id 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());
|
| +}
|
| +
|
| // 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 +603,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
|
|
| ASSERT_TRUE(RunScript("isControlled()", &script_result));
|
| ASSERT_EQ("false - is not controlled", script_result);
|
| @@ -517,7 +615,7 @@ 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(getTestApplicationServerKey());
|
| message.raw_data = "testdata";
|
| message.decrypted = true;
|
| push_service()->OnMessage(app_identifier.app_id(), message);
|
| @@ -533,7 +631,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
|
|
| ASSERT_TRUE(RunScript("isControlled()", &script_result));
|
| ASSERT_EQ("false - is not controlled", script_result);
|
| @@ -544,7 +643,7 @@ 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(getTestApplicationServerKey());
|
| message.decrypted = false;
|
|
|
| push_service()->OnMessage(app_identifier.app_id(), message);
|
| @@ -560,7 +659,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
|
|
| ASSERT_TRUE(RunScript("isControlled()", &script_result));
|
| ASSERT_EQ("false - is not controlled", script_result);
|
| @@ -581,7 +681,7 @@ 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(getTestApplicationServerKey());
|
| message.raw_data = "testdata";
|
| message.decrypted = true;
|
| push_service()->OnMessage(app_identifier.app_id(), message);
|
| @@ -604,7 +704,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
|
|
| ASSERT_TRUE(RunScript("isControlled()", &script_result));
|
| ASSERT_EQ("false - is not controlled", script_result);
|
| @@ -625,7 +726,7 @@ 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(getTestApplicationServerKey());
|
| message.decrypted = true;
|
| for (int n = 0; n < 2; n++) {
|
| message.raw_data = "testdata";
|
| @@ -711,7 +812,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
|
|
| ASSERT_TRUE(RunScript("isControlled()", &script_result));
|
| ASSERT_EQ("false - is not controlled", script_result);
|
| @@ -729,7 +831,7 @@ 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(getTestApplicationServerKey());
|
| message.decrypted = true;
|
|
|
| {
|
| @@ -764,7 +866,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(getTestApplicationServerKey(),
|
| + gcm_service()->last_registered_sender_ids()[0]);
|
|
|
| ASSERT_TRUE(RunScript("isControlled()", &script_result));
|
| ASSERT_EQ("false - is not controlled", script_result);
|
| @@ -780,7 +883,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| message_loop_runner->QuitClosure());
|
|
|
| gcm::IncomingMessage message;
|
| - message.sender_id = "1234567890";
|
| + message.sender_id = std::string(getTestApplicationServerKey());
|
| message.raw_data = "shownotification-without-waituntil";
|
| message.decrypted = true;
|
| push_service()->OnMessage(app_identifier.app_id(), message);
|
| @@ -817,7 +920,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 +935,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 +950,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 +961,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 +970,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 +978,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 +1005,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 +1039,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 +1302,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 +1316,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));
|
|
|