| 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 |
| 310 TEST_F(ConnectTest, ConnectAsDifferentUser_Allowed) { | 323 TEST_F(ConnectTest, ConnectAsDifferentUser_Allowed) { |
| 311 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName); | 324 std::unique_ptr<Connection> connection = connector()->Connect(kTestAppName); |
| 312 test::mojom::UserIdTestPtr user_id_test; | 325 test::mojom::UserIdTestPtr user_id_test; |
| 313 connection->GetInterface(&user_id_test); | 326 connection->GetInterface(&user_id_test); |
| 314 mojom::ConnectResult result; | 327 mojom::ConnectResult result; |
| 315 Identity target(kTestClassAppName, base::GenerateGUID()); | 328 Identity target(kTestClassAppName, base::GenerateGUID()); |
| 316 Identity result_identity; | 329 Identity result_identity; |
| 317 { | 330 { |
| 318 base::RunLoop loop; | 331 base::RunLoop loop; |
| 319 user_id_test->ConnectToClassAppAsDifferentUser( | 332 user_id_test->ConnectToClassAppAsDifferentUser( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 run_loop.Run(); | 463 run_loop.Run(); |
| 451 CompareConnectionState( | 464 CompareConnectionState( |
| 452 kTestAppAName, test_name(), test_userid(), test_instance_id(), | 465 kTestAppAName, test_name(), test_userid(), test_instance_id(), |
| 453 kTestAppAName, connection->GetRemoteIdentity().user_id(), remote_id); | 466 kTestAppAName, connection->GetRemoteIdentity().user_id(), remote_id); |
| 454 } | 467 } |
| 455 | 468 |
| 456 } | 469 } |
| 457 } | 470 } |
| 458 | 471 |
| 459 } // namespace shell | 472 } // namespace shell |
| OLD | NEW |