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

Side by Side Diff: content/shell/utility/shell_content_utility_client.cc

Issue 1965683002: Add a browser test for UtilityProcessHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops Created 4 years, 7 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
« no previous file with comments | « content/shell/utility/shell_content_utility_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "content/shell/utility/shell_content_utility_client.h" 5 #include "content/shell/utility/shell_content_utility_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "content/public/common/service_registry.h"
10 #include "content/public/test/test_mojo_app.h" 12 #include "content/public/test/test_mojo_app.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h"
11 14
12 namespace content { 15 namespace content {
13 16
14 namespace { 17 namespace {
15 18
19 class TestMojoServiceImpl : public mojom::TestMojoService {
20 public:
21 static void Create(mojo::InterfaceRequest<mojom::TestMojoService> request) {
22 new TestMojoServiceImpl(std::move(request));
23 }
24
25 // mojom::TestMojoService implementation:
26 void DoSomething(const DoSomethingCallback& callback) override {
27 callback.Run();
28 }
29
30 void GetRequestorName(const GetRequestorNameCallback& callback) override {
31 NOTREACHED();
32 }
33
34 private:
35 explicit TestMojoServiceImpl(
36 mojo::InterfaceRequest<mojom::TestMojoService> request)
37 : binding_(this, std::move(request)) {}
38
39 mojo::StrongBinding<mojom::TestMojoService> binding_;
40
41 DISALLOW_COPY_AND_ASSIGN(TestMojoServiceImpl);
42 };
43
16 std::unique_ptr<shell::ShellClient> CreateTestApp( 44 std::unique_ptr<shell::ShellClient> CreateTestApp(
17 const base::Closure& quit_closure) { 45 const base::Closure& quit_closure) {
18 return std::unique_ptr<shell::ShellClient>(new TestMojoApp); 46 return std::unique_ptr<shell::ShellClient>(new TestMojoApp);
19 } 47 }
20 48
21 } // namespace 49 } // namespace
22 50
23 ShellContentUtilityClient::~ShellContentUtilityClient() { 51 ShellContentUtilityClient::~ShellContentUtilityClient() {
24 } 52 }
25 53
26 void ShellContentUtilityClient::RegisterMojoApplications( 54 void ShellContentUtilityClient::RegisterMojoApplications(
27 StaticMojoApplicationMap* apps) { 55 StaticMojoApplicationMap* apps) {
28 apps->insert(std::make_pair(kTestMojoAppUrl, base::Bind(&CreateTestApp))); 56 apps->insert(std::make_pair(kTestMojoAppUrl, base::Bind(&CreateTestApp)));
29 } 57 }
30 58
59 void ShellContentUtilityClient::RegisterMojoServices(
60 ServiceRegistry* registry) {
61 registry->AddService(base::Bind(&TestMojoServiceImpl::Create));
62 }
63
31 } // namespace content 64 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/utility/shell_content_utility_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698