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

Unified Diff: libraries/nacl-mounts/test.nacl/DevTest.cc

Issue 10377102: Added simplest device mount implementation (includes NullDevice and RandomDevice) (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 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 | « libraries/nacl-mounts/nacl-nacl-mounts.sh ('k') | libraries/nacl-mounts/test.nacl/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libraries/nacl-mounts/test.nacl/DevTest.cc
===================================================================
--- libraries/nacl-mounts/test.nacl/DevTest.cc (revision 0)
+++ libraries/nacl-mounts/test.nacl/DevTest.cc (revision 0)
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "../base/KernelProxy.h"
+#include "gtest/gtest.h"
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+TEST(DevTest, Simple) {
+ struct stat buf;
+ EXPECT_EQ(0, stat("/dev/random", &buf));
+ int h = open("/dev/random", O_RDONLY);
+ EXPECT_GT(h, 0);
+ char buff[5];
+ EXPECT_EQ(5, read(h, reinterpret_cast<void*>(buff), 5));
+ int q = open("/dev/null", O_WRONLY);
+ EXPECT_EQ(5, write(q, reinterpret_cast<void*>(buff), 5));
+ EXPECT_EQ(0, read(q, reinterpret_cast<void*>(buff), 5));
+}
« no previous file with comments | « libraries/nacl-mounts/nacl-nacl-mounts.sh ('k') | libraries/nacl-mounts/test.nacl/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698