| 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 12 matching lines...) Expand all Loading... |
| 23 namespace mojo { | 23 namespace mojo { |
| 24 namespace shell { | 24 namespace shell { |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 class ApplicationManagerAppTestDelegate | 27 class ApplicationManagerAppTestDelegate |
| 28 : public ShellClient, | 28 : public ShellClient, |
| 29 public InterfaceFactory<CreateInstanceForHandleTest>, | 29 public InterfaceFactory<CreateInstanceForHandleTest>, |
| 30 public CreateInstanceForHandleTest { | 30 public CreateInstanceForHandleTest { |
| 31 public: | 31 public: |
| 32 ApplicationManagerAppTestDelegate() | 32 ApplicationManagerAppTestDelegate() |
| 33 : target_id_(mojom::Shell::kInvalidApplicationID), | 33 : target_id_(mojom::Connector::kInvalidApplicationID), |
| 34 binding_(this) {} | 34 binding_(this) {} |
| 35 ~ApplicationManagerAppTestDelegate() override {} | 35 ~ApplicationManagerAppTestDelegate() override {} |
| 36 | 36 |
| 37 uint32_t target_id() const { return target_id_; } | 37 uint32_t target_id() const { return target_id_; } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // mojo::ShellClient: | 40 // mojo::ShellClient: |
| 41 void Initialize(Shell* shell, const std::string& url, uint32_t id, | 41 void Initialize(Shell* shell, const std::string& url, uint32_t id, |
| 42 uint32_t user_id) override {} | 42 uint32_t user_id) override {} |
| 43 bool AcceptConnection(Connection* connection) override { | 43 bool AcceptConnection(Connection* connection) override { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // launches a process. #becauselinkerrors). | 169 // launches a process. #becauselinkerrors). |
| 170 mojo::shell::test::mojom::DriverPtr driver; | 170 mojo::shell::test::mojom::DriverPtr driver; |
| 171 scoped_ptr<Connection> connection = | 171 scoped_ptr<Connection> connection = |
| 172 shell()->Connect("exe:application_manager_apptest_driver"); | 172 shell()->Connect("exe:application_manager_apptest_driver"); |
| 173 connection->GetInterface(&driver); | 173 connection->GetInterface(&driver); |
| 174 | 174 |
| 175 // 2. Wait for the target to connect to us. (via | 175 // 2. Wait for the target to connect to us. (via |
| 176 // mojo:application_manager_apptests) | 176 // mojo:application_manager_apptests) |
| 177 base::MessageLoop::current()->Run(); | 177 base::MessageLoop::current()->Run(); |
| 178 | 178 |
| 179 uint32_t remote_id = mojom::Shell::kInvalidApplicationID; | 179 uint32_t remote_id = mojom::Connector::kInvalidApplicationID; |
| 180 EXPECT_TRUE(connection->GetRemoteApplicationID(&remote_id)); | 180 EXPECT_TRUE(connection->GetRemoteApplicationID(&remote_id)); |
| 181 EXPECT_NE(mojom::Shell::kInvalidApplicationID, remote_id); | 181 EXPECT_NE(mojom::Connector::kInvalidApplicationID, remote_id); |
| 182 | 182 |
| 183 // 3. Validate that this test suite's URL was received from the application | 183 // 3. Validate that this test suite's URL was received from the application |
| 184 // manager. | 184 // manager. |
| 185 EXPECT_TRUE(ContainsApplicationWithURL("mojo://mojo_shell_apptests/")); | 185 EXPECT_TRUE(ContainsApplicationWithURL("mojo://mojo_shell_apptests/")); |
| 186 | 186 |
| 187 // 4. Validate that the right applications/processes were created. | 187 // 4. Validate that the right applications/processes were created. |
| 188 // Note that the target process will be created even if the tests are | 188 // Note that the target process will be created even if the tests are |
| 189 // run with --single-process. | 189 // run with --single-process. |
| 190 EXPECT_EQ(2u, applications().size()); | 190 EXPECT_EQ(2u, applications().size()); |
| 191 { | 191 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 204 | 204 |
| 205 driver.set_connection_error_handler( | 205 driver.set_connection_error_handler( |
| 206 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, | 206 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, |
| 207 base::Unretained(this))); | 207 base::Unretained(this))); |
| 208 driver->QuitDriver(); | 208 driver->QuitDriver(); |
| 209 base::MessageLoop::current()->Run(); | 209 base::MessageLoop::current()->Run(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace shell | 212 } // namespace shell |
| 213 } // namespace mojo | 213 } // namespace mojo |
| OLD | NEW |