Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: mojo/edk/system/handle_unittest.cc

Issue 1957713003: EDK: Remove Core::GetDispatcher(). (Closed) Base URL: https://github.com/domokit/mojo.git@work789_edk_handle_table_14-x-work788_edk_handle_13.9-x-work787_edk_handle_13.8
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/handle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "mojo/edk/system/handle.h" 5 #include "mojo/edk/system/handle.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "mojo/edk/system/mock_simple_dispatcher.h" 9 #include "mojo/edk/system/mock_simple_dispatcher.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Move assignment from "null". 107 // Move assignment from "null".
108 Handle h5; 108 Handle h5;
109 h2 = std::move(h5); 109 h2 = std::move(h5);
110 EXPECT_FALSE(h2); 110 EXPECT_FALSE(h2);
111 EXPECT_FALSE(h2.dispatcher); 111 EXPECT_FALSE(h2.dispatcher);
112 112
113 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 113 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
114 } 114 }
115 } 115 }
116 116
117 TEST(HandleTest, HasAllRights) {
118 {
119 Handle h;
120
azani 2016/05/09 21:52:24 nit: Maybe add a test for for MOJO_HANDLE_RIGHT_NO
121 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_DUPLICATE));
122 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_TRANSFER));
123 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_READ));
124 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_WRITE));
125 }
126
127 {
128 Handle h(MakeRefCounted<test::MockSimpleDispatcher>(),
129 MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_READ);
130
131 EXPECT_TRUE(h.has_all_rights(MOJO_HANDLE_RIGHT_DUPLICATE));
132 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_TRANSFER));
133 EXPECT_TRUE(h.has_all_rights(MOJO_HANDLE_RIGHT_READ));
134 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_WRITE));
135
136 EXPECT_TRUE(
137 h.has_all_rights(MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_READ));
138 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_DUPLICATE |
139 MOJO_HANDLE_RIGHT_READ |
140 MOJO_HANDLE_RIGHT_WRITE));
141 EXPECT_FALSE(h.has_all_rights(MOJO_HANDLE_RIGHT_DUPLICATE |
142 MOJO_HANDLE_RIGHT_WRITE));
143
144 EXPECT_EQ(MOJO_RESULT_OK, h.dispatcher->Close());
145 }
146 }
147
117 } // namespace 148 } // namespace
118 } // namespace system 149 } // namespace system
119 } // namespace mojo 150 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698