| 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 // The linux host build of nacl_io can't do wrapping of syscalls so all | 5 // The linux host build of nacl_io can't do wrapping of syscalls so all |
| 6 // these tests must be disabled. | 6 // these tests must be disabled. |
| 7 #if !defined(__linux__) | 7 #if !defined(__linux__) |
| 8 | 8 |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 virtual void SetUp() { | 119 virtual void SetUp() { |
| 120 // Initialize the global errno value to a consistent value rather than | 120 // Initialize the global errno value to a consistent value rather than |
| 121 // relying on its value from previous test runs. | 121 // relying on its value from previous test runs. |
| 122 errno = 0; | 122 errno = 0; |
| 123 | 123 |
| 124 // Initializing the KernelProxy opens stdin/stdout/stderr. | 124 // Initializing the KernelProxy opens stdin/stdout/stderr. |
| 125 EXPECT_CALL(mock, open(_, _)) | 125 EXPECT_CALL(mock, open(_, _)) |
| 126 .WillOnce(Return(0)) | 126 .WillOnce(Return(0)) |
| 127 .WillOnce(Return(1)) | 127 .WillOnce(Return(1)) |
| 128 .WillOnce(Return(2)); | 128 .WillOnce(Return(2)); |
| 129 // And will call mount / and /dev. | |
| 130 EXPECT_CALL(mock, mount(_, _, _, _, _)) | |
| 131 .WillOnce(Return(0)) | |
| 132 .WillOnce(Return(0)); | |
| 133 | 129 |
| 134 ASSERT_EQ(0, ki_push_state_for_testing()); | 130 ASSERT_EQ(0, ki_push_state_for_testing()); |
| 135 ASSERT_EQ(0, ki_init(&mock)); | 131 ASSERT_EQ(0, ki_init(&mock)); |
| 136 | 132 |
| 137 // We allow write to be called any number of times, and it forwards to | 133 // We allow write to be called any number of times, and it forwards to |
| 138 // _real_write. This prevents an infinite loop writing output if there is a | 134 // _real_write. This prevents an infinite loop writing output if there is a |
| 139 // failure. | 135 // failure. |
| 140 ON_CALL(mock, write(_, _, _)) | 136 ON_CALL(mock, write(_, _, _)) |
| 141 .WillByDefault(Invoke(this, &KernelWrapTest::DefaultWrite)); | 137 .WillByDefault(Invoke(this, &KernelWrapTest::DefaultWrite)); |
| 142 EXPECT_CALL(mock, write(_, _, _)).Times(AnyNumber()); | 138 EXPECT_CALL(mock, write(_, _, _)).Times(AnyNumber()); |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 .WillOnce(Return(0)) | 843 .WillOnce(Return(0)) |
| 848 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); | 844 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); |
| 849 EXPECT_EQ(0, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); | 845 EXPECT_EQ(0, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); |
| 850 EXPECT_EQ(-1, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); | 846 EXPECT_EQ(-1, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); |
| 851 EXPECT_EQ(kDummyErrno, errno); | 847 EXPECT_EQ(kDummyErrno, errno); |
| 852 } | 848 } |
| 853 | 849 |
| 854 #endif // PROVIDES_SOCKET_API | 850 #endif // PROVIDES_SOCKET_API |
| 855 | 851 |
| 856 #endif // __linux__ | 852 #endif // __linux__ |
| OLD | NEW |