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

Side by Side 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: ServiceProvider rebase 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 unified diff | Download patch | Annotate | Revision Log
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_connection.h"
7 #include "mojo/services/test_service/monitoring_uploader.h"
8 #include "mojo/services/test_service/test_time_service_impl.h"
9
10 namespace mojo {
11 namespace test {
12
13 TestTimeServiceImpl::TestTimeServiceImpl(ApplicationConnection* application)
14 : application_(application) {
15 }
16
17 TestTimeServiceImpl::~TestTimeServiceImpl() {
18 }
19
20 void TestTimeServiceImpl::StartMonitoring(
21 const mojo::Callback<void()>& callback) {
22 ToyMonitoringServiceStatsRecorderPtr recorder;
23 application_->ConnectToService("mojo:mojo_test_monitoring_app", &recorder);
24 monitoring_.reset(new MonitoringUploader(recorder.Pass(), Name_, callback));
25 }
26
27 void TestTimeServiceImpl::GetPartyTime(
28 const mojo::Callback<void(int64_t)>& callback) {
29 if (monitoring_)
30 monitoring_->RecordNewRequest();
31 base::Time frozen_time(base::Time::UnixEpoch()
32 + base::TimeDelta::FromDays(10957)
33 + base::TimeDelta::FromHours(7)
34 + base::TimeDelta::FromMinutes(59));
35 int64 time(frozen_time.ToInternalValue());
36 callback.Run(time);
37 }
38
39 } // namespace test
40 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698