| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <memory> | 6 #include <memory> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "ui/arc/notification/arc_notification_content_view.h" | 12 #include "ui/arc/notification/arc_notification_content_view.h" |
| 13 #include "ui/arc/notification/arc_notification_delegate.h" | 13 #include "ui/arc/notification/arc_notification_delegate.h" |
| 14 #include "ui/arc/notification/arc_notification_item.h" | 14 #include "ui/arc/notification/arc_notification_item.h" |
| 15 #include "ui/arc/notification/arc_notification_surface.h" | 15 #include "ui/arc/notification/arc_notification_surface.h" |
| 16 #include "ui/arc/notification/arc_notification_view.h" | 16 #include "ui/arc/notification/arc_notification_view.h" |
| 17 #include "ui/aura/test/test_window_delegate.h" | 17 #include "ui/aura/test/test_window_delegate.h" |
| 18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 19 #include "ui/message_center/notification.h" | 19 #include "ui/message_center/notification.h" |
| 20 #include "ui/message_center/views/message_center_controller.h" | 20 #include "ui/message_center/views/message_center_controller.h" |
| 21 #include "ui/message_center/views/message_view_factory.h" | 21 #include "ui/message_center/views/message_view_factory.h" |
| 22 #include "ui/views/controls/button/image_button.h" | 22 #include "ui/message_center/views/notification_control_buttons_view.h" |
| 23 #include "ui/message_center/views/padded_button.h" |
| 23 #include "ui/views/test/views_test_base.h" | 24 #include "ui/views/test/views_test_base.h" |
| 24 | 25 |
| 25 namespace arc { | 26 namespace arc { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 constexpr char kNotificationIdPrefix[] = "ARC_NOTIFICATION_"; | 30 constexpr char kNotificationIdPrefix[] = "ARC_NOTIFICATION_"; |
| 30 | 31 |
| 31 class MockNotificationSurface : public ArcNotificationSurface { | 32 class MockNotificationSurface : public ArcNotificationSurface { |
| 32 public: | 33 public: |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 EXPECT_FALSE(wrapper_widget_); | 235 EXPECT_FALSE(wrapper_widget_); |
| 235 EXPECT_FALSE(notification_view_); | 236 EXPECT_FALSE(notification_view_); |
| 236 | 237 |
| 237 surface_manager_.reset(); | 238 surface_manager_.reset(); |
| 238 | 239 |
| 239 views::ViewsTestBase::TearDown(); | 240 views::ViewsTestBase::TearDown(); |
| 240 } | 241 } |
| 241 | 242 |
| 242 void PressCloseButton() { | 243 void PressCloseButton() { |
| 243 DummyEvent dummy_event; | 244 DummyEvent dummy_event; |
| 244 views::ImageButton* close_button = | 245 auto* control_buttons_view = |
| 245 GetArcNotificationContentView()->close_button_.get(); | 246 GetArcNotificationContentView()->control_buttons_view_; |
| 247 message_center::PaddedButton* close_button = |
| 248 control_buttons_view->close_button_for_testing(); |
| 246 ASSERT_NE(nullptr, close_button); | 249 ASSERT_NE(nullptr, close_button); |
| 247 GetArcNotificationContentView()->ButtonPressed(close_button, dummy_event); | 250 control_buttons_view->ButtonPressed(close_button, dummy_event); |
| 248 } | 251 } |
| 249 | 252 |
| 250 void CreateAndShowNotificationView( | 253 void CreateAndShowNotificationView( |
| 251 const message_center::Notification& notification) { | 254 const message_center::Notification& notification) { |
| 252 DCHECK(!notification_view_); | 255 DCHECK(!notification_view_); |
| 253 | 256 |
| 254 notification_view_.reset(static_cast<ArcNotificationView*>( | 257 notification_view_.reset(static_cast<ArcNotificationView*>( |
| 255 message_center::MessageViewFactory::Create(controller(), notification, | 258 message_center::MessageViewFactory::Create(controller(), notification, |
| 256 true))); | 259 true))); |
| 257 notification_view_->set_owned_by_client(); | 260 notification_view_->set_owned_by_client(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 365 |
| 363 EXPECT_EQ(1u, surface_manager()->surface_found_count()); | 366 EXPECT_EQ(1u, surface_manager()->surface_found_count()); |
| 364 EXPECT_FALSE(controller()->IsRemoved(notification_item->GetNotificationId())); | 367 EXPECT_FALSE(controller()->IsRemoved(notification_item->GetNotificationId())); |
| 365 PressCloseButton(); | 368 PressCloseButton(); |
| 366 EXPECT_TRUE(controller()->IsRemoved(notification_item->GetNotificationId())); | 369 EXPECT_TRUE(controller()->IsRemoved(notification_item->GetNotificationId())); |
| 367 | 370 |
| 368 CloseNotificationView(); | 371 CloseNotificationView(); |
| 369 } | 372 } |
| 370 | 373 |
| 371 } // namespace arc | 374 } // namespace arc |
| OLD | NEW |