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 <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 connection->GetInterface(&standalone_app); | 300 connection->GetInterface(&standalone_app); |
301 std::string string1, string2; | 301 std::string string1, string2; |
302 base::RunLoop loop; | 302 base::RunLoop loop; |
303 standalone_app->ConnectToClassInterface( | 303 standalone_app->ConnectToClassInterface( |
304 base::Bind(&ReceiveTwoStrings, &string1, &string2, &loop)); | 304 base::Bind(&ReceiveTwoStrings, &string1, &string2, &loop)); |
305 loop.Run(); | 305 loop.Run(); |
306 EXPECT_EQ("PONG", string1); | 306 EXPECT_EQ("PONG", string1); |
307 EXPECT_EQ("CLASS APP", string2); | 307 EXPECT_EQ("CLASS APP", string2); |
308 } | 308 } |
309 | 309 |
310 TEST_F(ConnectTest, ConnectWithoutExplicitClassBlocked) { | |
311 // We not be able to bind a ClassInterfacePtr since the connect_unittest app | |
312 // does not explicitly request the "class" capability from | |
313 // connect_test_class_app. This test will hang if it is bound. | |
314 std::unique_ptr<Connection> connection = | |
315 connector()->Connect(kTestClassAppName); | |
316 test::mojom::ClassInterfacePtr class_interface; | |
317 connection->GetInterface(&class_interface); | |
318 base::RunLoop loop; | |
319 class_interface.set_connection_error_handler(base::Bind(&QuitLoop, &loop)); | |
320 loop.Run(); | |
321 } | |
322 | |
323 TEST_F(ConnectTest, ConnectAsDifferentUser_Allowed) { | 310 TEST_F(ConnectTest, ConnectAsDifferentUser_Allowed) { |
324 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName); | 311 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName); |
325 test::mojom::UserIdTestPtr user_id_test; | 312 test::mojom::UserIdTestPtr user_id_test; |
326 connection->GetInterface(&user_id_test); | 313 connection->GetInterface(&user_id_test); |
327 mojom::ConnectResult result; | 314 mojom::ConnectResult result; |
328 Identity target(kTestClassAppName, base::GenerateGUID()); | 315 Identity target(kTestClassAppName, base::GenerateGUID()); |
329 Identity result_identity; | 316 Identity result_identity; |
330 { | 317 { |
331 base::RunLoop loop; | 318 base::RunLoop loop; |
332 user_id_test->ConnectToClassAppAsDifferentUser( | 319 user_id_test->ConnectToClassAppAsDifferentUser( |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 run_loop.Run(); | 450 run_loop.Run(); |
464 CompareConnectionState( | 451 CompareConnectionState( |
465 kTestAppAName, test_name(), test_userid(), test_instance_id(), | 452 kTestAppAName, test_name(), test_userid(), test_instance_id(), |
466 kTestAppAName, connection->GetRemoteIdentity().user_id(), remote_id); | 453 kTestAppAName, connection->GetRemoteIdentity().user_id(), remote_id); |
467 } | 454 } |
468 | 455 |
469 } | 456 } |
470 } | 457 } |
471 | 458 |
472 } // namespace shell | 459 } // namespace shell |
OLD | NEW |