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