summaryrefslogtreecommitdiffstats
path: root/chrome/test/nacl_security_tests/commands_posix.h
blob: fdcef30dd59e6f74fb82eb0a1e144b20fa817a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_TEST_NACL_SECURITY_TESTS_COMMANDS_POSIX_H_
#define CHROME_TEST_NACL_SECURITY_TESTS_COMMANDS_POSIX_H_
#pragma once

// TODO(jvoung): factor out the SboxTestResult from
// sandbox/tests/common/controller.h
// to make it OS independent.

namespace sandbox {

#define SEVERITY_INFO_FLAGS   0x40000000
#define SEVERITY_ERROR_FLAGS  0xC0000000
#define CUSTOMER_CODE         0x20000000
#define SBOX_TESTS_FACILITY   0x05B10000

enum SboxTestResult {
  SBOX_TEST_FIRST_RESULT = 8998,
  SBOX_TEST_SUCCEEDED,
  SBOX_TEST_PING_OK,
  SBOX_TEST_FIRST_INFO = SBOX_TEST_FIRST_RESULT | SEVERITY_INFO_FLAGS,
  SBOX_TEST_DENIED,     // Access was denied.
  SBOX_TEST_NOT_FOUND,  // The resource was not found.
  SBOX_TEST_FIRST_ERROR = SBOX_TEST_FIRST_RESULT | SEVERITY_ERROR_FLAGS,
  SBOX_TEST_INVALID_PARAMETER,
  SBOX_TEST_FAILED_TO_RUN_TEST,
  SBOX_TEST_FAILED_TO_EXECUTE_COMMAND,
  SBOX_TEST_TIMED_OUT,
  SBOX_TEST_FAILED,
  SBOX_TEST_LAST_RESULT
};

// Sandbox access tests for Mac and Linux
// (mimic'ing "sandbox/tests/validation_tests/commands.h")

SboxTestResult TestOpenReadFile(const char* path);

SboxTestResult TestOpenWriteFile(const char* path);

SboxTestResult TestCreateProcess(const char* path);

SboxTestResult TestConnect(const char* url);

// Dummy test that returns SBOX_TEST_SUCCEEDED
// (so it fails, because everything should be denied).
SboxTestResult TestDummyFails();

}  // namespace sandbox

#endif  // CHROME_TEST_NACL_SECURITY_TESTS_COMMANDS_POSIX_H_