| 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 "apps/moterm/moterm_driver.h" | 5 #include "apps/moterm/moterm_driver.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "mojo/public/cpp/application/application_test_base.h" | 14 #include "mojo/public/cpp/application/application_test_base.h" |
| 15 #include "mojo/public/cpp/bindings/callback.h" | 15 #include "mojo/public/cpp/bindings/callback.h" |
| 16 #include "mojo/public/cpp/bindings/type_converter.h" | 16 #include "mojo/public/cpp/bindings/type_converter.h" |
| 17 #include "mojo/services/files/public/interfaces/file.mojom.h" | 17 #include "mojo/services/files/interfaces/file.mojom.h" |
| 18 #include "mojo/services/files/public/interfaces/types.mojom.h" | 18 #include "mojo/services/files/interfaces/types.mojom.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // A test |MotermDriver::Client| that just records the notifications it | 23 // A test |MotermDriver::Client| that just records the notifications it |
| 24 // receives. When |OnDestroyed()| gets called, it'll also quit the current | 24 // receives. When |OnDestroyed()| gets called, it'll also quit the current |
| 25 // message loop. | 25 // message loop. |
| 26 class TestClient : public MotermDriver::Client { | 26 class TestClient : public MotermDriver::Client { |
| 27 public: | 27 public: |
| 28 struct Event { | 28 struct Event { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // Here, detach rather than doing destroying the other end. | 274 // Here, detach rather than doing destroying the other end. |
| 275 // TODO(vtl): Verify that the driver's end of the message pipe is closed | 275 // TODO(vtl): Verify that the driver's end of the message pipe is closed |
| 276 // (e.g., by checking that |file| detects that its peer is closed). | 276 // (e.g., by checking that |file| detects that its peer is closed). |
| 277 driver->Detach(); | 277 driver->Detach(); |
| 278 EXPECT_FALSE(driver); | 278 EXPECT_FALSE(driver); |
| 279 // The client shouldn't have received anything. | 279 // The client shouldn't have received anything. |
| 280 EXPECT_TRUE(client.events().empty()); | 280 EXPECT_TRUE(client.events().empty()); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace | 283 } // namespace |
| OLD | NEW |