OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/services/test_service/test_service_impl.h" | 5 #include "mojo/services/test_service/test_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "mojo/application/public/cpp/application_impl.h" | 10 #include "mojo/application/public/cpp/application_impl.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 void SendTimeResponse( | 40 void SendTimeResponse( |
41 const mojo::Callback<void(int64_t)>& requestor_callback, | 41 const mojo::Callback<void(int64_t)>& requestor_callback, |
42 int64_t time_usec) { | 42 int64_t time_usec) { |
43 requestor_callback.Run(time_usec); | 43 requestor_callback.Run(time_usec); |
44 } | 44 } |
45 | 45 |
46 void TestServiceImpl::ConnectToAppAndGetTime( | 46 void TestServiceImpl::ConnectToAppAndGetTime( |
47 const mojo::String& app_url, | 47 const mojo::String& app_url, |
48 const mojo::Callback<void(int64_t)>& callback) { | 48 const mojo::Callback<void(int64_t)>& callback) { |
49 app_impl_->ConnectToService(app_url, &time_service_); | 49 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 50 request->url = mojo::String::From(app_url); |
| 51 app_impl_->ConnectToService(request.Pass(), &time_service_); |
50 if (tracking_) { | 52 if (tracking_) { |
51 tracking_->RecordNewRequest(); | 53 tracking_->RecordNewRequest(); |
52 time_service_->StartTrackingRequests(mojo::Callback<void()>()); | 54 time_service_->StartTrackingRequests(mojo::Callback<void()>()); |
53 } | 55 } |
54 time_service_->GetPartyTime(base::Bind(&SendTimeResponse, callback)); | 56 time_service_->GetPartyTime(base::Bind(&SendTimeResponse, callback)); |
55 } | 57 } |
56 | 58 |
57 void TestServiceImpl::StartTrackingRequests( | 59 void TestServiceImpl::StartTrackingRequests( |
58 const mojo::Callback<void()>& callback) { | 60 const mojo::Callback<void()>& callback) { |
59 TestRequestTrackerPtr tracker; | 61 TestRequestTrackerPtr tracker; |
60 app_impl_->ConnectToService("mojo:test_request_tracker_app", &tracker); | 62 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 63 request->url = mojo::String::From("mojo:test_request_tracker_app"); |
| 64 app_impl_->ConnectToService(request.Pass(), &tracker); |
61 tracking_.reset(new TrackedService(tracker.Pass(), Name_, callback)); | 65 tracking_.reset(new TrackedService(tracker.Pass(), Name_, callback)); |
62 } | 66 } |
63 | 67 |
64 } // namespace test | 68 } // namespace test |
65 } // namespace mojo | 69 } // namespace mojo |
OLD | NEW |