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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 const std::string& notification_id) { | 316 const std::string& notification_id) { |
317 // For this test, this method should not be invoked. | 317 // For this test, this method should not be invoked. |
318 NOTREACHED(); | 318 NOTREACHED(); |
319 } | 319 } |
320 | 320 |
321 void MessageCenterViewTest::RegisterCall(CallType type) { | 321 void MessageCenterViewTest::RegisterCall(CallType type) { |
322 callCounts_[type] += 1; | 322 callCounts_[type] += 1; |
323 } | 323 } |
324 | 324 |
325 void MessageCenterViewTest::FireOnMouseExitedEvent() { | 325 void MessageCenterViewTest::FireOnMouseExitedEvent() { |
326 ui::MouseEvent dummy_event(ui::ET_MOUSE_EXITED /* type */, | 326 ui::MouseEvent dummy_event( |
327 gfx::Point(0,0) /* location */, | 327 ui::ET_MOUSE_EXITED /* type */, gfx::Point(0, 0) /* location */, |
328 gfx::Point(0,0) /* root location */, | 328 gfx::Point(0, 0) /* root location */, base::TimeTicks() /* time_stamp */, |
329 base::TimeDelta() /* time_stamp */, | 329 0 /* flags */, 0 /*changed_button_flags */); |
330 0 /* flags */, | |
331 0 /*changed_button_flags */); | |
332 message_center_view_->OnMouseExited(dummy_event); | 330 message_center_view_->OnMouseExited(dummy_event); |
333 } | 331 } |
334 | 332 |
335 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { | 333 void MessageCenterViewTest::LogBounds(int depth, views::View* view) { |
336 base::string16 inset; | 334 base::string16 inset; |
337 for (int i = 0; i < depth; ++i) | 335 for (int i = 0; i < depth; ++i) |
338 inset.append(base::UTF8ToUTF16(" ")); | 336 inset.append(base::UTF8ToUTF16(" ")); |
339 gfx::Rect bounds = view->bounds(); | 337 gfx::Rect bounds = view->bounds(); |
340 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() | 338 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() |
341 << " @ " << bounds.x() << ", " << bounds.y(); | 339 << " @ " << bounds.x() << ", " << bounds.y(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 AddNotification( | 590 AddNotification( |
593 std::unique_ptr<Notification>(new Notification(pinned_notification))); | 591 std::unique_ptr<Notification>(new Notification(pinned_notification))); |
594 | 592 |
595 // There should be 1 pinned notification. | 593 // There should be 1 pinned notification. |
596 EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size()); | 594 EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size()); |
597 EXPECT_FALSE(close_button->enabled()); | 595 EXPECT_FALSE(close_button->enabled()); |
598 #endif // defined(OS_CHROMEOS) | 596 #endif // defined(OS_CHROMEOS) |
599 } | 597 } |
600 | 598 |
601 } // namespace message_center | 599 } // namespace message_center |
OLD | NEW |