| 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 "mojo/edk/system/platform_handle_dispatcher.h" | 5 #include "mojo/edk/system/platform_handle_dispatcher.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get())); | 97 EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get())); |
| 98 | 98 |
| 99 auto dispatcher = | 99 auto dispatcher = |
| 100 PlatformHandleDispatcher::Create(PlatformHandleFromFILE(std::move(fp))); | 100 PlatformHandleDispatcher::Create(PlatformHandleFromFILE(std::move(fp))); |
| 101 Handle handle(std::move(dispatcher), | 101 Handle handle(std::move(dispatcher), |
| 102 PlatformHandleDispatcher::kDefaultHandleRights); | 102 PlatformHandleDispatcher::kDefaultHandleRights); |
| 103 | 103 |
| 104 HandleTransport transport(test::HandleTryStartTransport(handle)); | 104 HandleTransport transport(test::HandleTryStartTransport(handle)); |
| 105 EXPECT_TRUE(transport.is_valid()); | 105 EXPECT_TRUE(transport.is_valid()); |
| 106 EXPECT_EQ(Dispatcher::Type::PLATFORM_HANDLE, transport.GetType()); | 106 EXPECT_EQ(Dispatcher::Type::PLATFORM_HANDLE, transport.GetType()); |
| 107 EXPECT_FALSE(transport.IsBusy()); | |
| 108 | 107 |
| 109 Handle equivalent_handle = | 108 Handle equivalent_handle = |
| 110 transport.CreateEquivalentHandleAndClose(nullptr, 0u); | 109 transport.CreateEquivalentHandleAndClose(nullptr, 0u); |
| 111 ASSERT_TRUE(equivalent_handle.dispatcher); | 110 ASSERT_TRUE(equivalent_handle.dispatcher); |
| 112 EXPECT_EQ(PlatformHandleDispatcher::kDefaultHandleRights, | 111 EXPECT_EQ(PlatformHandleDispatcher::kDefaultHandleRights, |
| 113 equivalent_handle.rights); | 112 equivalent_handle.rights); |
| 114 | 113 |
| 115 transport.End(); | 114 transport.End(); |
| 116 EXPECT_TRUE(handle.dispatcher->HasOneRef()); | 115 EXPECT_TRUE(handle.dispatcher->HasOneRef()); |
| 117 handle.reset(); | 116 handle.reset(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 130 EXPECT_EQ(sizeof(kFooBar), | 129 EXPECT_EQ(sizeof(kFooBar), |
| 131 fread(read_buffer, 1, sizeof(read_buffer), fp.get())); | 130 fread(read_buffer, 1, sizeof(read_buffer), fp.get())); |
| 132 EXPECT_STREQ(kFooBar, read_buffer); | 131 EXPECT_STREQ(kFooBar, read_buffer); |
| 133 | 132 |
| 134 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); | 133 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); |
| 135 } | 134 } |
| 136 | 135 |
| 137 } // namespace | 136 } // namespace |
| 138 } // namespace system | 137 } // namespace system |
| 139 } // namespace mojo | 138 } // namespace mojo |
| OLD | NEW |