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

Side by Side Diff: services/service_manager/tests/connect/connect_unittest.cc

Issue 2440903002: Make "all user" services work when packaged. (Closed)
Patch Set: Fixed other tests Created 4 years, 1 month 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
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 <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { 201 {
202 connection_b->GetInterface(&service_b); 202 connection_b->GetInterface(&service_b);
203 base::RunLoop loop; 203 base::RunLoop loop;
204 service_b->GetInstance(base::Bind(&ReceiveOneString, &instance_b, &loop)); 204 service_b->GetInstance(base::Bind(&ReceiveOneString, &instance_b, &loop));
205 loop.Run(); 205 loop.Run();
206 } 206 }
207 207
208 EXPECT_NE(instance_a1, instance_b); 208 EXPECT_NE(instance_a1, instance_b);
209 } 209 }
210 210
211 // When both the unresolved and resolved instance names are their default 211 // When both the unresolved and resolved instance names are their default
Jay Civelli 2016/10/21 19:19:23 @rockot Do you think this test should go entirely?
Ken Rockot(use gerrit already) 2016/10/21 19:52:33 Yeah, seems reasonable to delete this.
Jay Civelli 2016/10/21 20:48:33 Removed.
212 // values, the instance name from the unresolved name must be used. 212 // values, the instance name from the unresolved name must be used.
213 // (The case where the instance names differ is covered by 213 // (The case where the instance names differ is covered by
214 // LifecycleTest.PackagedApp_CrashCrashesOtherProvidedApp). 214 // LifecycleTest.PackagedApp_CrashCrashesOtherProvidedApp).
215 TEST_F(ConnectTest, PreferUnresolvedDefaultInstanceName) { 215 TEST_F(ConnectTest, PreferUnresolvedDefaultInstanceName) {
216 // Connect to an app with no manifest-supplied instance name provided by a 216 // Connect to an app with no manifest-supplied instance name provided by a
217 // package, the instance name must be derived from the application instance 217 // package, the instance name should be empty.
218 // name, not the package.
219 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName); 218 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName);
220 { 219 {
221 base::RunLoop loop; 220 base::RunLoop loop;
222 connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop)); 221 connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop));
223 loop.Run(); 222 loop.Run();
224 } 223 }
225 224
226 std::string instance; 225 std::string instance;
227 { 226 {
228 test::mojom::ConnectTestServicePtr service; 227 test::mojom::ConnectTestServicePtr service;
229 connection->GetInterface(&service); 228 connection->GetInterface(&service);
230 base::RunLoop loop; 229 base::RunLoop loop;
231 service->GetInstance(base::Bind(&ReceiveOneString, &instance, &loop)); 230 service->GetInstance(base::Bind(&ReceiveOneString, &instance, &loop));
232 loop.Run(); 231 loop.Run();
233 } 232 }
234 EXPECT_EQ(GetNamePath(kTestAppName), instance); 233 EXPECT_EQ("", instance);
235 } 234 }
236 235
237 // BlockedInterface should not be exposed to this application because it is not 236 // BlockedInterface should not be exposed to this application because it is not
238 // in our CapabilityFilter whitelist. 237 // in our CapabilityFilter whitelist.
239 TEST_F(ConnectTest, BlockedInterface) { 238 TEST_F(ConnectTest, BlockedInterface) {
240 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName); 239 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName);
241 base::RunLoop run_loop; 240 base::RunLoop run_loop;
242 test::mojom::BlockedInterfacePtr blocked; 241 test::mojom::BlockedInterfacePtr blocked;
243 connection->GetInterface(&blocked); 242 connection->GetInterface(&blocked);
244 blocked.set_connection_error_handler(base::Bind(&QuitLoop, &run_loop)); 243 blocked.set_connection_error_handler(base::Bind(&QuitLoop, &run_loop));
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 base::RunLoop loop; 409 base::RunLoop loop;
411 inherit_connection->AddConnectionCompletedClosure( 410 inherit_connection->AddConnectionCompletedClosure(
412 base::Bind(&QuitLoop, &loop)); 411 base::Bind(&QuitLoop, &loop));
413 loop.Run(); 412 loop.Run();
414 EXPECT_EQ(inherit_connection->GetRemoteIdentity().user_id(), 413 EXPECT_EQ(inherit_connection->GetRemoteIdentity().user_id(),
415 connection->GetRemoteIdentity().user_id()); 414 connection->GetRemoteIdentity().user_id());
416 } 415 }
417 } 416 }
418 417
419 } // namespace service_manager 418 } // namespace service_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698