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

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

Issue 1953293003: EDK: Add handle rights checking to the various entrypoints. (Closed) Base URL: https://github.com/domokit/mojo.git@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
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ASSERT_TRUE(fp); 69 ASSERT_TRUE(fp);
70 70
71 ScopedPlatformHandle h(PlatformHandleFromFILE(std::move(fp))); 71 ScopedPlatformHandle h(PlatformHandleFromFILE(std::move(fp)));
72 EXPECT_FALSE(fp); 72 EXPECT_FALSE(fp);
73 ASSERT_TRUE(h.is_valid()); 73 ASSERT_TRUE(h.is_valid());
74 74
75 auto d = PlatformHandleDispatcher::Create(h.Pass()); 75 auto d = PlatformHandleDispatcher::Create(h.Pass());
76 ASSERT_TRUE(d); 76 ASSERT_TRUE(d);
77 EXPECT_FALSE(h.is_valid()); 77 EXPECT_FALSE(h.is_valid());
78 78
79 EXPECT_TRUE(d->SupportsEntrypointClass(EntrypointClass::NONE));
79 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::MESSAGE_PIPE)); 80 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::MESSAGE_PIPE));
80 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::DATA_PIPE_PRODUCER)); 81 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::DATA_PIPE_PRODUCER));
81 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::DATA_PIPE_CONSUMER)); 82 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::DATA_PIPE_CONSUMER));
82 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::BUFFER)); 83 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::BUFFER));
83 84
84 // TODO(vtl): Check that it actually returns |MOJO_RESULT_INVALID_ARGUMENT| 85 // TODO(vtl): Check that it actually returns |MOJO_RESULT_INVALID_ARGUMENT|
85 // for methods in unsupported entrypoint classes. 86 // for methods in unsupported entrypoint classes.
86 87
87 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 88 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
88 } 89 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EXPECT_EQ(sizeof(kFooBar), 130 EXPECT_EQ(sizeof(kFooBar),
130 fread(read_buffer, 1, sizeof(read_buffer), fp.get())); 131 fread(read_buffer, 1, sizeof(read_buffer), fp.get()));
131 EXPECT_STREQ(kFooBar, read_buffer); 132 EXPECT_STREQ(kFooBar, read_buffer);
132 133
133 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); 134 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
134 } 135 }
135 136
136 } // namespace 137 } // namespace
137 } // namespace system 138 } // namespace system
138 } // namespace mojo 139 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698