| 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, Unregister) { |
| 486 std::string script_result; |
| 487 |
| 488 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
| 489 ASSERT_EQ("ok - service worker registered", script_result); |
| 490 |
| 491 InfoBarResponder accepting_responder(browser(), true); |
| 492 ASSERT_TRUE(RunScript("requestNotificationPermission();", &script_result)); |
| 493 EXPECT_EQ("permission status - granted", script_result); |
| 494 |
| 495 ASSERT_TRUE(RunScript("registerPush()", &script_result)); |
| 496 EXPECT_EQ(std::string(kPushMessagingEndpoint) + " - 1-0", script_result); |
| 497 |
| 498 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
| 499 EXPECT_EQ("unregister result: true", script_result); |
| 500 } |
| 501 |
| 485 } // namespace gcm | 502 } // namespace gcm |
| OLD | NEW |