Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: chrome/browser/notifications/platform_notification_service_interactive_uitest.cc

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: Remove todo as it doesn't seem necessary after all Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 notification.delegate()->ButtonClick(0); 531 notification.delegate()->ButtonClick(0);
532 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 532 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
533 EXPECT_EQ("action_button_click actionId1", script_result); 533 EXPECT_EQ("action_button_click actionId1", script_result);
534 534
535 notification.delegate()->ButtonClick(1); 535 notification.delegate()->ButtonClick(1);
536 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 536 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
537 EXPECT_EQ("action_button_click actionId2", script_result); 537 EXPECT_EQ("action_button_click actionId2", script_result);
538 } 538 }
539 539
540 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, 540 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
541 DisplayPersistentNotificationWithReplyButton) {
542 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
543
544 std::string script_result;
545 ASSERT_TRUE(RunScript("DisplayPersistentNotificationWithReplyButton()",
546 &script_result));
547 EXPECT_EQ("ok", script_result);
548 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
549
550 const Notification& notification = ui_manager()->GetNotificationAt(0);
551 ASSERT_EQ(1u, notification.buttons().size());
552 EXPECT_EQ("actionTitle1", base::UTF16ToUTF8(notification.buttons()[0].title));
553
554 notification.delegate()->ButtonClickWithReply(0, base::ASCIIToUTF16("hello"));
555 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
556 EXPECT_EQ("action_button_click actionId1 hello", script_result);
557 }
558
559 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
541 TestShouldDisplayNormal) { 560 TestShouldDisplayNormal) {
542 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); 561 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
543 562
544 std::string script_result; 563 std::string script_result;
545 ASSERT_TRUE(RunScript( 564 ASSERT_TRUE(RunScript(
546 "DisplayPersistentNotification('display_normal')", &script_result)); 565 "DisplayPersistentNotification('display_normal')", &script_result));
547 EXPECT_EQ("ok", script_result); 566 EXPECT_EQ("ok", script_result);
548 567
549 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 568 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
550 const Notification& notification = ui_manager()->GetNotificationAt(0); 569 const Notification& notification = ui_manager()->GetNotificationAt(0);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 639
621 ASSERT_FALSE(browser()->window()->IsActive()); 640 ASSERT_FALSE(browser()->window()->IsActive());
622 ASSERT_TRUE(other_browser->window()->IsActive()); 641 ASSERT_TRUE(other_browser->window()->IsActive());
623 642
624 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 643 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
625 const Notification& notification = ui_manager()->GetNotificationAt(0); 644 const Notification& notification = ui_manager()->GetNotificationAt(0);
626 EXPECT_FALSE(notification.delegate()->ShouldDisplayOverFullscreen()); 645 EXPECT_FALSE(notification.delegate()->ShouldDisplayOverFullscreen());
627 } 646 }
628 #endif 647 #endif
629 648
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698