| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 EXPECT_EQ("permission status - denied", script_result); | 475 EXPECT_EQ("permission status - denied", script_result); |
| 476 | 476 |
| 477 ASSERT_TRUE(RunScript("registerPush()", &script_result)); | 477 ASSERT_TRUE(RunScript("registerPush()", &script_result)); |
| 478 EXPECT_EQ("AbortError - Registration failed - permission denied", | 478 EXPECT_EQ("AbortError - Registration failed - permission denied", |
| 479 script_result); | 479 script_result); |
| 480 | 480 |
| 481 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); | 481 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); |
| 482 EXPECT_EQ("permission status - denied", script_result); | 482 EXPECT_EQ("permission status - denied", script_result); |
| 483 } | 483 } |
| 484 | 484 |
| 485 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnregisterSuccess) { |
| 486 std::string script_result; |
| 487 |
| 488 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); |
| 489 |
| 490 gcm_service()->AddExpectedUnregisterResponse(GCMClient::SUCCESS); |
| 491 |
| 492 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
| 493 EXPECT_EQ("unregister result: true", script_result); |
| 494 } |
| 495 |
| 496 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnregisterNetworkError) { |
| 497 std::string script_result; |
| 498 |
| 499 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); |
| 500 |
| 501 gcm_service()->AddExpectedUnregisterResponse(GCMClient::NETWORK_ERROR); |
| 502 |
| 503 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
| 504 EXPECT_EQ("unregister error: " |
| 505 "NetworkError: Failed to connect to the push server.", |
| 506 script_result); |
| 507 } |
| 508 |
| 509 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnregisterUnknownError) { |
| 510 std::string script_result; |
| 511 |
| 512 TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */); |
| 513 |
| 514 gcm_service()->AddExpectedUnregisterResponse(GCMClient::UNKNOWN_ERROR); |
| 515 |
| 516 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
| 517 EXPECT_EQ("unregister error: " |
| 518 "UnknownError: Unexpected error while trying to unregister from the" |
| 519 " push server.", script_result); |
| 520 } |
| 521 |
| 485 } // namespace gcm | 522 } // namespace gcm |
| OLD | NEW |