OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 SystemTray* GetSystemTray() { | 66 SystemTray* GetSystemTray() { |
67 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray(); | 67 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray(); |
68 } | 68 } |
69 | 69 |
70 // Trivial item implementation for testing PopupAndSystemTray test case. | 70 // Trivial item implementation for testing PopupAndSystemTray test case. |
71 class TestItem : public SystemTrayItem { | 71 class TestItem : public SystemTrayItem { |
72 public: | 72 public: |
73 TestItem() : SystemTrayItem(GetSystemTray()) {} | 73 TestItem() : SystemTrayItem(GetSystemTray()) {} |
74 | 74 |
75 virtual views::View* CreateDefaultView(user::LoginStatus status) override { | 75 views::View* CreateDefaultView(user::LoginStatus status) override { |
76 views::View* default_view = new views::View; | 76 views::View* default_view = new views::View; |
77 default_view->SetLayoutManager(new views::FillLayout); | 77 default_view->SetLayoutManager(new views::FillLayout); |
78 default_view->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); | 78 default_view->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); |
79 return default_view; | 79 return default_view; |
80 } | 80 } |
81 | 81 |
82 virtual views::View* CreateNotificationView( | 82 views::View* CreateNotificationView(user::LoginStatus status) override { |
83 user::LoginStatus status) override { | |
84 return new views::View; | 83 return new views::View; |
85 } | 84 } |
86 | 85 |
87 private: | 86 private: |
88 DISALLOW_COPY_AND_ASSIGN(TestItem); | 87 DISALLOW_COPY_AND_ASSIGN(TestItem); |
89 }; | 88 }; |
90 | 89 |
91 } // namespace | 90 } // namespace |
92 | 91 |
93 class WebNotificationTrayTest : public test::AshTestBase { | 92 class WebNotificationTrayTest : public test::AshTestBase { |
94 public: | 93 public: |
95 WebNotificationTrayTest() {} | 94 WebNotificationTrayTest() {} |
96 virtual ~WebNotificationTrayTest() {} | 95 ~WebNotificationTrayTest() override {} |
97 | 96 |
98 virtual void SetUp() override { | 97 void SetUp() override { |
99 CommandLine::ForCurrentProcess()->AppendSwitch( | 98 CommandLine::ForCurrentProcess()->AppendSwitch( |
100 switches::kEnableTouchFeedback); | 99 switches::kEnableTouchFeedback); |
101 test::AshTestBase::SetUp(); | 100 test::AshTestBase::SetUp(); |
102 } | 101 } |
103 | 102 |
104 virtual void TearDown() override { | 103 void TearDown() override { |
105 GetMessageCenter()->RemoveAllNotifications(false); | 104 GetMessageCenter()->RemoveAllNotifications(false); |
106 test::AshTestBase::TearDown(); | 105 test::AshTestBase::TearDown(); |
107 } | 106 } |
108 | 107 |
109 protected: | 108 protected: |
110 void AddNotification(const std::string& id) { | 109 void AddNotification(const std::string& id) { |
111 scoped_ptr<message_center::Notification> notification; | 110 scoped_ptr<message_center::Notification> notification; |
112 notification.reset(new message_center::Notification( | 111 notification.reset(new message_center::Notification( |
113 message_center::NOTIFICATION_TYPE_SIMPLE, | 112 message_center::NOTIFICATION_TYPE_SIMPLE, |
114 id, | 113 id, |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); | 545 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); |
547 generator.Dispatch(&release); | 546 generator.Dispatch(&release); |
548 RunAllPendingInMessageLoop(); | 547 RunAllPendingInMessageLoop(); |
549 EXPECT_FALSE(tray->draw_background_as_active()); | 548 EXPECT_FALSE(tray->draw_background_as_active()); |
550 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 549 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
551 } | 550 } |
552 | 551 |
553 #endif // OS_CHROMEOS | 552 #endif // OS_CHROMEOS |
554 | 553 |
555 } // namespace ash | 554 } // namespace ash |
OLD | NEW |