| 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 26 matching lines...) Expand all Loading... |
| 37 // We need to do this to force the shell to read the test app's manifest and | 37 // We need to do this to force the shell to read the test app's manifest and |
| 38 // register aliases. | 38 // register aliases. |
| 39 test::mojom::PackageTestServicePtr root_service; | 39 test::mojom::PackageTestServicePtr root_service; |
| 40 scoped_ptr<Connection> connection = | 40 scoped_ptr<Connection> connection = |
| 41 shell()->Connect("mojo:package_test_package"); | 41 shell()->Connect("mojo:package_test_package"); |
| 42 connection->GetInterface(&root_service); | 42 connection->GetInterface(&root_service); |
| 43 base::RunLoop run_loop; | 43 base::RunLoop run_loop; |
| 44 std::string root_name; | 44 std::string root_name; |
| 45 root_service->GetName(base::Bind(&ReceiveName, &root_name, &run_loop)); | 45 root_service->GetName(base::Bind(&ReceiveName, &root_name, &run_loop)); |
| 46 run_loop.Run(); | 46 run_loop.Run(); |
| 47 uint32_t id = mojom::Shell::kInvalidApplicationID; | 47 uint32_t id = mojom::Connector::kInvalidApplicationID; |
| 48 EXPECT_TRUE(connection->GetRemoteApplicationID(&id)); | 48 EXPECT_TRUE(connection->GetRemoteApplicationID(&id)); |
| 49 ids.insert(id); | 49 ids.insert(id); |
| 50 } | 50 } |
| 51 | 51 |
| 52 { | 52 { |
| 53 // Now subsequent connects to applications provided by the root app will be | 53 // Now subsequent connects to applications provided by the root app will be |
| 54 // resolved correctly. | 54 // resolved correctly. |
| 55 test::mojom::PackageTestServicePtr service_a; | 55 test::mojom::PackageTestServicePtr service_a; |
| 56 scoped_ptr<Connection> connection = shell()->Connect("mojo:package_test_a"); | 56 scoped_ptr<Connection> connection = shell()->Connect("mojo:package_test_a"); |
| 57 connection->GetInterface(&service_a); | 57 connection->GetInterface(&service_a); |
| 58 base::RunLoop run_loop; | 58 base::RunLoop run_loop; |
| 59 std::string a_name; | 59 std::string a_name; |
| 60 service_a->GetName(base::Bind(&ReceiveName, &a_name, &run_loop)); | 60 service_a->GetName(base::Bind(&ReceiveName, &a_name, &run_loop)); |
| 61 run_loop.Run(); | 61 run_loop.Run(); |
| 62 EXPECT_EQ("A", a_name); | 62 EXPECT_EQ("A", a_name); |
| 63 uint32_t id = mojom::Shell::kInvalidApplicationID; | 63 uint32_t id = mojom::Connector::kInvalidApplicationID; |
| 64 EXPECT_TRUE(connection->GetRemoteApplicationID(&id)); | 64 EXPECT_TRUE(connection->GetRemoteApplicationID(&id)); |
| 65 ids.insert(id); | 65 ids.insert(id); |
| 66 } | 66 } |
| 67 | 67 |
| 68 { | 68 { |
| 69 test::mojom::PackageTestServicePtr service_b; | 69 test::mojom::PackageTestServicePtr service_b; |
| 70 scoped_ptr<Connection> connection = shell()->Connect("mojo:package_test_b"); | 70 scoped_ptr<Connection> connection = shell()->Connect("mojo:package_test_b"); |
| 71 connection->GetInterface(&service_b); | 71 connection->GetInterface(&service_b); |
| 72 base::RunLoop run_loop; | 72 base::RunLoop run_loop; |
| 73 std::string b_name; | 73 std::string b_name; |
| 74 service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop)); | 74 service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop)); |
| 75 run_loop.Run(); | 75 run_loop.Run(); |
| 76 EXPECT_EQ("B", b_name); | 76 EXPECT_EQ("B", b_name); |
| 77 uint32_t id = mojom::Shell::kInvalidApplicationID; | 77 uint32_t id = mojom::Connector::kInvalidApplicationID; |
| 78 EXPECT_TRUE(connection->GetRemoteApplicationID(&id)); | 78 EXPECT_TRUE(connection->GetRemoteApplicationID(&id)); |
| 79 ids.insert(id); | 79 ids.insert(id); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace shell | 83 } // namespace shell |
| 84 } // namespace mojo | 84 } // namespace mojo |
| OLD | NEW |