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

Unified Diff: ui/message_center/views/custom_notification_view_unittest.cc

Issue 2547433002: Transfer responsibility for providing a close button for a notification to each implementation of M… (Closed)
Patch Set: Delete debug logs Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/message_center/views/custom_notification_view_unittest.cc
diff --git a/ui/message_center/views/custom_notification_view_unittest.cc b/ui/message_center/views/custom_notification_view_unittest.cc
index a5d87f41846290234a417daec410378db4d6526f..fdd1bf0c89a4cb37b3cce2bac568b27d5b51859e 100644
--- a/ui/message_center/views/custom_notification_view_unittest.cc
+++ b/ui/message_center/views/custom_notification_view_unittest.cc
@@ -66,13 +66,23 @@ class TestCustomView : public views::View {
DISALLOW_COPY_AND_ASSIGN(TestCustomView);
};
+class TestContentViewDelegate : public CustomNotificationContentViewDelegate {
+ public:
+ bool IsCloseButtonFocused() const override { return false; }
+ void RequestFocusOnCloseButton() override {}
+ bool IsPinned() const override { return false; }
+};
+
class TestNotificationDelegate : public NotificationDelegate {
public:
TestNotificationDelegate() {}
// NotificateDelegate
- std::unique_ptr<views::View> CreateCustomContent() override {
- return base::WrapUnique(new TestCustomView);
+ std::tuple<std::unique_ptr<views::View>,
+ std::unique_ptr<CustomNotificationContentViewDelegate>>
+ CreateCustomContent() override {
+ return std::make_tuple(base::WrapUnique(new TestCustomView),
+ base::WrapUnique(new TestContentViewDelegate));
}
private:
@@ -187,9 +197,6 @@ class CustomNotificationViewTest : public views::ViewsTestBase {
widget()->OnKeyEvent(&event);
}
- views::ImageButton* close_button() {
- return notification_view_->close_button();
- }
TestMessageCenterController* controller() { return &controller_; }
Notification* notification() { return notification_.get(); }
TestCustomView* custom_view() {
@@ -210,15 +217,6 @@ TEST_F(CustomNotificationViewTest, Background) {
EXPECT_EQ(kBackgroundColor, GetBackgroundColor());
}
-TEST_F(CustomNotificationViewTest, ClickCloseButton) {
- widget()->Show();
-
- gfx::Point cursor_location(1, 1);
- views::View::ConvertPointToWidget(close_button(), &cursor_location);
- PerformClick(cursor_location);
- EXPECT_TRUE(controller()->IsRemoved(notification()->id()));
-}
-
TEST_F(CustomNotificationViewTest, Events) {
widget()->Show();
custom_view()->RequestFocus();

Powered by Google App Engine
This is Rietveld 408576698