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

Unified Diff: tests/sel_main_chrome/sel_main_chrome_test.cc

Issue 261683002: Make a NaClDesc ctor for creating descs from NaClFileInfo. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: make it posix file descriptor Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/validator/nacl_file_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/sel_main_chrome/sel_main_chrome_test.cc
diff --git a/tests/sel_main_chrome/sel_main_chrome_test.cc b/tests/sel_main_chrome/sel_main_chrome_test.cc
index 251f7370821cf32ef50a497d7672bb12828b3b88..69d7982775eb52a1dbca285109e4dbd8cd875100 100644
--- a/tests/sel_main_chrome/sel_main_chrome_test.cc
+++ b/tests/sel_main_chrome/sel_main_chrome_test.cc
@@ -13,11 +13,12 @@
#include "native_client/src/public/chrome_main.h"
#include "native_client/src/public/nacl_app.h"
+#include "native_client/src/public/nacl_file_info.h"
#include "native_client/src/shared/platform/nacl_check.h"
#include "native_client/src/shared/platform/nacl_threads.h"
#include "native_client/src/shared/srpc/nacl_srpc.h"
#include "native_client/src/trusted/desc/nacl_desc_custom.h"
-#include "native_client/src/trusted/desc_cacheability/desc_cacheability.h"
+#include "native_client/src/trusted/desc/nacl_desc_file_info.h"
#include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
#include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
#include "native_client/src/trusted/service_runtime/nacl_all_modules.h"
@@ -25,7 +26,6 @@
#include "native_client/src/trusted/service_runtime/nacl_valgrind_hooks.h"
#include "native_client/src/trusted/service_runtime/sel_addrspace.h"
#include "native_client/src/trusted/service_runtime/sel_ldr.h"
-#include "native_client/src/trusted/validator/nacl_file_info.h"
#include "native_client/src/trusted/validator/validation_cache.h"
@@ -124,22 +124,18 @@ static int TestResolveFileToken(void *handle, struct NaClFileToken *file_token,
struct ThreadArgs {
NaClHandle channel;
- int nexe_fd;
- NaClFileToken nexe_token;
+ NaClFileInfo file_info;
};
void WINAPI DummyRendererThread(void *thread_arg) {
struct ThreadArgs *args = (struct ThreadArgs *) thread_arg;
nacl::DescWrapperFactory desc_wrapper_factory;
- nacl::DescWrapper *nexe_desc =
- desc_wrapper_factory.MakeFileDesc(args->nexe_fd, NACL_ABI_O_RDONLY);
+ struct NaClDesc *desc = NaClDescIoFromFileInfo(args->file_info,
+ NACL_ABI_O_RDONLY);
+ CHECK(desc != NULL);
+ nacl::DescWrapper *nexe_desc = desc_wrapper_factory.MakeGenericCleanup(desc);
CHECK(nexe_desc != NULL);
- if (args->nexe_token.lo != 0 && args->nexe_token.hi != 0) {
- int token_res = NaClDescSetFileToken(nexe_desc->desc(), &args->nexe_token);
- CHECK(token_res != 0);
- }
-
DummyLauncher launcher(args->channel);
NaClSrpcChannel trusted_channel;
NaClSrpcChannel untrusted_channel;
@@ -200,8 +196,9 @@ int main(int argc, char **argv) {
args->irt_fd = OpenFileReadOnly(argv[1]);
CHECK(args->irt_fd >= 0);
- thread_args.nexe_fd = OpenFileReadOnly(argv[2]);
- CHECK(thread_args.nexe_fd >= 0);
+ memset(&thread_args.file_info, 0, sizeof thread_args.file_info);
+ thread_args.file_info.desc = OpenFileReadOnly(argv[2]);
+ CHECK(thread_args.file_info.desc >= 0);
NaClFileNameForValgrind(argv[2]);
NaClHandle socketpair[2];
@@ -230,11 +227,8 @@ int main(int argc, char **argv) {
test_cache.CachingIsInexpensive = &TestCachingIsInexpensive;
test_cache.ResolveFileToken = &TestResolveFileToken;
args->validation_cache = &test_cache;
- thread_args.nexe_token.lo = test_handle.expected_token_lo;
- thread_args.nexe_token.hi = test_handle.expected_token_hi;
- } else {
- thread_args.nexe_token.lo = 0;
- thread_args.nexe_token.hi = 0;
+ thread_args.file_info.file_token.lo = test_handle.expected_token_lo;
+ thread_args.file_info.file_token.hi = test_handle.expected_token_hi;
}
NaClThread thread;
« no previous file with comments | « src/trusted/validator/nacl_file_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698