| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 23 matching lines...) Expand all Loading... |
| 34 : target_id_(mojom::Shell::kInvalidApplicationID), | 34 : target_id_(mojom::Shell::kInvalidApplicationID), |
| 35 binding_(this) {} | 35 binding_(this) {} |
| 36 ~ApplicationManagerAppTestDelegate() override {} | 36 ~ApplicationManagerAppTestDelegate() override {} |
| 37 | 37 |
| 38 uint32_t target_id() const { return target_id_; } | 38 uint32_t target_id() const { return target_id_; } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // mojo::ShellClient: | 41 // mojo::ShellClient: |
| 42 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} | 42 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} |
| 43 bool AcceptConnection(Connection* connection) override { | 43 bool AcceptConnection(Connection* connection) override { |
| 44 connection->AddService<CreateInstanceForHandleTest>(this); | 44 connection->AddInterface<CreateInstanceForHandleTest>(this); |
| 45 return true; | 45 return true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // InterfaceFactory<CreateInstanceForHandleTest>: | 48 // InterfaceFactory<CreateInstanceForHandleTest>: |
| 49 void Create(Connection* connection, | 49 void Create(Connection* connection, |
| 50 InterfaceRequest<CreateInstanceForHandleTest> request) override { | 50 InterfaceRequest<CreateInstanceForHandleTest> request) override { |
| 51 binding_.Bind(std::move(request)); | 51 binding_.Bind(std::move(request)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // CreateInstanceForHandleTest: | 54 // CreateInstanceForHandleTest: |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 TEST_F(ApplicationManagerAppTest, CreateInstanceForHandle) { | 170 TEST_F(ApplicationManagerAppTest, CreateInstanceForHandle) { |
| 171 AddListenerAndWaitForApplications(); | 171 AddListenerAndWaitForApplications(); |
| 172 | 172 |
| 173 // 1. Launch a process. (Actually, have the runner launch a process that | 173 // 1. Launch a process. (Actually, have the runner launch a process that |
| 174 // launches a process. #becauselinkerrors). | 174 // launches a process. #becauselinkerrors). |
| 175 mojo::shell::test::mojom::DriverPtr driver; | 175 mojo::shell::test::mojom::DriverPtr driver; |
| 176 scoped_ptr<Connection> connection = | 176 scoped_ptr<Connection> connection = |
| 177 shell()->Connect("exe:application_manager_apptest_driver"); | 177 shell()->Connect("exe:application_manager_apptest_driver"); |
| 178 connection->ConnectToService(&driver); | 178 connection->GetInterface(&driver); |
| 179 | 179 |
| 180 // 2. Wait for the target to connect to us. (via | 180 // 2. Wait for the target to connect to us. (via |
| 181 // mojo:application_manager_apptests) | 181 // mojo:application_manager_apptests) |
| 182 base::MessageLoop::current()->Run(); | 182 base::MessageLoop::current()->Run(); |
| 183 | 183 |
| 184 uint32_t remote_id = mojom::Shell::kInvalidApplicationID; | 184 uint32_t remote_id = mojom::Shell::kInvalidApplicationID; |
| 185 EXPECT_TRUE(connection->GetRemoteApplicationID(&remote_id)); | 185 EXPECT_TRUE(connection->GetRemoteApplicationID(&remote_id)); |
| 186 EXPECT_NE(mojom::Shell::kInvalidApplicationID, remote_id); | 186 EXPECT_NE(mojom::Shell::kInvalidApplicationID, remote_id); |
| 187 | 187 |
| 188 // 3. Validate that this test suite's pretty name was consumed from its | 188 // 3. Validate that this test suite's pretty name was consumed from its |
| (...skipping 20 matching lines...) Expand all Loading... |
| 209 | 209 |
| 210 driver.set_connection_error_handler( | 210 driver.set_connection_error_handler( |
| 211 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, | 211 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, |
| 212 base::Unretained(this))); | 212 base::Unretained(this))); |
| 213 driver->QuitDriver(); | 213 driver->QuitDriver(); |
| 214 base::MessageLoop::current()->Run(); | 214 base::MessageLoop::current()->Run(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace shell | 217 } // namespace shell |
| 218 } // namespace mojo | 218 } // namespace mojo |
| OLD | NEW |