| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/power/video_activity_notifier.h" | 5 #include "ash/system/chromeos/power/video_activity_notifier.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/dbus_thread_manager_ash.h" |
| 9 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/video_detector.h" | 11 #include "ash/wm/video_detector.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" | 13 // #include "chromeos/dbus/dbus_thread_manager.h" |
| 13 #include "chromeos/dbus/fake_power_manager_client.h" | 14 #include "chromeos/dbus/fake_power_manager_client.h" |
| 14 | 15 |
| 15 namespace ash { | 16 namespace ash { |
| 16 | 17 |
| 17 class VideoActivityNotifierTest : public test::AshTestBase { | 18 class VideoActivityNotifierTest : public test::AshTestBase { |
| 18 public: | 19 public: |
| 19 VideoActivityNotifierTest() {} | 20 VideoActivityNotifierTest() {} |
| 20 ~VideoActivityNotifierTest() override {} | 21 ~VideoActivityNotifierTest() override {} |
| 21 | 22 |
| 22 void SetUp() override { | 23 void SetUp() override { |
| 23 test::AshTestBase::SetUp(); | 24 test::AshTestBase::SetUp(); |
| 24 power_client_ = static_cast<chromeos::FakePowerManagerClient*>( | 25 power_client_ = static_cast<chromeos::FakePowerManagerClient*>( |
| 25 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()); | 26 DBusThreadManagerAsh::Get()->GetPowerManagerClient()); |
| 26 detector_.reset(new VideoDetector()); | 27 detector_.reset(new VideoDetector()); |
| 27 notifier_.reset(new VideoActivityNotifier(detector_.get())); | 28 notifier_.reset(new VideoActivityNotifier(detector_.get())); |
| 28 } | 29 } |
| 29 | 30 |
| 30 void TearDown() override { | 31 void TearDown() override { |
| 31 notifier_.reset(); | 32 notifier_.reset(); |
| 32 detector_.reset(); | 33 detector_.reset(); |
| 33 test::AshTestBase::TearDown(); | 34 test::AshTestBase::TearDown(); |
| 34 } | 35 } |
| 35 | 36 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 EXPECT_TRUE(power_client_->PopVideoActivityReport()); | 105 EXPECT_TRUE(power_client_->PopVideoActivityReport()); |
| 105 EXPECT_FALSE(power_client_->have_video_activity_report()); | 106 EXPECT_FALSE(power_client_->have_video_activity_report()); |
| 106 | 107 |
| 107 // The timer should stop when video video. | 108 // The timer should stop when video video. |
| 108 notifier_->OnVideoStateChanged(VideoDetector::State::NOT_PLAYING); | 109 notifier_->OnVideoStateChanged(VideoDetector::State::NOT_PLAYING); |
| 109 EXPECT_FALSE(notifier_->TriggerTimeoutForTest()); | 110 EXPECT_FALSE(notifier_->TriggerTimeoutForTest()); |
| 110 EXPECT_FALSE(power_client_->have_video_activity_report()); | 111 EXPECT_FALSE(power_client_->have_video_activity_report()); |
| 111 } | 112 } |
| 112 | 113 |
| 113 } // namespace ash | 114 } // namespace ash |
| OLD | NEW |