Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / public / test / test_mojo_app.h
blob965c9491f7a4e799b11a218c80bf61ba1890d661
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 #ifndef CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
6 #define CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
8 #include "base/macros.h"
9 #include "content/public/test/test_mojo_service.mojom.h"
10 #include "mojo/application/public/cpp/application_delegate.h"
11 #include "mojo/application/public/cpp/interface_factory.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
13 #include "url/gurl.h"
15 namespace content {
17 extern const char kTestMojoAppUrl[];
19 // Simple Mojo app which provides a TestMojoService impl. The app terminates
20 // itself after its TestService fulfills a single DoSomething call.
21 class TestMojoApp : public mojo::ApplicationDelegate,
22 public mojo::InterfaceFactory<TestMojoService>,
23 public TestMojoService {
24 public:
25 TestMojoApp();
26 ~TestMojoApp() override;
28 private:
29 // mojo::ApplicationDelegate:
30 void Initialize(mojo::ApplicationImpl* app) override;
31 bool ConfigureIncomingConnection(
32 mojo::ApplicationConnection* connection) override;
34 // mojo::InterfaceFactory<TestMojoService>:
35 void Create(mojo::ApplicationConnection* connection,
36 mojo::InterfaceRequest<TestMojoService> request) override;
38 // TestMojoService:
39 void DoSomething(const DoSomethingCallback& callback) override;
40 void GetRequestorURL(const GetRequestorURLCallback& callback) override;
42 mojo::Binding<TestMojoService> service_binding_;
44 // Not owned.
45 mojo::ApplicationImpl* app_;
47 // The URL of the app connecting to us.
48 GURL requestor_url_;
50 DISALLOW_COPY_AND_ASSIGN(TestMojoApp);
53 } // namespace
55 #endif // CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_