Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1412)

Unified Diff: mojo/services/test_service/test_time_service_impl.cc

Issue 349303006: mojo: add some end-to-end shell tests and a new test sample app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no icu Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/test_service/test_time_service_impl.h ('k') | mojo/shell/shell_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f4adbaa0ede5df7f2299f84578dc616b53b0a03e
--- /dev/null
+++ b/mojo/services/test_service/test_time_service_impl.cc
@@ -0,0 +1,43 @@
+// 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/test_request_tracker.mojom.h"
+#include "mojo/services/test_service/test_request_tracker_client_impl.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::StartTrackingRequests(
+ const mojo::Callback<void()>& callback) {
+ TestRequestTrackerPtr tracker;
+ application_->ConnectToService(
+ "mojo:mojo_test_request_tracker_app", &tracker);
+ tracking_.reset(new TestRequestTrackerClientImpl(
+ tracker.Pass(), Name_, callback));
+}
+
+void TestTimeServiceImpl::GetPartyTime(
+ const mojo::Callback<void(int64_t)>& callback) {
+ if (tracking_)
+ tracking_->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
« no previous file with comments | « mojo/services/test_service/test_time_service_impl.h ('k') | mojo/shell/shell_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698