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

Side by Side Diff: chrome/browser/extensions/service_worker_apitest.cc

Issue 1851423003: Make Web Push use InstanceID tokens instead of GCM registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid4default
Patch Set: Fix GN/GYP Created 4 years, 8 months 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 // Start the ServiceWorker. 725 // Start the ServiceWorker.
726 ExtensionTestMessageListener ready_listener("SERVICE_WORKER_READY", false); 726 ExtensionTestMessageListener ready_listener("SERVICE_WORKER_READY", false);
727 ready_listener.set_failure_message("SERVICE_WORKER_FAILURE"); 727 ready_listener.set_failure_message("SERVICE_WORKER_FAILURE");
728 const char* kScript = "window.runServiceWorker()"; 728 const char* kScript = "window.runServiceWorker()";
729 EXPECT_TRUE(content::ExecuteScript(web_contents->GetMainFrame(), kScript)); 729 EXPECT_TRUE(content::ExecuteScript(web_contents->GetMainFrame(), kScript));
730 EXPECT_TRUE(ready_listener.WaitUntilSatisfied()); 730 EXPECT_TRUE(ready_listener.WaitUntilSatisfied());
731 731
732 PushMessagingAppIdentifier app_identifier = 732 PushMessagingAppIdentifier app_identifier =
733 GetAppIdentifierForServiceWorkerRegistration(0LL, extension_url); 733 GetAppIdentifierForServiceWorkerRegistration(0LL, extension_url);
734 ASSERT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id());
735 EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
736 734
737 // Send a push message via gcm and expect the ServiceWorker to receive it. 735 // Send a push message via gcm and expect the ServiceWorker to receive it.
738 ExtensionTestMessageListener push_message_listener("OK", false); 736 ExtensionTestMessageListener push_message_listener("OK", false);
739 push_message_listener.set_failure_message("FAIL"); 737 push_message_listener.set_failure_message("FAIL");
740 gcm::IncomingMessage message; 738 gcm::IncomingMessage message;
741 message.sender_id = "1234567890"; 739 message.sender_id = "1234567890";
742 message.raw_data = "testdata"; 740 message.raw_data = "testdata";
743 message.decrypted = true; 741 message.decrypted = true;
744 push_service()->OnMessage(app_identifier.app_id(), message); 742 push_service()->OnMessage(app_identifier.app_id(), message);
745 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); 743 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied());
746 } 744 }
747 745
748 } // namespace extensions 746 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698