OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 base::Unretained(this))); | 388 base::Unretained(this))); |
389 } | 389 } |
390 | 390 |
391 void RegisterCompleted(const std::string& registration_id, | 391 void RegisterCompleted(const std::string& registration_id, |
392 GCMClient::Result result) { | 392 GCMClient::Result result) { |
393 registration_id_ = registration_id; | 393 registration_id_ = registration_id; |
394 registration_result_ = result; | 394 registration_result_ = result; |
395 waiter_->SignalCompleted(); | 395 waiter_->SignalCompleted(); |
396 } | 396 } |
397 | 397 |
398 bool HasPersistedRegistrationInfo(const std::string& app_id) { | |
399 StateStore* storage = ExtensionSystem::Get(profile())->state_store(); | |
400 if (!storage) | |
401 return false; | |
402 has_persisted_registration_info_ = false; | |
403 storage->GetExtensionValue( | |
404 app_id, | |
405 GCMProfileService::GetPersistentRegisterKeyForTesting(), | |
406 base::Bind( | |
407 &GCMProfileServiceTestConsumer::ReadRegistrationInfoFinished, | |
408 base::Unretained(this))); | |
409 waiter_->WaitUntilCompleted(); | |
410 return has_persisted_registration_info_; | |
411 } | |
412 | |
413 void ReadRegistrationInfoFinished(scoped_ptr<base::Value> value) { | |
414 has_persisted_registration_info_ = value.get() != NULL; | |
415 waiter_->SignalCompleted(); | |
416 } | |
417 | |
418 void Send(const std::string& app_id, | 398 void Send(const std::string& app_id, |
419 const std::string& receiver_id, | 399 const std::string& receiver_id, |
420 const GCMClient::OutgoingMessage& message) { | 400 const GCMClient::OutgoingMessage& message) { |
421 GetGCMProfileService()->Send( | 401 GetGCMProfileService()->Send( |
422 app_id, | 402 app_id, |
423 receiver_id, | 403 receiver_id, |
424 message, | 404 message, |
425 base::Bind(&GCMProfileServiceTestConsumer::SendCompleted, | 405 base::Bind(&GCMProfileServiceTestConsumer::SendCompleted, |
426 base::Unretained(this))); | 406 base::Unretained(this))); |
427 } | 407 } |
(...skipping 26 matching lines...) Expand all Loading... |
454 } | 434 } |
455 | 435 |
456 const std::string& GetUsername() const { | 436 const std::string& GetUsername() const { |
457 return GetGCMProfileService()->username_; | 437 return GetGCMProfileService()->username_; |
458 } | 438 } |
459 | 439 |
460 bool IsGCMClientReady() const { | 440 bool IsGCMClientReady() const { |
461 return GetGCMProfileService()->gcm_client_ready_; | 441 return GetGCMProfileService()->gcm_client_ready_; |
462 } | 442 } |
463 | 443 |
464 bool ExistsCachedRegistrationInfo() const { | |
465 return !GetGCMProfileService()->registration_info_map_.empty(); | |
466 } | |
467 | |
468 bool HasAppHandlers() const { | 444 bool HasAppHandlers() const { |
469 return !GetGCMProfileService()->app_handlers_.empty(); | 445 return !GetGCMProfileService()->app_handlers_.empty(); |
470 } | 446 } |
471 | 447 |
472 Profile* profile() const { return profile_.get(); } | 448 Profile* profile() const { return profile_.get(); } |
473 FakeGCMAppHandler* gcm_app_handler() const { | 449 FakeGCMAppHandler* gcm_app_handler() const { |
474 return gcm_app_handler_.get(); | 450 return gcm_app_handler_.get(); |
475 } | 451 } |
476 | 452 |
477 void set_gcm_client_loading_delay(GCMClientMock::LoadingDelay delay) { | 453 void set_gcm_client_loading_delay(GCMClientMock::LoadingDelay delay) { |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 | 841 |
866 WaitUntilCompleted(); | 842 WaitUntilCompleted(); |
867 EXPECT_EQ(expected_registration_id, consumer()->registration_id()); | 843 EXPECT_EQ(expected_registration_id, consumer()->registration_id()); |
868 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 844 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
869 | 845 |
870 // Clears the results the would be set by the Register callback in preparation | 846 // Clears the results the would be set by the Register callback in preparation |
871 // to call register 2nd time. | 847 // to call register 2nd time. |
872 consumer()->clear_registration_result(); | 848 consumer()->clear_registration_result(); |
873 | 849 |
874 // Calling register 2nd time with the same set of sender IDs but different | 850 // Calling register 2nd time with the same set of sender IDs but different |
875 // ordering will get back the same registration ID. There is no need to wait | 851 // ordering will get back the same registration ID. |
876 // since register simply returns the cached registration ID. | |
877 std::vector<std::string> another_sender_ids; | 852 std::vector<std::string> another_sender_ids; |
878 another_sender_ids.push_back("sender2"); | 853 another_sender_ids.push_back("sender2"); |
879 another_sender_ids.push_back("sender1"); | 854 another_sender_ids.push_back("sender1"); |
880 consumer()->Register(kTestingAppId, another_sender_ids); | 855 consumer()->Register(kTestingAppId, another_sender_ids); |
| 856 |
| 857 WaitUntilCompleted(); |
881 EXPECT_EQ(expected_registration_id, consumer()->registration_id()); | 858 EXPECT_EQ(expected_registration_id, consumer()->registration_id()); |
882 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 859 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
883 } | 860 } |
884 | 861 |
885 TEST_F(GCMProfileServiceSingleProfileTest, | 862 TEST_F(GCMProfileServiceSingleProfileTest, |
886 RegisterAgainWithDifferentSenderIDs) { | 863 RegisterAgainWithDifferentSenderIDs) { |
887 std::vector<std::string> sender_ids; | 864 std::vector<std::string> sender_ids; |
888 sender_ids.push_back("sender1"); | 865 sender_ids.push_back("sender1"); |
889 consumer()->Register(kTestingAppId, sender_ids); | 866 consumer()->Register(kTestingAppId, sender_ids); |
890 std::string expected_registration_id = | 867 std::string expected_registration_id = |
891 GCMClientMock::GetRegistrationIdFromSenderIds(sender_ids); | 868 GCMClientMock::GetRegistrationIdFromSenderIds(sender_ids); |
892 | 869 |
893 WaitUntilCompleted(); | 870 WaitUntilCompleted(); |
894 EXPECT_EQ(expected_registration_id, consumer()->registration_id()); | 871 EXPECT_EQ(expected_registration_id, consumer()->registration_id()); |
895 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 872 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
896 | 873 |
897 // Make sender IDs different. | 874 // Make sender IDs different. |
898 sender_ids.push_back("sender2"); | 875 sender_ids.push_back("sender2"); |
899 std::string expected_registration_id2 = | 876 std::string expected_registration_id2 = |
900 GCMClientMock::GetRegistrationIdFromSenderIds(sender_ids); | 877 GCMClientMock::GetRegistrationIdFromSenderIds(sender_ids); |
901 | 878 |
902 // Calling register 2nd time with the different sender IDs will get back a new | 879 // Calling register 2nd time with the different sender IDs will get back a new |
903 // registration ID. | 880 // registration ID. |
904 consumer()->Register(kTestingAppId, sender_ids); | 881 consumer()->Register(kTestingAppId, sender_ids); |
905 WaitUntilCompleted(); | 882 WaitUntilCompleted(); |
906 EXPECT_EQ(expected_registration_id2, consumer()->registration_id()); | 883 EXPECT_EQ(expected_registration_id2, consumer()->registration_id()); |
907 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 884 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
908 } | 885 } |
909 | 886 |
910 TEST_F(GCMProfileServiceSingleProfileTest, ReadRegistrationFromStateStore) { | |
911 scoped_refptr<Extension> extension(consumer()->CreateExtension()); | |
912 | |
913 std::vector<std::string> sender_ids; | |
914 sender_ids.push_back("sender1"); | |
915 consumer()->Register(extension->id(), sender_ids); | |
916 | |
917 WaitUntilCompleted(); | |
918 EXPECT_FALSE(consumer()->registration_id().empty()); | |
919 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | |
920 std::string old_registration_id = consumer()->registration_id(); | |
921 | |
922 // Clears the results that would be set by the Register callback in | |
923 // preparation to call register 2nd time. | |
924 consumer()->clear_registration_result(); | |
925 | |
926 // Register should not reach the server. Forcing GCMClient server error should | |
927 // help catch this. | |
928 consumer()->set_gcm_client_error_simulation(GCMClientMock::FORCE_ERROR); | |
929 | |
930 // Simulate start-up by recreating GCMProfileService. | |
931 consumer()->CreateGCMProfileServiceInstance(); | |
932 | |
933 // Simulate start-up by reloading extension. | |
934 consumer()->ReloadExtension(extension); | |
935 | |
936 // This should read the registration info from the extension's state store. | |
937 consumer()->Register(extension->id(), sender_ids); | |
938 PumpIOLoop(); | |
939 PumpUILoop(); | |
940 EXPECT_EQ(old_registration_id, consumer()->registration_id()); | |
941 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | |
942 } | |
943 | |
944 TEST_F(GCMProfileServiceSingleProfileTest, | 887 TEST_F(GCMProfileServiceSingleProfileTest, |
945 GCMClientReadyAfterReadingRegistration) { | 888 GCMClientReadyAfterReadingRegistration) { |
946 scoped_refptr<Extension> extension(consumer()->CreateExtension()); | 889 scoped_refptr<Extension> extension(consumer()->CreateExtension()); |
947 | 890 |
948 std::vector<std::string> sender_ids; | 891 std::vector<std::string> sender_ids; |
949 sender_ids.push_back("sender1"); | 892 sender_ids.push_back("sender1"); |
950 consumer()->Register(extension->id(), sender_ids); | 893 consumer()->Register(extension->id(), sender_ids); |
951 | 894 |
952 WaitUntilCompleted(); | 895 WaitUntilCompleted(); |
953 EXPECT_FALSE(consumer()->registration_id().empty()); | 896 EXPECT_FALSE(consumer()->registration_id().empty()); |
(...skipping 18 matching lines...) Expand all Loading... |
972 EXPECT_TRUE(consumer()->registration_id().empty()); | 915 EXPECT_TRUE(consumer()->registration_id().empty()); |
973 EXPECT_EQ(GCMClient::UNKNOWN_ERROR, consumer()->registration_result()); | 916 EXPECT_EQ(GCMClient::UNKNOWN_ERROR, consumer()->registration_result()); |
974 | 917 |
975 // Register operation will be invoked after GCMClient becomes ready. | 918 // Register operation will be invoked after GCMClient becomes ready. |
976 consumer()->GetGCMClient()->PerformDelayedLoading(); | 919 consumer()->GetGCMClient()->PerformDelayedLoading(); |
977 WaitUntilCompleted(); | 920 WaitUntilCompleted(); |
978 EXPECT_EQ(old_registration_id, consumer()->registration_id()); | 921 EXPECT_EQ(old_registration_id, consumer()->registration_id()); |
979 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 922 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
980 } | 923 } |
981 | 924 |
982 TEST_F(GCMProfileServiceSingleProfileTest, | |
983 PersistedRegistrationInfoRemoveAfterSignOut) { | |
984 std::vector<std::string> sender_ids; | |
985 sender_ids.push_back("sender1"); | |
986 consumer()->Register(kTestingAppId, sender_ids); | |
987 WaitUntilCompleted(); | |
988 | |
989 // The app id and registration info should be persisted. | |
990 EXPECT_TRUE(profile()->GetPrefs()->HasPrefPath(prefs::kGCMRegisteredAppIDs)); | |
991 EXPECT_TRUE(consumer()->HasPersistedRegistrationInfo(kTestingAppId)); | |
992 | |
993 consumer()->SignOut(); | |
994 PumpUILoop(); | |
995 | |
996 // The app id and persisted registration info should be removed. | |
997 EXPECT_FALSE(profile()->GetPrefs()->HasPrefPath(prefs::kGCMRegisteredAppIDs)); | |
998 EXPECT_FALSE(consumer()->HasPersistedRegistrationInfo(kTestingAppId)); | |
999 } | |
1000 | |
1001 TEST_F(GCMProfileServiceSingleProfileTest, RegisterAfterSignOut) { | 925 TEST_F(GCMProfileServiceSingleProfileTest, RegisterAfterSignOut) { |
1002 // This will trigger check-out. | 926 // This will trigger check-out. |
1003 consumer()->SignOut(); | 927 consumer()->SignOut(); |
1004 | 928 |
1005 std::vector<std::string> sender_ids; | 929 std::vector<std::string> sender_ids; |
1006 sender_ids.push_back("sender1"); | 930 sender_ids.push_back("sender1"); |
1007 consumer()->Register(kTestingAppId, sender_ids); | 931 consumer()->Register(kTestingAppId, sender_ids); |
1008 | 932 |
1009 EXPECT_TRUE(consumer()->registration_id().empty()); | 933 EXPECT_TRUE(consumer()->registration_id().empty()); |
1010 EXPECT_EQ(GCMClient::NOT_SIGNED_IN, consumer()->registration_result()); | 934 EXPECT_EQ(GCMClient::NOT_SIGNED_IN, consumer()->registration_result()); |
1011 } | 935 } |
1012 | 936 |
1013 TEST_F(GCMProfileServiceSingleProfileTest, UnregisterImplicitly) { | 937 TEST_F(GCMProfileServiceSingleProfileTest, UnregisterImplicitly) { |
1014 scoped_refptr<Extension> extension(consumer()->CreateExtension()); | 938 scoped_refptr<Extension> extension(consumer()->CreateExtension()); |
1015 | 939 |
1016 std::vector<std::string> sender_ids; | 940 std::vector<std::string> sender_ids; |
1017 sender_ids.push_back("sender1"); | 941 sender_ids.push_back("sender1"); |
1018 consumer()->Register(extension->id(), sender_ids); | 942 consumer()->Register(extension->id(), sender_ids); |
1019 | 943 |
1020 WaitUntilCompleted(); | 944 WaitUntilCompleted(); |
1021 EXPECT_FALSE(consumer()->registration_id().empty()); | 945 EXPECT_FALSE(consumer()->registration_id().empty()); |
1022 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 946 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
1023 | 947 |
1024 // The registration info should be cached. | |
1025 EXPECT_TRUE(consumer()->ExistsCachedRegistrationInfo()); | |
1026 | |
1027 // The registration info should be persisted. | |
1028 EXPECT_TRUE(consumer()->HasPersistedRegistrationInfo(extension->id())); | |
1029 | |
1030 // Uninstall the extension. | 948 // Uninstall the extension. |
1031 consumer()->UninstallExtension(extension); | 949 consumer()->UninstallExtension(extension); |
1032 base::MessageLoop::current()->RunUntilIdle(); | 950 base::MessageLoop::current()->RunUntilIdle(); |
1033 | |
1034 // The cached registration info should be removed. | |
1035 EXPECT_FALSE(consumer()->ExistsCachedRegistrationInfo()); | |
1036 | |
1037 // The persisted registration info should be removed. | |
1038 EXPECT_FALSE(consumer()->HasPersistedRegistrationInfo(extension->id())); | |
1039 } | 951 } |
1040 | 952 |
1041 TEST_F(GCMProfileServiceSingleProfileTest, UnregisterExplicitly) { | 953 TEST_F(GCMProfileServiceSingleProfileTest, UnregisterExplicitly) { |
1042 std::vector<std::string> sender_ids; | 954 std::vector<std::string> sender_ids; |
1043 sender_ids.push_back("sender1"); | 955 sender_ids.push_back("sender1"); |
1044 consumer()->Register(kTestingAppId, sender_ids); | 956 consumer()->Register(kTestingAppId, sender_ids); |
1045 | 957 |
1046 WaitUntilCompleted(); | 958 WaitUntilCompleted(); |
1047 EXPECT_FALSE(consumer()->registration_id().empty()); | 959 EXPECT_FALSE(consumer()->registration_id().empty()); |
1048 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); | 960 EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result()); |
1049 | 961 |
1050 // The registration info should be cached. | |
1051 EXPECT_TRUE(consumer()->ExistsCachedRegistrationInfo()); | |
1052 | |
1053 // The registration info should be persisted. | |
1054 EXPECT_TRUE(consumer()->HasPersistedRegistrationInfo(kTestingAppId)); | |
1055 | |
1056 consumer()->Unregister(kTestingAppId); | 962 consumer()->Unregister(kTestingAppId); |
1057 | 963 |
1058 WaitUntilCompleted(); | 964 WaitUntilCompleted(); |
1059 EXPECT_EQ(GCMClient::SUCCESS, consumer()->unregistration_result()); | 965 EXPECT_EQ(GCMClient::SUCCESS, consumer()->unregistration_result()); |
1060 | |
1061 // The cached registration info should be removed. | |
1062 EXPECT_FALSE(consumer()->ExistsCachedRegistrationInfo()); | |
1063 | |
1064 // The persisted registration info should be removed. | |
1065 EXPECT_FALSE(consumer()->HasPersistedRegistrationInfo(kTestingAppId)); | |
1066 } | 966 } |
1067 | 967 |
1068 TEST_F(GCMProfileServiceSingleProfileTest, | 968 TEST_F(GCMProfileServiceSingleProfileTest, |
1069 UnregisterWhenAsyncOperationPending) { | 969 UnregisterWhenAsyncOperationPending) { |
1070 std::vector<std::string> sender_ids; | 970 std::vector<std::string> sender_ids; |
1071 sender_ids.push_back("sender1"); | 971 sender_ids.push_back("sender1"); |
1072 // First start registration without waiting for it to complete. | 972 // First start registration without waiting for it to complete. |
1073 consumer()->Register(kTestingAppId, sender_ids); | 973 consumer()->Register(kTestingAppId, sender_ids); |
1074 | 974 |
1075 // Test that unregistration fails with async operation pending when there is a | 975 // Test that unregistration fails with async operation pending when there is a |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 WaitUntilCompleted(); | 1099 WaitUntilCompleted(); |
1200 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, | 1100 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, |
1201 consumer()->gcm_app_handler()->received_event()); | 1101 consumer()->gcm_app_handler()->received_event()); |
1202 EXPECT_EQ(kTestingAppId, consumer()->gcm_app_handler()->app_id()); | 1102 EXPECT_EQ(kTestingAppId, consumer()->gcm_app_handler()->app_id()); |
1203 EXPECT_TRUE(message.data == consumer()->gcm_app_handler()->message().data); | 1103 EXPECT_TRUE(message.data == consumer()->gcm_app_handler()->message().data); |
1204 EXPECT_TRUE(consumer()->gcm_app_handler()->message().collapse_key.empty()); | 1104 EXPECT_TRUE(consumer()->gcm_app_handler()->message().collapse_key.empty()); |
1205 EXPECT_EQ(message.sender_id, | 1105 EXPECT_EQ(message.sender_id, |
1206 consumer()->gcm_app_handler()->message().sender_id); | 1106 consumer()->gcm_app_handler()->message().sender_id); |
1207 } | 1107 } |
1208 | 1108 |
1209 // Flaky on all platforms: http://crbug.com/354803 | |
1210 TEST_F(GCMProfileServiceSingleProfileTest, | |
1211 DISABLED_MessageNotReceivedFromNotRegisteredSender) { | |
1212 // Explicitly not registering the sender2 here, so that message gets dropped. | |
1213 consumer()->Register(kTestingAppId, ToSenderList("sender1")); | |
1214 WaitUntilCompleted(); | |
1215 GCMClient::IncomingMessage message; | |
1216 message.data["key1"] = "value1"; | |
1217 message.data["key2"] = "value2"; | |
1218 message.sender_id = "sender2"; | |
1219 consumer()->GetGCMClient()->ReceiveMessage(kTestingAppId, message); | |
1220 PumpUILoop(); | |
1221 EXPECT_EQ(FakeGCMAppHandler::NO_EVENT, | |
1222 consumer()->gcm_app_handler()->received_event()); | |
1223 consumer()->gcm_app_handler()->clear_results(); | |
1224 | |
1225 // Register for sender2 and try to receive the message again, which should | |
1226 // work with no problems. | |
1227 consumer()->Register(kTestingAppId, ToSenderList("sender1,sender2")); | |
1228 WaitUntilCompleted(); | |
1229 consumer()->GetGCMClient()->ReceiveMessage(kTestingAppId, message); | |
1230 WaitUntilCompleted(); | |
1231 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, | |
1232 consumer()->gcm_app_handler()->received_event()); | |
1233 consumer()->gcm_app_handler()->clear_results(); | |
1234 | |
1235 // Making sure that sender1 can receive the message as well. | |
1236 message.sender_id = "sender1"; | |
1237 consumer()->GetGCMClient()->ReceiveMessage(kTestingAppId, message); | |
1238 WaitUntilCompleted(); | |
1239 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, | |
1240 consumer()->gcm_app_handler()->received_event()); | |
1241 consumer()->gcm_app_handler()->clear_results(); | |
1242 | |
1243 // Register for sender1 only and make sure it is not possible to receive the | |
1244 // message again from from sender1. | |
1245 consumer()->Register(kTestingAppId, ToSenderList("sender2")); | |
1246 WaitUntilCompleted(); | |
1247 consumer()->GetGCMClient()->ReceiveMessage(kTestingAppId, message); | |
1248 PumpUILoop(); | |
1249 EXPECT_EQ(FakeGCMAppHandler::NO_EVENT, | |
1250 consumer()->gcm_app_handler()->received_event()); | |
1251 } | |
1252 | |
1253 TEST_F(GCMProfileServiceSingleProfileTest, MessageWithCollapseKeyReceived) { | 1109 TEST_F(GCMProfileServiceSingleProfileTest, MessageWithCollapseKeyReceived) { |
1254 consumer()->Register(kTestingAppId, ToSenderList("sender")); | 1110 consumer()->Register(kTestingAppId, ToSenderList("sender")); |
1255 WaitUntilCompleted(); | 1111 WaitUntilCompleted(); |
1256 GCMClient::IncomingMessage message; | 1112 GCMClient::IncomingMessage message; |
1257 message.data["key1"] = "value1"; | 1113 message.data["key1"] = "value1"; |
1258 message.collapse_key = "collapse_key_value"; | 1114 message.collapse_key = "collapse_key_value"; |
1259 message.sender_id = "sender"; | 1115 message.sender_id = "sender"; |
1260 consumer()->GetGCMClient()->ReceiveMessage(kTestingAppId, message); | 1116 consumer()->GetGCMClient()->ReceiveMessage(kTestingAppId, message); |
1261 WaitUntilCompleted(); | 1117 WaitUntilCompleted(); |
1262 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, | 1118 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 consumer()->gcm_app_handler()->clear_results(); | 1475 consumer()->gcm_app_handler()->clear_results(); |
1620 WaitUntilCompleted(); | 1476 WaitUntilCompleted(); |
1621 | 1477 |
1622 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, | 1478 EXPECT_EQ(FakeGCMAppHandler::MESSAGE_EVENT, |
1623 consumer()->gcm_app_handler()->received_event()); | 1479 consumer()->gcm_app_handler()->received_event()); |
1624 EXPECT_TRUE( | 1480 EXPECT_TRUE( |
1625 in_message5.data == consumer()->gcm_app_handler()->message().data); | 1481 in_message5.data == consumer()->gcm_app_handler()->message().data); |
1626 } | 1482 } |
1627 | 1483 |
1628 } // namespace gcm | 1484 } // namespace gcm |
OLD | NEW |