| 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 net::HostPortPair host_port = ServerHostPort(); | 403 net::HostPortPair host_port = ServerHostPort(); |
| 404 | 404 |
| 405 const Notification& notification = ui_manager()->GetNotificationAt(0); | 405 const Notification& notification = ui_manager()->GetNotificationAt(0); |
| 406 | 406 |
| 407 EXPECT_TRUE(notification.context_message().empty()); | 407 EXPECT_TRUE(notification.context_message().empty()); |
| 408 EXPECT_EQ("https://" + host_port.ToString() + "/", | 408 EXPECT_EQ("https://" + host_port.ToString() + "/", |
| 409 notification.origin_url().spec()); | 409 notification.origin_url().spec()); |
| 410 } | 410 } |
| 411 | 411 |
| 412 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
| 413 PersistentNotificationServiceWorkerScope) { |
| 414 RequestAndAcceptPermission(); |
| 415 |
| 416 // Creates a simple notification. |
| 417 std::string script_result; |
| 418 ASSERT_TRUE(RunScript("DisplayPersistentNotification()", &script_result)); |
| 419 |
| 420 const Notification& notification = ui_manager()->GetNotificationAt(0); |
| 421 |
| 422 EXPECT_EQ(TestPageUrl().spec(), notification.service_worker_scope().spec()); |
| 423 } |
| 424 |
| 412 // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is | 425 // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is |
| 413 // persisted. crbug.com/502057 | 426 // persisted. crbug.com/502057 |
| 414 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, | 427 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
| 415 DISABLED_CheckFilePermissionNotGranted) { | 428 DISABLED_CheckFilePermissionNotGranted) { |
| 416 // This case should succeed because a normal page URL is used. | 429 // This case should succeed because a normal page URL is used. |
| 417 std::string script_result; | 430 std::string script_result; |
| 418 | 431 |
| 419 PermissionManager* permission_manager = | 432 PermissionManager* permission_manager = |
| 420 PermissionManager::Get(browser()->profile()); | 433 PermissionManager::Get(browser()->profile()); |
| 421 | 434 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); | 519 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); |
| 507 | 520 |
| 508 notification.delegate()->ButtonClick(0); | 521 notification.delegate()->ButtonClick(0); |
| 509 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | 522 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); |
| 510 EXPECT_EQ("action_button_click actionId1", script_result); | 523 EXPECT_EQ("action_button_click actionId1", script_result); |
| 511 | 524 |
| 512 notification.delegate()->ButtonClick(1); | 525 notification.delegate()->ButtonClick(1); |
| 513 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | 526 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); |
| 514 EXPECT_EQ("action_button_click actionId2", script_result); | 527 EXPECT_EQ("action_button_click actionId2", script_result); |
| 515 } | 528 } |
| OLD | NEW |