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

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: Rebase (remove force_subtype_for_app_id) Created 4 years, 4 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 755
756 // Start the ServiceWorker. 756 // Start the ServiceWorker.
757 ExtensionTestMessageListener ready_listener("SERVICE_WORKER_READY", false); 757 ExtensionTestMessageListener ready_listener("SERVICE_WORKER_READY", false);
758 ready_listener.set_failure_message("SERVICE_WORKER_FAILURE"); 758 ready_listener.set_failure_message("SERVICE_WORKER_FAILURE");
759 const char* kScript = "window.runServiceWorker()"; 759 const char* kScript = "window.runServiceWorker()";
760 EXPECT_TRUE(content::ExecuteScript(web_contents->GetMainFrame(), kScript)); 760 EXPECT_TRUE(content::ExecuteScript(web_contents->GetMainFrame(), kScript));
761 EXPECT_TRUE(ready_listener.WaitUntilSatisfied()); 761 EXPECT_TRUE(ready_listener.WaitUntilSatisfied());
762 762
763 PushMessagingAppIdentifier app_identifier = 763 PushMessagingAppIdentifier app_identifier =
764 GetAppIdentifierForServiceWorkerRegistration(0LL, extension_url); 764 GetAppIdentifierForServiceWorkerRegistration(0LL, extension_url);
765 ASSERT_EQ(app_identifier.app_id(), gcm_service()->last_registered_app_id());
766 EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
Devlin 2016/08/24 21:34:58 Why are we taking this out?
johnme 2016/08/24 22:03:44 Those debug accessors do not support Instance ID.
767 765
768 base::RunLoop run_loop; 766 base::RunLoop run_loop;
769 // Send a push message via gcm and expect the ServiceWorker to receive it. 767 // Send a push message via gcm and expect the ServiceWorker to receive it.
770 ExtensionTestMessageListener push_message_listener("OK", false); 768 ExtensionTestMessageListener push_message_listener("OK", false);
771 push_message_listener.set_failure_message("FAIL"); 769 push_message_listener.set_failure_message("FAIL");
772 gcm::IncomingMessage message; 770 gcm::IncomingMessage message;
773 message.sender_id = "1234567890"; 771 message.sender_id = "1234567890";
774 message.raw_data = "testdata"; 772 message.raw_data = "testdata";
775 message.decrypted = true; 773 message.decrypted = true;
776 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); 774 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure());
777 push_service()->OnMessage(app_identifier.app_id(), message); 775 push_service()->OnMessage(app_identifier.app_id(), message);
778 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); 776 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied());
779 run_loop.Run(); // Wait until the message is handled by push service. 777 run_loop.Run(); // Wait until the message is handled by push service.
780 } 778 }
781 779
782 } // namespace extensions 780 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698