OLD | NEW |
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" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ApplicationPackageApptestDelegate* delegate_; | 169 ApplicationPackageApptestDelegate* delegate_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(ApplicationPackageApptest); | 171 DISALLOW_COPY_AND_ASSIGN(ApplicationPackageApptest); |
172 }; | 172 }; |
173 | 173 |
174 TEST_F(ApplicationPackageApptest, Basic) { | 174 TEST_F(ApplicationPackageApptest, Basic) { |
175 { | 175 { |
176 // We need to do this to force the shell to read the test app's manifest and | 176 // We need to do this to force the shell to read the test app's manifest and |
177 // register aliases. | 177 // register aliases. |
178 test::mojom::ApplicationPackageApptestServicePtr root_service; | 178 test::mojom::ApplicationPackageApptestServicePtr root_service; |
179 shell()->ConnectToService("mojo:mojo_shell_apptests", &root_service); | 179 shell()->ConnectToInterface("mojo:mojo_shell_apptests", &root_service); |
180 base::RunLoop run_loop; | 180 base::RunLoop run_loop; |
181 std::string root_name; | 181 std::string root_name; |
182 root_service->GetName(base::Bind(&ReceiveName, &root_name, &run_loop)); | 182 root_service->GetName(base::Bind(&ReceiveName, &root_name, &run_loop)); |
183 run_loop.Run(); | 183 run_loop.Run(); |
184 } | 184 } |
185 | 185 |
186 { | 186 { |
187 // Now subsequent connects to applications provided by the root app will be | 187 // Now subsequent connects to applications provided by the root app will be |
188 // resolved correctly. | 188 // resolved correctly. |
189 test::mojom::ApplicationPackageApptestServicePtr service_a; | 189 test::mojom::ApplicationPackageApptestServicePtr service_a; |
190 shell()->ConnectToService("mojo:package_test_a", &service_a); | 190 shell()->ConnectToInterface("mojo:package_test_a", &service_a); |
191 base::RunLoop run_loop; | 191 base::RunLoop run_loop; |
192 std::string a_name; | 192 std::string a_name; |
193 service_a->GetName(base::Bind(&ReceiveName, &a_name, &run_loop)); | 193 service_a->GetName(base::Bind(&ReceiveName, &a_name, &run_loop)); |
194 run_loop.Run(); | 194 run_loop.Run(); |
195 EXPECT_EQ("A", a_name); | 195 EXPECT_EQ("A", a_name); |
196 } | 196 } |
197 | 197 |
198 { | 198 { |
199 test::mojom::ApplicationPackageApptestServicePtr service_b; | 199 test::mojom::ApplicationPackageApptestServicePtr service_b; |
200 shell()->ConnectToService("mojo:package_test_b", &service_b); | 200 shell()->ConnectToInterface("mojo:package_test_b", &service_b); |
201 base::RunLoop run_loop; | 201 base::RunLoop run_loop; |
202 std::string b_name; | 202 std::string b_name; |
203 service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop)); | 203 service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop)); |
204 run_loop.Run(); | 204 run_loop.Run(); |
205 EXPECT_EQ("B", b_name); | 205 EXPECT_EQ("B", b_name); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 } // namespace shell | 209 } // namespace shell |
210 } // namespace mojo | 210 } // namespace mojo |
OLD | NEW |