| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "gtest/gtest.h" | 8 #include "gtest/gtest.h" |
| 9 #include "kernel_proxy_mock.h" | 9 #include "kernel_proxy_mock.h" |
| 10 #include "nacl_io/kernel_intercept.h" | 10 #include "nacl_io/kernel_intercept.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 char buffer[] = "ioctl"; | 206 char buffer[] = "ioctl"; |
| 207 EXPECT_CALL(mock, ioctl(012, 345, StrEq("ioctl"))).Times(1); | 207 EXPECT_CALL(mock, ioctl(012, 345, StrEq("ioctl"))).Times(1); |
| 208 ioctl(012, 345, buffer); | 208 ioctl(012, 345, buffer); |
| 209 } | 209 } |
| 210 | 210 |
| 211 TEST_F(KernelWrapTest, isatty) { | 211 TEST_F(KernelWrapTest, isatty) { |
| 212 EXPECT_CALL(mock, isatty(678)).Times(1); | 212 EXPECT_CALL(mock, isatty(678)).Times(1); |
| 213 isatty(678); | 213 isatty(678); |
| 214 } | 214 } |
| 215 | 215 |
| 216 /* |
| 217 TEST_F(KernelWrapTest, kill) { |
| 218 EXPECT_CALL(mock, kill(22, 33)).Times(1); |
| 219 kill(22, 33); |
| 220 } |
| 221 */ |
| 222 |
| 216 TEST_F(KernelWrapTest, lchown) { | 223 TEST_F(KernelWrapTest, lchown) { |
| 217 uid_t uid = kDummyUid; | 224 uid_t uid = kDummyUid; |
| 218 gid_t gid = kDummyGid; | 225 gid_t gid = kDummyGid; |
| 219 EXPECT_CALL(mock, lchown(StrEq("lchown"), uid, gid)).Times(1); | 226 EXPECT_CALL(mock, lchown(StrEq("lchown"), uid, gid)).Times(1); |
| 220 lchown("lchown", uid, gid); | 227 lchown("lchown", uid, gid); |
| 221 } | 228 } |
| 222 | 229 |
| 223 TEST_F(KernelWrapTest, lseek) { | 230 TEST_F(KernelWrapTest, lseek) { |
| 224 EXPECT_CALL(mock, lseek(789, 891, 912)).Times(1); | 231 EXPECT_CALL(mock, lseek(789, 891, 912)).Times(1); |
| 225 lseek(789, 891, 912); | 232 lseek(789, 891, 912); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 255 TEST_F(KernelWrapTest, remove) { | 262 TEST_F(KernelWrapTest, remove) { |
| 256 EXPECT_CALL(mock, remove(StrEq("remove"))).Times(1); | 263 EXPECT_CALL(mock, remove(StrEq("remove"))).Times(1); |
| 257 remove("remove"); | 264 remove("remove"); |
| 258 } | 265 } |
| 259 | 266 |
| 260 TEST_F(KernelWrapTest, rmdir) { | 267 TEST_F(KernelWrapTest, rmdir) { |
| 261 EXPECT_CALL(mock, rmdir(StrEq("rmdir"))).Times(1); | 268 EXPECT_CALL(mock, rmdir(StrEq("rmdir"))).Times(1); |
| 262 rmdir("rmdir"); | 269 rmdir("rmdir"); |
| 263 } | 270 } |
| 264 | 271 |
| 272 static void handler(int) { |
| 273 } |
| 274 |
| 275 TEST_F(KernelWrapTest, signal) { |
| 276 EXPECT_CALL(mock, signal(22, handler)).Times(1); |
| 277 signal(22, handler); |
| 278 } |
| 279 |
| 265 TEST_F(KernelWrapTest, stat) { | 280 TEST_F(KernelWrapTest, stat) { |
| 266 struct stat in_statbuf; | 281 struct stat in_statbuf; |
| 267 MakeDummyStatbuf(&in_statbuf); | 282 MakeDummyStatbuf(&in_statbuf); |
| 268 EXPECT_CALL(mock, stat(StrEq("stat"), _)) | 283 EXPECT_CALL(mock, stat(StrEq("stat"), _)) |
| 269 .Times(1) | 284 .Times(1) |
| 270 .WillOnce(SetStat(&in_statbuf)); | 285 .WillOnce(SetStat(&in_statbuf)); |
| 271 struct stat out_statbuf; | 286 struct stat out_statbuf; |
| 272 stat("stat", &out_statbuf); | 287 stat("stat", &out_statbuf); |
| 273 EXPECT_THAT(&in_statbuf, IsEqualToStatbuf(&out_statbuf)); | 288 EXPECT_THAT(&in_statbuf, IsEqualToStatbuf(&out_statbuf)); |
| 274 } | 289 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 EXPECT_CALL(mock, socket(DUMMY_FD, 456, 789)).Times(1); | 417 EXPECT_CALL(mock, socket(DUMMY_FD, 456, 789)).Times(1); |
| 403 socket(DUMMY_FD, 456, 789); | 418 socket(DUMMY_FD, 456, 789); |
| 404 } | 419 } |
| 405 | 420 |
| 406 TEST_F(KernelWrapTest, socketpair) { | 421 TEST_F(KernelWrapTest, socketpair) { |
| 407 EXPECT_CALL(mock, socketpair(DUMMY_FD, 456, 789, NULL)).Times(1); | 422 EXPECT_CALL(mock, socketpair(DUMMY_FD, 456, 789, NULL)).Times(1); |
| 408 socketpair(DUMMY_FD, 456, 789, NULL); | 423 socketpair(DUMMY_FD, 456, 789, NULL); |
| 409 } | 424 } |
| 410 | 425 |
| 411 #endif // PROVIDES_SOCKET_API | 426 #endif // PROVIDES_SOCKET_API |
| OLD | NEW |