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

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

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: include base/logging.h for NOTIMPLEMENTED 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 notification.delegate()->ButtonClick(0); 550 notification.delegate()->ButtonClick(0);
551 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 551 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
552 EXPECT_EQ("action_button_click actionId1", script_result); 552 EXPECT_EQ("action_button_click actionId1", script_result);
553 553
554 notification.delegate()->ButtonClick(1); 554 notification.delegate()->ButtonClick(1);
555 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 555 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
556 EXPECT_EQ("action_button_click actionId2", script_result); 556 EXPECT_EQ("action_button_click actionId2", script_result);
557 } 557 }
558 558
559 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, 559 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
560 DisplayPersistentNotificationWithReplyButton) {
561 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
562
563 std::string script_result;
564 ASSERT_TRUE(RunScript("DisplayPersistentNotificationWithReplyButton()",
565 &script_result));
566 EXPECT_EQ("ok", script_result);
567 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
568
569 const Notification& notification = ui_manager()->GetNotificationAt(0);
570 ASSERT_EQ(1u, notification.buttons().size());
571 EXPECT_EQ("actionTitle1", base::UTF16ToUTF8(notification.buttons()[0].title));
572
573 notification.delegate()->ButtonClickWithReply(0, base::ASCIIToUTF16("hello"));
574 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
575 EXPECT_EQ("action_button_click actionId1 hello", script_result);
576 }
577
578 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
560 TestShouldDisplayNormal) { 579 TestShouldDisplayNormal) {
561 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); 580 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
562 EnableFullscreenNotifications(); 581 EnableFullscreenNotifications();
563 582
564 std::string script_result; 583 std::string script_result;
565 ASSERT_TRUE(RunScript( 584 ASSERT_TRUE(RunScript(
566 "DisplayPersistentNotification('display_normal')", &script_result)); 585 "DisplayPersistentNotification('display_normal')", &script_result));
567 EXPECT_EQ("ok", script_result); 586 EXPECT_EQ("ok", script_result);
568 587
569 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 588 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 696
678 ASSERT_FALSE(browser()->window()->IsActive()); 697 ASSERT_FALSE(browser()->window()->IsActive());
679 ASSERT_TRUE(other_browser->window()->IsActive()); 698 ASSERT_TRUE(other_browser->window()->IsActive());
680 699
681 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 700 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
682 const Notification& notification = ui_manager()->GetNotificationAt(0); 701 const Notification& notification = ui_manager()->GetNotificationAt(0);
683 EXPECT_FALSE(notification.delegate()->ShouldDisplayOverFullscreen()); 702 EXPECT_FALSE(notification.delegate()->ShouldDisplayOverFullscreen());
684 } 703 }
685 #endif 704 #endif
686 705
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698