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

Side by Side Diff: mojo/shell/tests/package_test_package.cc

Issue 1735583002: Rename WeakBindingSet/WeakInterfacePtrSet to BindingSet/InterfacePtrSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « mojo/shell/tests/capability_filter_test.cc ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/threading/simple_thread.h" 13 #include "base/threading/simple_thread.h"
14 #include "mojo/public/c/system/main.h" 14 #include "mojo/public/c/system/main.h"
15 #include "mojo/public/cpp/bindings/weak_binding_set.h" 15 #include "mojo/public/cpp/bindings/binding_set.h"
16 #include "mojo/shell/public/cpp/application_runner.h" 16 #include "mojo/shell/public/cpp/application_runner.h"
17 #include "mojo/shell/public/cpp/interface_factory.h" 17 #include "mojo/shell/public/cpp/interface_factory.h"
18 #include "mojo/shell/public/cpp/shell.h" 18 #include "mojo/shell/public/cpp/shell.h"
19 #include "mojo/shell/public/cpp/shell_client.h" 19 #include "mojo/shell/public/cpp/shell_client.h"
20 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" 20 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h"
21 #include "mojo/shell/tests/package_test.mojom.h" 21 #include "mojo/shell/tests/package_test.mojom.h"
22 22
23 // Tests that multiple applications can be packaged in a single Mojo application 23 // Tests that multiple applications can be packaged in a single Mojo application
24 // implementing ShellClientFactory; that these applications can be specified by 24 // implementing ShellClientFactory; that these applications can be specified by
25 // the package's manifest and are thus registered with the PackageManager. 25 // the package's manifest and are thus registered with the PackageManager.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 void OnConnectionError() { 83 void OnConnectionError() {
84 if (bindings_.empty()) 84 if (bindings_.empty())
85 shell_->Quit(); 85 shell_->Quit();
86 } 86 }
87 87
88 const std::string name_; 88 const std::string name_;
89 mojom::ShellClientRequest request_; 89 mojom::ShellClientRequest request_;
90 Shell* shell_; 90 Shell* shell_;
91 WeakBindingSet<test::mojom::PackageTestService> bindings_; 91 BindingSet<test::mojom::PackageTestService> bindings_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(ProvidedShellClient); 93 DISALLOW_COPY_AND_ASSIGN(ProvidedShellClient);
94 }; 94 };
95 95
96 class PackageTestShellClient 96 class PackageTestShellClient
97 : public ShellClient, 97 : public ShellClient,
98 public InterfaceFactory<mojom::ShellClientFactory>, 98 public InterfaceFactory<mojom::ShellClientFactory>,
99 public InterfaceFactory<test::mojom::PackageTestService>, 99 public InterfaceFactory<test::mojom::PackageTestService>,
100 public mojom::ShellClientFactory, 100 public mojom::ShellClientFactory,
101 public test::mojom::PackageTestService { 101 public test::mojom::PackageTestService {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 callback.Run("ROOT"); 144 callback.Run("ROOT");
145 } 145 }
146 146
147 void OnConnectionError() { 147 void OnConnectionError() {
148 if (bindings_.empty()) 148 if (bindings_.empty())
149 shell_->Quit(); 149 shell_->Quit();
150 } 150 }
151 151
152 Shell* shell_; 152 Shell* shell_;
153 std::vector<scoped_ptr<ShellClient>> delegates_; 153 std::vector<scoped_ptr<ShellClient>> delegates_;
154 WeakBindingSet<mojom::ShellClientFactory> shell_client_factory_bindings_; 154 BindingSet<mojom::ShellClientFactory> shell_client_factory_bindings_;
155 WeakBindingSet<test::mojom::PackageTestService> bindings_; 155 BindingSet<test::mojom::PackageTestService> bindings_;
156 156
157 DISALLOW_COPY_AND_ASSIGN(PackageTestShellClient); 157 DISALLOW_COPY_AND_ASSIGN(PackageTestShellClient);
158 }; 158 };
159 159
160 } // namespace shell 160 } // namespace shell
161 } // namespace mojo 161 } // namespace mojo
162 162
163 163
164 MojoResult MojoMain(MojoHandle shell_handle) { 164 MojoResult MojoMain(MojoHandle shell_handle) {
165 MojoResult rv = mojo::ApplicationRunner( 165 MojoResult rv = mojo::ApplicationRunner(
166 new mojo::shell::PackageTestShellClient).Run(shell_handle); 166 new mojo::shell::PackageTestShellClient).Run(shell_handle);
167 return rv; 167 return rv;
168 } 168 }
OLDNEW
« no previous file with comments | « mojo/shell/tests/capability_filter_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698