| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This file tests the C handle API (the functions declared in | 5 // This file tests the C handle API (the functions declared in |
| 6 // mojo/public/c/system/handle.h). Note: The functionality of these APIs for | 6 // mojo/public/c/system/handle.h). Note: The functionality of these APIs for |
| 7 // specific types of handles are tested with the APIs for those types of | 7 // specific types of handles are tested with the APIs for those types of |
| 8 // handles. | 8 // handles. |
| 9 | 9 |
| 10 #include "mojo/public/c/system/handle.h" | 10 #include "mojo/public/c/system/handle.h" |
| 11 |
| 11 #include "mojo/public/c/system/message_pipe.h" | 12 #include "mojo/public/c/system/message_pipe.h" |
| 12 #include "mojo/public/c/system/result.h" | 13 #include "mojo/public/c/system/result.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 const MojoHandleRights kDefaultMessagePipeHandleRights = | 18 const MojoHandleRights kDefaultMessagePipeHandleRights = |
| 18 MOJO_HANDLE_RIGHT_TRANSFER | MOJO_HANDLE_RIGHT_READ | | 19 MOJO_HANDLE_RIGHT_TRANSFER | MOJO_HANDLE_RIGHT_READ | |
| 19 MOJO_HANDLE_RIGHT_WRITE | MOJO_HANDLE_RIGHT_GET_OPTIONS | | 20 MOJO_HANDLE_RIGHT_WRITE | MOJO_HANDLE_RIGHT_GET_OPTIONS | |
| 20 MOJO_HANDLE_RIGHT_SET_OPTIONS; | 21 MOJO_HANDLE_RIGHT_SET_OPTIONS; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Make sure that the rights are actually correctly enforced. | 108 // Make sure that the rights are actually correctly enforced. |
| 108 EXPECT_EQ( | 109 EXPECT_EQ( |
| 109 MOJO_RESULT_PERMISSION_DENIED, | 110 MOJO_RESULT_PERMISSION_DENIED, |
| 110 MojoWriteMessage(h0r1, &x, 1u, nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE)); | 111 MojoWriteMessage(h0r1, &x, 1u, nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE)); |
| 111 | 112 |
| 112 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0r1)); | 113 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0r1)); |
| 113 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); | 114 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); |
| 114 } | 115 } |
| 115 | 116 |
| 116 } // namespace | 117 } // namespace |
| OLD | NEW |