| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 InterfaceRequest<shell::mojom::ShellClient> g_shell_client_request; | 29 InterfaceRequest<shell::mojom::ShellClient> g_shell_client_request; |
| 30 | 30 |
| 31 // Connector pointer passed in the initial mojo.ShellClient.Initialize() call, | 31 // Connector pointer passed in the initial mojo.ShellClient.Initialize() call, |
| 32 // stored in between initial setup and the first test and between SetUp/TearDown | 32 // stored in between initial setup and the first test and between SetUp/TearDown |
| 33 // calls so we can (re-)initialize new ShellConnections. | 33 // calls so we can (re-)initialize new ShellConnections. |
| 34 shell::mojom::ConnectorPtr g_connector; | 34 shell::mojom::ConnectorPtr g_connector; |
| 35 | 35 |
| 36 class ShellGrabber : public shell::mojom::ShellClient { | 36 class ShellGrabber : public shell::mojom::ShellClient { |
| 37 public: | 37 public: |
| 38 explicit ShellGrabber(InterfaceRequest<shell::mojom::ShellClient> request) | 38 explicit ShellGrabber(InterfaceRequest<shell::mojom::ShellClient> request) |
| 39 : binding_(this, std::move(request)) {} | 39 : binding_(this, std::move(request)) { |
| 40 binding_.set_connection_error_handler([] { _exit(1); }); |
| 41 } |
| 40 | 42 |
| 41 void WaitForInitialize() { | 43 void WaitForInitialize() { |
| 42 // Initialize is always the first call made on ShellClient. | 44 // Initialize is always the first call made on ShellClient. |
| 43 CHECK(binding_.WaitForIncomingMethodCall()); | 45 CHECK(binding_.WaitForIncomingMethodCall()); |
| 44 } | 46 } |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 // shell::mojom::ShellClient implementation. | 49 // shell::mojom::ShellClient implementation. |
| 48 void Initialize(shell::mojom::IdentityPtr identity, | 50 void Initialize(shell::mojom::IdentityPtr identity, |
| 49 uint32_t id, | 51 uint32_t id, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 CHECK(!base::MessageLoop::current()); | 174 CHECK(!base::MessageLoop::current()); |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 176 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { | 178 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { |
| 177 return true; | 179 return true; |
| 178 } | 180 } |
| 179 | 181 |
| 180 } // namespace test | 182 } // namespace test |
| 181 } // namespace mojo | 183 } // namespace mojo |
| OLD | NEW |