Update broken references to image assets
[chromium-blink-merge.git] / mojo / services / test_service / test_time_service_impl.cc
blob5dc90f79aa5c393573b548fc5feb01a009f90998
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.
5 #include "base/time/time.h"
6 #include "mojo/application/public/cpp/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"
11 namespace mojo {
12 namespace test {
14 TestTimeServiceImpl::TestTimeServiceImpl(
15 ApplicationImpl* app_impl,
16 InterfaceRequest<TestTimeService> request)
17 : app_impl_(app_impl), binding_(this, request.Pass()) {
20 TestTimeServiceImpl::~TestTimeServiceImpl() {
23 void TestTimeServiceImpl::StartTrackingRequests(
24 const mojo::Callback<void()>& callback) {
25 TestRequestTrackerPtr tracker;
26 mojo::URLRequestPtr request(mojo::URLRequest::New());
27 request->url = mojo::String::From("mojo:test_request_tracker_app");
28 app_impl_->ConnectToService(request.Pass(), &tracker);
29 tracking_.reset(new TrackedService(tracker.Pass(), Name_, callback));
32 void TestTimeServiceImpl::GetPartyTime(
33 const mojo::Callback<void(int64_t)>& callback) {
34 if (tracking_)
35 tracking_->RecordNewRequest();
36 base::Time frozen_time(base::Time::UnixEpoch()
37 + base::TimeDelta::FromDays(10957)
38 + base::TimeDelta::FromHours(7)
39 + base::TimeDelta::FromMinutes(59));
40 int64 time(frozen_time.ToInternalValue());
41 callback.Run(time);
44 } // namespace test
45 } // namespace mojo