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

Side by Side Diff: mojo/services/test_service/test_time_service_impl.cc

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/time/time.h"
6 #include "mojo/public/cpp/application/application_impl.h"
7 #include "mojo/services/test_service/test_request_tracker.mojom.h"
8 #include "mojo/services/test_service/test_time_service_impl.h"
9 #include "mojo/services/test_service/tracked_service.h"
10
11 namespace mojo {
12 namespace test {
13
14 TestTimeServiceImpl::TestTimeServiceImpl(
15 ApplicationImpl* app_impl,
16 InterfaceRequest<TestTimeService> request)
17 : app_impl_(app_impl), binding_(this, request.Pass()) {
18 }
19
20 TestTimeServiceImpl::~TestTimeServiceImpl() {
21 }
22
23 void TestTimeServiceImpl::StartTrackingRequests(
24 const mojo::Callback<void()>& callback) {
25 TestRequestTrackerPtr tracker;
26 app_impl_->ConnectToService("mojo:test_request_tracker_app", &tracker);
27 tracking_.reset(new TrackedService(tracker.Pass(), Name_, callback));
28 }
29
30 void TestTimeServiceImpl::GetPartyTime(
31 const mojo::Callback<void(int64_t)>& callback) {
32 if (tracking_)
33 tracking_->RecordNewRequest();
34 base::Time frozen_time(base::Time::UnixEpoch()
35 + base::TimeDelta::FromDays(10957)
36 + base::TimeDelta::FromHours(7)
37 + base::TimeDelta::FromMinutes(59));
38 int64 time(frozen_time.ToInternalValue());
39 callback.Run(time);
40 }
41
42 } // namespace test
43 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/test_service/test_time_service_impl.h ('k') | mojo/services/test_service/tracked_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698