| 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 "ash/common/system/chromeos/screen_security/screen_tray_item.h" | 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" |
| 6 | 6 |
| 7 #include "ash/common/system/chromeos/screen_security/screen_capture_tray_item.h" | 7 #include "ash/common/system/chromeos/screen_security/screen_capture_tray_item.h" |
| 8 #include "ash/common/system/chromeos/screen_security/screen_share_tray_item.h" | 8 #include "ash/common/system/chromeos/screen_security/screen_share_tray_item.h" |
| 9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
| 10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
| 11 #include "ash/common/system/tray/tray_item_view.h" | 11 #include "ash/common/system/tray/tray_item_view.h" |
| 12 #include "ash/common/test/ash_test.h" | 12 #include "ash/common/test/ash_test.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/shell.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
| 18 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
| 19 #include "ui/gfx/geometry/point.h" | 19 #include "ui/gfx/geometry/point.h" |
| 20 #include "ui/message_center/message_center.h" | 20 #include "ui/message_center/message_center.h" |
| 21 #include "ui/views/view.h" | 21 #include "ui/views/view.h" |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // The stop callback shouldn't be called because we stopped | 136 // The stop callback shouldn't be called because we stopped |
| 137 // through the notification system. | 137 // through the notification system. |
| 138 stop_function.Run(); | 138 stop_function.Run(); |
| 139 EXPECT_FALSE(tray_item->is_started()); | 139 EXPECT_FALSE(tray_item->is_started()); |
| 140 EXPECT_EQ(0, test->stop_callback_hit_count()); | 140 EXPECT_EQ(0, test->stop_callback_hit_count()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 TEST_F(ScreenCaptureTest, NotificationStartAndStop) { | 143 TEST_F(ScreenCaptureTest, NotificationStartAndStop) { |
| 144 base::Closure start_function = base::Bind( | 144 base::Closure start_function = base::Bind( |
| 145 &SystemTrayNotifier::NotifyScreenCaptureStart, | 145 &SystemTrayNotifier::NotifyScreenCaptureStart, |
| 146 base::Unretained(WmShell::Get()->system_tray_notifier()), | 146 base::Unretained(Shell::Get()->system_tray_notifier()), |
| 147 base::Bind(&ScreenTrayItemTest::StopCallback, base::Unretained(this)), | 147 base::Bind(&ScreenTrayItemTest::StopCallback, base::Unretained(this)), |
| 148 base::UTF8ToUTF16(kTestScreenCaptureAppName)); | 148 base::UTF8ToUTF16(kTestScreenCaptureAppName)); |
| 149 | 149 |
| 150 base::Closure stop_function = | 150 base::Closure stop_function = |
| 151 base::Bind(&SystemTrayNotifier::NotifyScreenCaptureStop, | 151 base::Bind(&SystemTrayNotifier::NotifyScreenCaptureStop, |
| 152 base::Unretained(WmShell::Get()->system_tray_notifier())); | 152 base::Unretained(Shell::Get()->system_tray_notifier())); |
| 153 | 153 |
| 154 TestNotificationStartAndStop(this, start_function, stop_function); | 154 TestNotificationStartAndStop(this, start_function, stop_function); |
| 155 } | 155 } |
| 156 | 156 |
| 157 TEST_F(ScreenShareTest, NotificationStartAndStop) { | 157 TEST_F(ScreenShareTest, NotificationStartAndStop) { |
| 158 base::Closure start_func = base::Bind( | 158 base::Closure start_func = base::Bind( |
| 159 &SystemTrayNotifier::NotifyScreenShareStart, | 159 &SystemTrayNotifier::NotifyScreenShareStart, |
| 160 base::Unretained(WmShell::Get()->system_tray_notifier()), | 160 base::Unretained(Shell::Get()->system_tray_notifier()), |
| 161 base::Bind(&ScreenTrayItemTest::StopCallback, base::Unretained(this)), | 161 base::Bind(&ScreenTrayItemTest::StopCallback, base::Unretained(this)), |
| 162 base::UTF8ToUTF16(kTestScreenShareHelperName)); | 162 base::UTF8ToUTF16(kTestScreenShareHelperName)); |
| 163 | 163 |
| 164 base::Closure stop_func = | 164 base::Closure stop_func = |
| 165 base::Bind(&SystemTrayNotifier::NotifyScreenShareStop, | 165 base::Bind(&SystemTrayNotifier::NotifyScreenShareStop, |
| 166 base::Unretained(WmShell::Get()->system_tray_notifier())); | 166 base::Unretained(Shell::Get()->system_tray_notifier())); |
| 167 | 167 |
| 168 TestNotificationStartAndStop(this, start_func, stop_func); | 168 TestNotificationStartAndStop(this, start_func, stop_func); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void TestNotificationView(ScreenTrayItemTest* test) { | 171 void TestNotificationView(ScreenTrayItemTest* test) { |
| 172 ScreenTrayItem* tray_item = test->tray_item(); | 172 ScreenTrayItem* tray_item = test->tray_item(); |
| 173 | 173 |
| 174 test->StartSession(); | 174 test->StartSession(); |
| 175 message_center::MessageCenter* message_center = | 175 message_center::MessageCenter* message_center = |
| 176 message_center::MessageCenter::Get(); | 176 message_center::MessageCenter::Get(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 TEST_F(ScreenCaptureTest, SystemTrayInteraction) { | 216 TEST_F(ScreenCaptureTest, SystemTrayInteraction) { |
| 217 TestSystemTrayInteraction(this); | 217 TestSystemTrayInteraction(this); |
| 218 } | 218 } |
| 219 | 219 |
| 220 TEST_F(ScreenShareTest, SystemTrayInteraction) { | 220 TEST_F(ScreenShareTest, SystemTrayInteraction) { |
| 221 TestSystemTrayInteraction(this); | 221 TestSystemTrayInteraction(this); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace ash | 224 } // namespace ash |
| OLD | NEW |