OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 if (!IsPushSupported()) | 728 if (!IsPushSupported()) |
729 return; | 729 return; |
730 | 730 |
731 std::string script_result; | 731 std::string script_result; |
732 | 732 |
733 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); | 733 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); |
734 | 734 |
735 gcm_service()->AddExpectedUnregisterResponse(GCMClient::NETWORK_ERROR); | 735 gcm_service()->AddExpectedUnregisterResponse(GCMClient::NETWORK_ERROR); |
736 | 736 |
737 ASSERT_TRUE(RunScript("unregister()", &script_result)); | 737 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
738 EXPECT_EQ("unregister error: " | 738 EXPECT_EQ("unregister error: NetworkError: " |
739 "NetworkError: Failed to connect to the push server.", | 739 "Unregistration failed - could not connect to push server", |
740 script_result); | 740 script_result); |
741 } | 741 } |
742 | 742 |
743 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnregisterUnknownError) { | 743 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnregisterAbortError) { |
744 if (!IsPushSupported()) | 744 if (!IsPushSupported()) |
745 return; | 745 return; |
746 | 746 |
747 std::string script_result; | 747 std::string script_result; |
748 | 748 |
749 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); | 749 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); |
750 | 750 |
751 gcm_service()->AddExpectedUnregisterResponse(GCMClient::UNKNOWN_ERROR); | 751 gcm_service()->AddExpectedUnregisterResponse(GCMClient::UNKNOWN_ERROR); |
752 | 752 |
753 ASSERT_TRUE(RunScript("unregister()", &script_result)); | 753 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
754 EXPECT_EQ("unregister error: " | 754 EXPECT_EQ("unregister error: " |
755 "UnknownError: Unexpected error while trying to unregister from the" | 755 "AbortError: Unregistration failed - push service error", |
756 " push server.", script_result); | 756 script_result); |
757 } | 757 } |
758 | 758 |
759 #if defined(OS_ANDROID) | 759 #if defined(OS_ANDROID) |
760 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushUnavailableOnAndroidICS) { | 760 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushUnavailableOnAndroidICS) { |
761 // This test should only run on Android ICS to confirm that the Push API | 761 // This test should only run on Android ICS to confirm that the Push API |
762 // is not available on that version of Android. | 762 // is not available on that version of Android. |
763 if (IsPushSupported()) | 763 if (IsPushSupported()) |
764 return; | 764 return; |
765 | 765 |
766 std::string script_result; | 766 std::string script_result; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 // left without permission to use Push. | 1002 // left without permission to use Push. |
1003 | 1003 |
1004 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); | 1004 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); |
1005 EXPECT_EQ("permission status - granted", script_result); | 1005 EXPECT_EQ("permission status - granted", script_result); |
1006 | 1006 |
1007 ASSERT_TRUE(RunScript("hasRegistration()", &script_result)); | 1007 ASSERT_TRUE(RunScript("hasRegistration()", &script_result)); |
1008 EXPECT_EQ("true - registered", script_result); | 1008 EXPECT_EQ("true - registered", script_result); |
1009 } | 1009 } |
1010 | 1010 |
1011 } // namespace gcm | 1011 } // namespace gcm |
OLD | NEW |