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

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

Issue 1760383002: Remove some unneeded directories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: , Created 4 years, 9 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 "mojo/services/test_service/test_time_service_impl.h"
6
7 #include <stdint.h>
8
9 #include <utility>
10
11 #include "base/time/time.h"
12 #include "mojo/services/test_service/test_request_tracker.mojom.h"
13 #include "mojo/services/test_service/tracked_service.h"
14 #include "mojo/shell/public/cpp/connector.h"
15
16 namespace mojo {
17 namespace test {
18
19 TestTimeServiceImpl::TestTimeServiceImpl(
20 Connector* connector,
21 InterfaceRequest<TestTimeService> request)
22 : connector_(connector), binding_(this, std::move(request)) {}
23
24 TestTimeServiceImpl::~TestTimeServiceImpl() {
25 }
26
27 void TestTimeServiceImpl::StartTrackingRequests(
28 const mojo::Callback<void()>& callback) {
29 TestRequestTrackerPtr tracker;
30 connector_->ConnectToInterface("mojo:test_request_tracker_app", &tracker);
31 tracking_.reset(new TrackedService(std::move(tracker), Name_, callback));
32 }
33
34 void TestTimeServiceImpl::GetPartyTime(
35 const mojo::Callback<void(int64_t)>& callback) {
36 if (tracking_)
37 tracking_->RecordNewRequest();
38 base::Time frozen_time(base::Time::UnixEpoch()
39 + base::TimeDelta::FromDays(10957)
40 + base::TimeDelta::FromHours(7)
41 + base::TimeDelta::FromMinutes(59));
42 int64_t time(frozen_time.ToInternalValue());
43 callback.Run(time);
44 }
45
46 } // namespace test
47 } // 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