OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ | 5 #ifndef CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ |
6 #define CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ | 6 #define CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/test/multiprocess_test.h" | 9 #include "base/test/multiprocess_test.h" |
10 #include "content/common/sandbox_mac.h" | 10 #include "content/common/sandbox_mac.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 // Base test type with helper functions to spawn a subprocess that exercises | 44 // Base test type with helper functions to spawn a subprocess that exercises |
45 // a given test in the sandbox. | 45 // a given test in the sandbox. |
46 class MacSandboxTest : public base::MultiProcessTest { | 46 class MacSandboxTest : public base::MultiProcessTest { |
47 public: | 47 public: |
48 // Runs a test specified by |test_name| in a sandbox of the type specified | 48 // Runs a test specified by |test_name| in a sandbox of the type specified |
49 // by |sandbox_type|. |test_data| is a custom string that a test can pass | 49 // by |sandbox_type|. |test_data| is a custom string that a test can pass |
50 // to the child process runing in the sandbox, or NULL if additional data is | 50 // to the child process runing in the sandbox, or NULL if additional data is |
51 // required. | 51 // required. |
52 // Returns true if the test passes, false if either of the functions in | 52 // Returns true if the test passes, false if either of the functions in |
53 // the corresponding MacSandboxTestCase return false. | 53 // the corresponding MacSandboxTestCase return false. |
54 bool RunTestInSandbox(sandbox::Sandbox::SandboxProcessType sandbox_type, | 54 bool RunTestInSandbox(content::SandboxProcessType sandbox_type, |
55 const char* test_name, | 55 const char* test_name, |
56 const char* test_data); | 56 const char* test_data); |
57 | 57 |
58 // Runs the test specified by |test_name| in all the different sandbox types, | 58 // Runs the test specified by |test_name| in all the different sandbox types |
59 // one by one. | 59 // known to content, one by one. |
60 // If the embedder defines additional sandbox types, they won't be covered by | |
61 // these tests. | |
jeremy
2011/11/24 12:20:19
nit: I'd make this more prominent, something like:
jochen (gone - plz use gerrit)
2011/11/24 16:23:22
Done.
| |
60 // Returns true if the test passes, false if either of the functions in | 62 // Returns true if the test passes, false if either of the functions in |
61 // the corresponding MacSandboxTestCase return false in any of the spawned | 63 // the corresponding MacSandboxTestCase return false in any of the spawned |
62 // processes. | 64 // processes. |
63 bool RunTestInAllSandboxTypes(const char* test_name, | 65 bool RunTestInAllSandboxTypes(const char* test_name, |
64 const char* test_data); | 66 const char* test_data); |
65 }; | 67 }; |
66 | 68 |
67 // Class to ease writing test cases that run inside the OS X sandbox. | 69 // Class to ease writing test cases that run inside the OS X sandbox. |
68 // This class is instantiated in a subprocess, and allows you to run test code | 70 // This class is instantiated in a subprocess, and allows you to run test code |
69 // at various stages of execution. | 71 // at various stages of execution. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 namespace { \ | 111 namespace { \ |
110 sandboxtest::internal::RegisterSandboxTest<class_name> \ | 112 sandboxtest::internal::RegisterSandboxTest<class_name> \ |
111 register_test##class_name(#class_name); \ | 113 register_test##class_name(#class_name); \ |
112 } // namespace | 114 } // namespace |
113 | 115 |
114 } // namespace internal | 116 } // namespace internal |
115 | 117 |
116 } // namespace sandboxtest | 118 } // namespace sandboxtest |
117 | 119 |
118 #endif // CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ | 120 #endif // CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ |
OLD | NEW |