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

Side by Side Diff: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/seccomp-bpf/syscall.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sandbox/linux/seccomp-bpf/sandbox_bpf.h" 5 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <iostream> 10 #include <iostream>
11 11
12 #include "base/files/scoped_file.h" 12 #include "base/files/scoped_file.h"
13 #include "base/posix/eintr_wrapper.h" 13 #include "base/posix/eintr_wrapper.h"
14 #include "sandbox/linux/tests/unit_tests.h" 14 #include "sandbox/linux/tests/unit_tests.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace sandbox { 17 namespace sandbox {
18 namespace { 18 namespace {
19 19
20 // NOTE: most tests for the SandboxBPF class are currently in 20 // NOTE: most tests for the SandboxBPF class are currently in
21 // bpf_dsl_more_unittest.cc. 21 // integration_tests/.
22 22
23 TEST(SandboxBPF, CreateDestroy) { 23 TEST(SandboxBPF, CreateDestroy) {
24 // Give an opportunity to dynamic tools to perform some simple testing. 24 // Give an opportunity to dynamic tools to perform some simple testing.
25 SandboxBPF sandbox(nullptr); 25 SandboxBPF sandbox(nullptr);
26 SandboxBPF* sandbox_ptr = new SandboxBPF(nullptr); 26 SandboxBPF* sandbox_ptr = new SandboxBPF(nullptr);
27 delete sandbox_ptr; 27 delete sandbox_ptr;
28 } 28 }
29 29
30 // This test should execute no matter whether we have kernel support. So, 30 // This test should execute no matter whether we have kernel support. So,
31 // we make it a TEST() instead of a BPF_TEST(). 31 // we make it a TEST() instead of a BPF_TEST().
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 ASSERT_EQ(0, fcntl(read_end.get(), F_SETFL, O_NONBLOCK)); 77 ASSERT_EQ(0, fcntl(read_end.get(), F_SETFL, O_NONBLOCK));
78 char c; 78 char c;
79 // Check that the sandbox closed the write_end (read will EOF instead of 79 // Check that the sandbox closed the write_end (read will EOF instead of
80 // returning EWOULDBLOCK). 80 // returning EWOULDBLOCK).
81 ASSERT_EQ(0, read(read_end.get(), &c, 1)); 81 ASSERT_EQ(0, read(read_end.get(), &c, 1));
82 } 82 }
83 83
84 } // namespace 84 } // namespace
85 } // sandbox 85 } // sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/seccomp-bpf/syscall.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698