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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 EXPECT_EQ("permission status - denied", script_result); | 403 EXPECT_EQ("permission status - denied", script_result); |
404 | 404 |
405 ASSERT_TRUE(RunScript("registerPush()", &script_result)); | 405 ASSERT_TRUE(RunScript("registerPush()", &script_result)); |
406 EXPECT_EQ("AbortError - Registration failed - permission denied", | 406 EXPECT_EQ("AbortError - Registration failed - permission denied", |
407 script_result); | 407 script_result); |
408 | 408 |
409 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); | 409 ASSERT_TRUE(RunScript("hasPermission()", &script_result)); |
410 EXPECT_EQ("permission status - denied", script_result); | 410 EXPECT_EQ("permission status - denied", script_result); |
411 } | 411 } |
412 | 412 |
| 413 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, Unregister) { |
| 414 std::string script_result; |
| 415 |
| 416 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
| 417 ASSERT_EQ("ok - service worker registered", script_result); |
| 418 |
| 419 InfoBarResponder accepting_responder(browser(), true); |
| 420 ASSERT_TRUE(RunScript("requestNotificationPermission();", &script_result)); |
| 421 EXPECT_EQ("permission status - granted", script_result); |
| 422 |
| 423 ASSERT_TRUE(RunScript("registerPush()", &script_result)); |
| 424 EXPECT_EQ(std::string(kPushMessagingEndpoint) + " - 1", script_result); |
| 425 |
| 426 ASSERT_TRUE(RunScript("unregister()", &script_result)); |
| 427 EXPECT_EQ("unregister result: true", script_result); |
| 428 } |
| 429 |
413 } // namespace gcm | 430 } // namespace gcm |
OLD | NEW |