| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 Test* test_; | 54 Test* test_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(MockNotificationView); | 56 DISALLOW_COPY_AND_ASSIGN(MockNotificationView); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 MockNotificationView::MockNotificationView(MessageCenterController* controller, | 59 MockNotificationView::MockNotificationView(MessageCenterController* controller, |
| 60 const Notification& notification, | 60 const Notification& notification, |
| 61 Test* test) | 61 Test* test) |
| 62 : NotificationView(controller, notification), test_(test) {} | 62 : NotificationView(controller, notification), test_(test) { |
| 63 // Calling SetPaintToLayer() to ensure that this view has its own layer. |
| 64 // This layer is needed to enable adding/removal animations. |
| 65 SetPaintToLayer(); |
| 66 } |
| 63 | 67 |
| 64 MockNotificationView::~MockNotificationView() {} | 68 MockNotificationView::~MockNotificationView() {} |
| 65 | 69 |
| 66 gfx::Size MockNotificationView::GetPreferredSize() const { | 70 gfx::Size MockNotificationView::GetPreferredSize() const { |
| 67 test_->RegisterCall(GET_PREFERRED_SIZE); | 71 test_->RegisterCall(GET_PREFERRED_SIZE); |
| 68 DCHECK(child_count() > 0); | 72 DCHECK(child_count() > 0); |
| 69 return NotificationView::GetPreferredSize(); | 73 return NotificationView::GetPreferredSize(); |
| 70 } | 74 } |
| 71 | 75 |
| 72 int MockNotificationView::GetHeightForWidth(int width) const { | 76 int MockNotificationView::GetHeightForWidth(int width) const { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 EXPECT_EQ(2, message_list_view()->child_count()); | 438 EXPECT_EQ(2, message_list_view()->child_count()); |
| 435 EXPECT_TRUE(notification_view2->visible()); | 439 EXPECT_TRUE(notification_view2->visible()); |
| 436 | 440 |
| 437 RunPendingAnimations(); | 441 RunPendingAnimations(); |
| 438 | 442 |
| 439 message_list_view()->ClearAllClosableNotifications( | 443 message_list_view()->ClearAllClosableNotifications( |
| 440 message_list_view()->bounds()); | 444 message_list_view()->bounds()); |
| 441 | 445 |
| 442 RunPendingAnimations(); | 446 RunPendingAnimations(); |
| 443 | 447 |
| 444 // TODO(yhanada): notification_view1 and notification_view2 should be deleted | 448 EXPECT_EQ(0, message_list_view()->child_count()); |
| 445 // here. Uncomment the below test. | |
| 446 EXPECT_TRUE(gfx::IntersectRects(notification_view1->bounds(), | |
| 447 message_list_view()->bounds()) | |
| 448 .IsEmpty()); | |
| 449 EXPECT_TRUE(gfx::IntersectRects(notification_view2->bounds(), | |
| 450 message_list_view()->bounds()) | |
| 451 .IsEmpty()); | |
| 452 // EXPECT_EQ(0, message_list_view()->child_count()); | |
| 453 } | 449 } |
| 454 | 450 |
| 455 } // namespace | 451 } // namespace |
| OLD | NEW |