| 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 13 matching lines...) Expand all Loading... |
| 24 namespace mojo { | 24 namespace mojo { |
| 25 namespace shell { | 25 namespace shell { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class ApplicationManagerAppTestDelegate | 28 class ApplicationManagerAppTestDelegate |
| 29 : public ApplicationDelegate, | 29 : public ApplicationDelegate, |
| 30 public InterfaceFactory<CreateInstanceForHandleTest>, | 30 public InterfaceFactory<CreateInstanceForHandleTest>, |
| 31 public CreateInstanceForHandleTest { | 31 public CreateInstanceForHandleTest { |
| 32 public: | 32 public: |
| 33 ApplicationManagerAppTestDelegate() | 33 ApplicationManagerAppTestDelegate() |
| 34 : target_id_(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 // ApplicationDelegate: | 41 // ApplicationDelegate: |
| 42 void Initialize(ApplicationImpl* app) override {} | 42 void Initialize(ApplicationImpl* app) override {} |
| 43 bool AcceptConnection(ApplicationConnection* connection) override { | 43 bool AcceptConnection(ApplicationConnection* connection) override { |
| 44 connection->AddService<CreateInstanceForHandleTest>(this); | 44 connection->AddService<CreateInstanceForHandleTest>(this); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 mojo::shell::test::mojom::DriverPtr driver; | 176 mojo::shell::test::mojom::DriverPtr driver; |
| 177 scoped_ptr<ApplicationConnection> connection = | 177 scoped_ptr<ApplicationConnection> connection = |
| 178 application_impl()->ConnectToApplication( | 178 application_impl()->ConnectToApplication( |
| 179 "exe:application_manager_apptest_driver"); | 179 "exe:application_manager_apptest_driver"); |
| 180 connection->ConnectToService(&driver); | 180 connection->ConnectToService(&driver); |
| 181 | 181 |
| 182 // 2. Wait for the target to connect to us. (via | 182 // 2. Wait for the target to connect to us. (via |
| 183 // mojo:application_manager_apptests) | 183 // mojo:application_manager_apptests) |
| 184 base::MessageLoop::current()->Run(); | 184 base::MessageLoop::current()->Run(); |
| 185 | 185 |
| 186 uint32_t remote_id = Shell::kInvalidApplicationID; | 186 uint32_t remote_id = mojom::Shell::kInvalidApplicationID; |
| 187 EXPECT_TRUE(connection->GetRemoteApplicationID(&remote_id)); | 187 EXPECT_TRUE(connection->GetRemoteApplicationID(&remote_id)); |
| 188 EXPECT_NE(Shell::kInvalidApplicationID, remote_id); | 188 EXPECT_NE(mojom::Shell::kInvalidApplicationID, remote_id); |
| 189 | 189 |
| 190 // 3. Validate that this test suite's pretty name was consumed from its | 190 // 3. Validate that this test suite's pretty name was consumed from its |
| 191 // manifest. | 191 // manifest. |
| 192 EXPECT_TRUE(ContainsApplicationNamed("Application Manager Apptests")); | 192 EXPECT_TRUE(ContainsApplicationNamed("Application Manager Apptests")); |
| 193 | 193 |
| 194 // 4. Validate that the right applications/processes were created. | 194 // 4. Validate that the right applications/processes were created. |
| 195 // Note that the target process will be created even if the tests are | 195 // Note that the target process will be created even if the tests are |
| 196 // run with --single-process. | 196 // run with --single-process. |
| 197 EXPECT_EQ(2u, applications().size()); | 197 EXPECT_EQ(2u, applications().size()); |
| 198 { | 198 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 211 | 211 |
| 212 driver.set_connection_error_handler( | 212 driver.set_connection_error_handler( |
| 213 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, | 213 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, |
| 214 base::Unretained(this))); | 214 base::Unretained(this))); |
| 215 driver->QuitDriver(); | 215 driver->QuitDriver(); |
| 216 base::MessageLoop::current()->Run(); | 216 base::MessageLoop::current()->Run(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace shell | 219 } // namespace shell |
| 220 } // namespace mojo | 220 } // namespace mojo |
| OLD | NEW |