| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 const std::string& notification_id) { | 327 const std::string& notification_id) { |
| 328 // For this test, this method should not be invoked. | 328 // For this test, this method should not be invoked. |
| 329 NOTREACHED(); | 329 NOTREACHED(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void MessageCenterViewTest::RegisterCall(CallType type) { | 332 void MessageCenterViewTest::RegisterCall(CallType type) { |
| 333 callCounts_[type] += 1; | 333 callCounts_[type] += 1; |
| 334 } | 334 } |
| 335 | 335 |
| 336 void MessageCenterViewTest::FireOnMouseExitedEvent() { | 336 void MessageCenterViewTest::FireOnMouseExitedEvent() { |
| 337 ui::MouseEvent dummy_event(ui::ET_MOUSE_EXITED /* type */, | 337 ui::MouseEvent dummy_event( |
| 338 gfx::Point(0,0) /* location */, | 338 ui::ET_MOUSE_EXITED /* type */, gfx::Point(0, 0) /* location */, |
| 339 gfx::Point(0,0) /* root location */, | 339 gfx::Point(0, 0) /* root location */, base::TimeTicks() /* time_stamp */, |
| 340 base::TimeDelta() /* time_stamp */, | 340 0 /* flags */, 0 /*changed_button_flags */); |
| 341 0 /* flags */, | |
| 342 0 /*changed_button_flags */); | |
| 343 message_center_view_->OnMouseExited(dummy_event); | 341 message_center_view_->OnMouseExited(dummy_event); |
| 344 } | 342 } |
| 345 | 343 |
| 346 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { | 344 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { |
| 347 base::string16 inset; | 345 base::string16 inset; |
| 348 for (int i = 0; i < depth; ++i) | 346 for (int i = 0; i < depth; ++i) |
| 349 inset.append(base::UTF8ToUTF16(" ")); | 347 inset.append(base::UTF8ToUTF16(" ")); |
| 350 gfx::Rect bounds = view->bounds(); | 348 gfx::Rect bounds = view->bounds(); |
| 351 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() | 349 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() |
| 352 << " @ " << bounds.x() << ", " << bounds.y(); | 350 << " @ " << bounds.x() << ", " << bounds.y(); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 AddNotification( | 699 AddNotification( |
| 702 std::unique_ptr<Notification>(new Notification(normal_notification))); | 700 std::unique_ptr<Notification>(new Notification(normal_notification))); |
| 703 EXPECT_EQ(Mode::SETTINGS, GetMessageCenterViewInternalMode()); | 701 EXPECT_EQ(Mode::SETTINGS, GetMessageCenterViewInternalMode()); |
| 704 | 702 |
| 705 // Hide the settings. | 703 // Hide the settings. |
| 706 GetMessageCenterView()->SetSettingsVisible(false); | 704 GetMessageCenterView()->SetSettingsVisible(false); |
| 707 EXPECT_EQ(Mode::NOTIFICATIONS, GetMessageCenterViewInternalMode()); | 705 EXPECT_EQ(Mode::NOTIFICATIONS, GetMessageCenterViewInternalMode()); |
| 708 } | 706 } |
| 709 | 707 |
| 710 } // namespace message_center | 708 } // namespace message_center |
| OLD | NEW |