[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / content / public / test / test_mojo_app.cc
blob13cb9affcd543b9bc2ea636eb3ae00950c77bf58
1 // Copyright 2015 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 "content/public/test/test_mojo_app.h"
7 #include "base/logging.h"
8 #include "mojo/application/public/cpp/application_connection.h"
9 #include "mojo/application/public/cpp/application_impl.h"
11 namespace content {
13 const char kTestMojoAppUrl[] = "system:content_mojo_test";
15 TestMojoApp::TestMojoApp() : service_binding_(this), app_(nullptr) {
18 TestMojoApp::~TestMojoApp() {
21 void TestMojoApp::Initialize(mojo::ApplicationImpl* app) {
22 app_ = app;
25 bool TestMojoApp::ConfigureIncomingConnection(
26 mojo::ApplicationConnection* connection) {
27 requestor_url_ = GURL(connection->GetRemoteApplicationURL());
28 connection->AddService<TestMojoService>(this);
29 return true;
32 void TestMojoApp::Create(mojo::ApplicationConnection* connection,
33 mojo::InterfaceRequest<TestMojoService> request) {
34 DCHECK(!service_binding_.is_bound());
35 service_binding_.Bind(request.Pass());
38 void TestMojoApp::DoSomething(const DoSomethingCallback& callback) {
39 callback.Run();
40 DCHECK(app_);
41 app_->Quit();
44 void TestMojoApp::GetRequestorURL(const GetRequestorURLCallback& callback) {
45 callback.Run(requestor_url_.spec());
48 } // namespace content