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

Side by Side Diff: libraries/nacl-mounts/test.nacl/DevTest.cc

Issue 10392070: Socket subsystem implementation (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 #include "../base/KernelProxy.h" 6 #include "base/KernelProxy.h"
7 #include "gtest/gtest.h" 7 #include "gtest/gtest.h"
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
11 #include <unistd.h> 11 #include <unistd.h>
12 12
13 TEST(DevTest, Simple) { 13 TEST(DevTest, Simple) {
14 struct stat buf; 14 struct stat buf;
15 EXPECT_EQ(0, stat("/dev/random", &buf)); 15 EXPECT_EQ(0, stat("/dev/random", &buf));
16 int h = open("/dev/random", O_RDONLY); 16 int h = open("/dev/random", O_RDONLY);
17 EXPECT_GT(h, 0); 17 EXPECT_GT(h, 0);
18 char buff[5]; 18 char buff[5];
19 EXPECT_EQ(5, read(h, reinterpret_cast<void*>(buff), 5)); 19 EXPECT_EQ(5, read(h, reinterpret_cast<void*>(buff), 5));
20 int q = open("/dev/null", O_RDWR); 20 int q = open("/dev/null", O_RDWR);
21 EXPECT_EQ(5, write(q, reinterpret_cast<void*>(buff), 5)); 21 EXPECT_EQ(5, write(q, reinterpret_cast<void*>(buff), 5));
22 EXPECT_EQ(0, read(q, reinterpret_cast<void*>(buff), 5)); 22 EXPECT_EQ(0, read(q, reinterpret_cast<void*>(buff), 5));
23 } 23 }
OLDNEW
« no previous file with comments | « libraries/nacl-mounts/ppapi/cpp/private/tcp_socket_private.h ('k') | libraries/nacl-mounts/test.nacl/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698