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

Side by Side Diff: chrome/test/nacl_security_tests/nacl_security_tests_mac.cc

Issue 7831053: Move NaCl tests out of chrome/test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 #include "chrome/test/nacl_security_tests/nacl_security_tests_posix.h"
7 #include <string>
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "chrome/test/nacl_security_tests/commands_posix.h"
10
11 __attribute__((constructor))
12 static void initializer(void) {
13 }
14
15 __attribute__((destructor))
16 static void finalizer(void) {
17 }
18
19 namespace {
20 void CheckDenied(sandbox::SboxTestResult x) {
21 EXPECT_EQ(sandbox::SBOX_TEST_DENIED, x);
22 }
23 } // anon namespace
24
25 extern "C"
26 __attribute__((visibility("default")))
27 bool RunNaClLoaderTests(void) {
28 CheckDenied(sandbox::TestOpenReadFile("/etc"));
29 CheckDenied(sandbox::TestOpenReadFile("/tmp"));
30 CheckDenied(sandbox::TestOpenReadFile("$HOME"));
31 CheckDenied(sandbox::TestOpenWriteFile("/etc"));
32 CheckDenied(sandbox::TestOpenWriteFile("/etc/passwd"));
33 CheckDenied(sandbox::TestOpenWriteFile("/bin"));
34 CheckDenied(sandbox::TestOpenWriteFile("/usr/bin"));
35 CheckDenied(sandbox::TestOpenWriteFile("/usr/bin/bash"));
36 CheckDenied(sandbox::TestOpenWriteFile("/usr/bin/login"));
37 CheckDenied(sandbox::TestOpenWriteFile("/usr/sbin"));
38 CheckDenied(sandbox::TestOpenWriteFile("$HOME"));
39
40 CheckDenied(sandbox::TestCreateProcess("/usr/bin/env"));
41 CheckDenied(sandbox::TestConnect("www.archive.org"));
42
43 return !(testing::Test::HasFatalFailure() ||
44 testing::Test::HasNonfatalFailure());
45 }
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698