Index: mojo/services/test_service/test_time_service_impl.cc |
diff --git a/mojo/services/test_service/test_time_service_impl.cc b/mojo/services/test_service/test_time_service_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a3a9b140784c371f05b0e8797fb6d0358efce7fd |
--- /dev/null |
+++ b/mojo/services/test_service/test_time_service_impl.cc |
@@ -0,0 +1,40 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/time/time.h" |
+#include "mojo/public/cpp/application/application_connection.h" |
+#include "mojo/services/test_service/monitoring_uploader.h" |
+#include "mojo/services/test_service/test_time_service_impl.h" |
+ |
+namespace mojo { |
+namespace test { |
+ |
+TestTimeServiceImpl::TestTimeServiceImpl(ApplicationConnection* application) |
+ : application_(application) { |
+} |
+ |
+TestTimeServiceImpl::~TestTimeServiceImpl() { |
+} |
+ |
+void TestTimeServiceImpl::StartMonitoring( |
+ const mojo::Callback<void()>& callback) { |
+ ToyMonitoringServiceStatsRecorderPtr recorder; |
+ application_->ConnectToService("mojo:mojo_test_monitoring_app", &recorder); |
+ monitoring_.reset(new MonitoringUploader(recorder.Pass(), Name_, callback)); |
+} |
+ |
+void TestTimeServiceImpl::GetPartyTime( |
+ const mojo::Callback<void(int64_t)>& callback) { |
+ if (monitoring_) |
+ monitoring_->RecordNewRequest(); |
+ base::Time frozen_time(base::Time::UnixEpoch() |
+ + base::TimeDelta::FromDays(10957) |
+ + base::TimeDelta::FromHours(7) |
+ + base::TimeDelta::FromMinutes(59)); |
+ int64 time(frozen_time.ToInternalValue()); |
+ callback.Run(time); |
+} |
+ |
+} // namespace test |
+} // namespace mojo |