| 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 "chromeos/dbus/fake_upstart_client.h" | 5 #include "chromeos/dbus/fake_upstart_client.h" |
| 6 | 6 |
| 7 #include "chromeos/dbus/dbus_thread_manager.h" | 7 #include "chromeos/dbus/dbus_thread_manager.h" |
| 8 #include "chromeos/dbus/fake_auth_policy_client.h" | 8 #include "chromeos/dbus/fake_auth_policy_client.h" |
| 9 #include "chromeos/dbus/fake_media_analytics_client.h" |
| 9 | 10 |
| 10 namespace chromeos { | 11 namespace chromeos { |
| 11 | 12 |
| 12 FakeUpstartClient::FakeUpstartClient() {} | 13 FakeUpstartClient::FakeUpstartClient() {} |
| 13 | 14 |
| 14 FakeUpstartClient::~FakeUpstartClient() {} | 15 FakeUpstartClient::~FakeUpstartClient() {} |
| 15 | 16 |
| 16 void FakeUpstartClient::Init(dbus::Bus* bus) {} | 17 void FakeUpstartClient::Init(dbus::Bus* bus) {} |
| 17 | 18 |
| 18 void FakeUpstartClient::StartAuthPolicyService() { | 19 void FakeUpstartClient::StartAuthPolicyService() { |
| 19 static_cast<FakeAuthPolicyClient*>( | 20 static_cast<FakeAuthPolicyClient*>( |
| 20 DBusThreadManager::Get()->GetAuthPolicyClient()) | 21 DBusThreadManager::Get()->GetAuthPolicyClient()) |
| 21 ->set_started(true); | 22 ->set_started(true); |
| 22 } | 23 } |
| 23 | 24 |
| 24 void FakeUpstartClient::RestartAuthPolicyService() { | 25 void FakeUpstartClient::RestartAuthPolicyService() { |
| 25 FakeAuthPolicyClient* authpolicy_client = static_cast<FakeAuthPolicyClient*>( | 26 FakeAuthPolicyClient* authpolicy_client = static_cast<FakeAuthPolicyClient*>( |
| 26 DBusThreadManager::Get()->GetAuthPolicyClient()); | 27 DBusThreadManager::Get()->GetAuthPolicyClient()); |
| 27 DLOG_IF(WARNING, !authpolicy_client->started()) | 28 DLOG_IF(WARNING, !authpolicy_client->started()) |
| 28 << "Trying to restart authpolicyd which is not started"; | 29 << "Trying to restart authpolicyd which is not started"; |
| 29 authpolicy_client->set_started(true); | 30 authpolicy_client->set_started(true); |
| 30 } | 31 } |
| 31 | 32 |
| 33 void FakeUpstartClient::StartMediaAnalytics(const UpstartCallback& callback) { |
| 34 FakeMediaAnalyticsClient* media_analytics_client = |
| 35 static_cast<FakeMediaAnalyticsClient*>( |
| 36 DBusThreadManager::Get()->GetMediaAnalyticsClient()); |
| 37 DLOG_IF(WARNING, media_analytics_client->process_running()) |
| 38 << "Trying to start media analytics which is already started."; |
| 39 media_analytics_client->set_process_running(true); |
| 40 callback.Run(true); |
| 41 } |
| 42 |
| 43 void FakeUpstartClient::StopMediaAnalytics() { |
| 44 FakeMediaAnalyticsClient* media_analytics_client = |
| 45 static_cast<FakeMediaAnalyticsClient*>( |
| 46 DBusThreadManager::Get()->GetMediaAnalyticsClient()); |
| 47 DLOG_IF(WARNING, !media_analytics_client->process_running()) |
| 48 << "Trying to stop media analytics which is not started."; |
| 49 media_analytics_client->set_process_running(false); |
| 50 } |
| 51 |
| 32 } // namespace chromeos | 52 } // namespace chromeos |
| OLD | NEW |