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

Side by Side Diff: native_client_sdk/src/libraries/nacl_mounts_test/kernel_intercept_test.cc

Issue 10825189: [NaCl SDK] Get nacl_mounts_tests building. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows fixes Created 8 years, 4 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 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 5
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <pthread.h> 7 #include <pthread.h>
8 #include <unistd.h>
9 8
10 #include <map> 9 #include <map>
11 #include <string> 10 #include <string>
12 11
13 #include "nacl_mounts/kernel_intercept.h" 12 #include "nacl_mounts/kernel_intercept.h"
14 #include "nacl_mounts/kernel_proxy.h" 13 #include "nacl_mounts/kernel_proxy.h"
15 #include "nacl_mounts/path.h" 14 #include "nacl_mounts/path.h"
16 15
17 #define __STDC__ 1
18 #include "gtest/gtest.h" 16 #include "gtest/gtest.h"
19 17
20 class KernelProxyMock : public KernelProxy { 18 class KernelProxyMock : public KernelProxy {
21 public: 19 public:
22 KernelProxyMock() {} 20 KernelProxyMock() {}
23 virtual ~KernelProxyMock() {} 21 virtual ~KernelProxyMock() {}
24 22
25 int chdir(const char* path) { 23 int chdir(const char* path) {
26 events.push_back("chdir"); 24 events.push_back("chdir");
27 return 0; 25 return 0;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }; 118 };
121 119
122 120
123 TEST(KernelIntercept, SanityChecks) { 121 TEST(KernelIntercept, SanityChecks) {
124 static KernelProxyMock* mock = new KernelProxyMock(); 122 static KernelProxyMock* mock = new KernelProxyMock();
125 ki_init(mock); 123 ki_init(mock);
126 124
127 ki_chdir("foo"); 125 ki_chdir("foo");
128 EXPECT_EQ("chdir", mock->LastStr()); 126 EXPECT_EQ("chdir", mock->LastStr());
129 127
130 ki_getcwd("foo", 1); 128 char getcwd_buffer[] = "foo";
129 ki_getcwd(getcwd_buffer, 1);
131 EXPECT_EQ("getcwd", mock->LastStr()); 130 EXPECT_EQ("getcwd", mock->LastStr());
132 131
133 ki_getwd("foo"); 132 char getwd_buffer[] = "foo";
133 ki_getwd(getwd_buffer);
134 EXPECT_EQ("getwd", mock->LastStr()); 134 EXPECT_EQ("getwd", mock->LastStr());
135 135
136 ki_dup(1); 136 ki_dup(1);
137 EXPECT_EQ("dup", mock->LastStr()); 137 EXPECT_EQ("dup", mock->LastStr());
138 138
139 ki_chmod("foo", NULL); 139 ki_chmod("foo", NULL);
140 EXPECT_EQ("chmod", mock->LastStr()); 140 EXPECT_EQ("chmod", mock->LastStr());
141 141
142 ki_stat("foo", NULL); 142 ki_stat("foo", NULL);
143 EXPECT_EQ("stat", mock->LastStr()); 143 EXPECT_EQ("stat", mock->LastStr());
(...skipping 28 matching lines...) Expand all
172 ki_fsync(1); 172 ki_fsync(1);
173 EXPECT_EQ("fsync", mock->LastStr()); 173 EXPECT_EQ("fsync", mock->LastStr());
174 174
175 ki_isatty(1); 175 ki_isatty(1);
176 EXPECT_EQ("isatty", mock->LastStr()); 176 EXPECT_EQ("isatty", mock->LastStr());
177 177
178 ki_close(1); 178 ki_close(1);
179 EXPECT_EQ("close", mock->LastStr()); 179 EXPECT_EQ("close", mock->LastStr());
180 } 180 }
181 181
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698