| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/message_center/views/message_center_view.h" | 5 #include "ui/message_center/views/message_center_view.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 /* Types **********************************************************************/ | 32 /* Types **********************************************************************/ |
| 33 | 33 |
| 34 enum CallType { | 34 enum CallType { |
| 35 GET_PREFERRED_SIZE, | 35 GET_PREFERRED_SIZE, |
| 36 GET_HEIGHT_FOR_WIDTH, | 36 GET_HEIGHT_FOR_WIDTH, |
| 37 LAYOUT | 37 LAYOUT |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 class DummyEvent : public ui::Event { | 40 class DummyEvent : public ui::Event { |
| 41 public: | 41 public: |
| 42 DummyEvent() : Event(ui::ET_UNKNOWN, base::TimeDelta(), 0) {} | 42 DummyEvent() : Event(ui::ET_UNKNOWN, base::TimeTicks(), 0) {} |
| 43 ~DummyEvent() override {} | 43 ~DummyEvent() override {} |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 /* Instrumented/Mock NotificationView subclass ********************************/ | 46 /* Instrumented/Mock NotificationView subclass ********************************/ |
| 47 | 47 |
| 48 class MockNotificationView : public NotificationView { | 48 class MockNotificationView : public NotificationView { |
| 49 public: | 49 public: |
| 50 class Test { | 50 class Test { |
| 51 public: | 51 public: |
| 52 virtual void RegisterCall(CallType type) = 0; | 52 virtual void RegisterCall(CallType type) = 0; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 const std::string& notification_id) { | 350 const std::string& notification_id) { |
| 351 // For this test, this method should not be invoked. | 351 // For this test, this method should not be invoked. |
| 352 NOTREACHED(); | 352 NOTREACHED(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void MessageCenterViewTest::RegisterCall(CallType type) { | 355 void MessageCenterViewTest::RegisterCall(CallType type) { |
| 356 callCounts_[type] += 1; | 356 callCounts_[type] += 1; |
| 357 } | 357 } |
| 358 | 358 |
| 359 void MessageCenterViewTest::FireOnMouseExitedEvent() { | 359 void MessageCenterViewTest::FireOnMouseExitedEvent() { |
| 360 ui::MouseEvent dummy_event(ui::ET_MOUSE_EXITED /* type */, | 360 ui::MouseEvent dummy_event( |
| 361 gfx::Point(0,0) /* location */, | 361 ui::ET_MOUSE_EXITED /* type */, gfx::Point(0, 0) /* location */, |
| 362 gfx::Point(0,0) /* root location */, | 362 gfx::Point(0, 0) /* root location */, base::TimeTicks() /* time_stamp */, |
| 363 base::TimeDelta() /* time_stamp */, | 363 0 /* flags */, 0 /*changed_button_flags */); |
| 364 0 /* flags */, | |
| 365 0 /*changed_button_flags */); | |
| 366 message_center_view_->OnMouseExited(dummy_event); | 364 message_center_view_->OnMouseExited(dummy_event); |
| 367 } | 365 } |
| 368 | 366 |
| 369 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { | 367 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { |
| 370 base::string16 inset; | 368 base::string16 inset; |
| 371 for (int i = 0; i < depth; ++i) | 369 for (int i = 0; i < depth; ++i) |
| 372 inset.append(base::UTF8ToUTF16(" ")); | 370 inset.append(base::UTF8ToUTF16(" ")); |
| 373 gfx::Rect bounds = view->bounds(); | 371 gfx::Rect bounds = view->bounds(); |
| 374 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() | 372 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() |
| 375 << " @ " << bounds.x() << ", " << bounds.y(); | 373 << " @ " << bounds.x() << ", " << bounds.y(); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 base::UTF8ToUTF16("message"), | 800 base::UTF8ToUTF16("message"), |
| 803 gfx::Image(), base::UTF8ToUTF16("display source"), GURL(), | 801 gfx::Image(), base::UTF8ToUTF16("display source"), GURL(), |
| 804 NotifierId(NotifierId::APPLICATION, "extension_id"), | 802 NotifierId(NotifierId::APPLICATION, "extension_id"), |
| 805 message_center::RichNotificationData(), NULL))); | 803 message_center::RichNotificationData(), NULL))); |
| 806 | 804 |
| 807 GetMessageCenterView()->SizeToPreferredSize(); | 805 GetMessageCenterView()->SizeToPreferredSize(); |
| 808 EXPECT_NE(kEmptyMessageCenterViewHeight, GetMessageCenterView()->height()); | 806 EXPECT_NE(kEmptyMessageCenterViewHeight, GetMessageCenterView()->height()); |
| 809 } | 807 } |
| 810 | 808 |
| 811 } // namespace message_center | 809 } // namespace message_center |
| OLD | NEW |