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

Side by Side Diff: chrome/common/sandbox_mac_unittest_helper.h

Issue 3035062: Revert 55400 - Cleanup in base. This moves the implementation (and a bunch of... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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
« no previous file with comments | « chrome/common/process_watcher_unittest.cc ('k') | chrome/common/sandbox_mac_unittest_helper.mm » ('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 (c) 2010 The Chromium Authors. All rights reserved. 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 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 CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ 5 #ifndef CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_
6 #define CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ 6 #define CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/test/multiprocess_test.h" 9 #include "base/multiprocess_test.h"
10 #include "chrome/common/sandbox_mac.h" 10 #include "chrome/common/sandbox_mac.h"
11 11
12 namespace sandboxtest { 12 namespace sandboxtest {
13 13
14 // Helpers for writing unit tests that runs in the context of the Mac sandbox. 14 // Helpers for writing unit tests that runs in the context of the Mac sandbox.
15 // 15 //
16 // How to write a sandboxed test: 16 // How to write a sandboxed test:
17 // 1. Create a class that inherits from MacSandboxTestCase and overrides 17 // 1. Create a class that inherits from MacSandboxTestCase and overrides
18 // its functions to run code before or after the sandbox is initialised in a 18 // its functions to run code before or after the sandbox is initialised in a
19 // subprocess. 19 // subprocess.
(...skipping 16 matching lines...) Expand all
36 // REGISTER_SANDBOX_TEST_CASE(TestCaseThatRunsInSandboxedSubprocess); 36 // REGISTER_SANDBOX_TEST_CASE(TestCaseThatRunsInSandboxedSubprocess);
37 // 37 //
38 // TEST_F(MacSandboxTest, ATest) { 38 // TEST_F(MacSandboxTest, ATest) {
39 // EXPECT_TRUE(RunTestInAllSandboxTypes( 39 // EXPECT_TRUE(RunTestInAllSandboxTypes(
40 // "TestCaseThatRunsInSandboxedSubprocess", 40 // "TestCaseThatRunsInSandboxedSubprocess",
41 // NULL)); 41 // NULL));
42 // } 42 // }
43 43
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 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. 50 // to the child process runing in the sandbox.
51 // Returns true if the test passes, false if either of the functions in 51 // Returns true if the test passes, false if either of the functions in
52 // the corresponding MacSandboxTestCase return false. 52 // the corresponding MacSandboxTestCase return false.
53 bool RunTestInSandbox(sandbox::SandboxProcessType sandbox_type, 53 bool RunTestInSandbox(sandbox::SandboxProcessType sandbox_type,
54 const char* test_name, 54 const char* test_name,
55 const char* test_data); 55 const char* test_data);
56 56
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 namespace { \ 108 namespace { \
109 sandboxtest::internal::RegisterSandboxTest<class_name> \ 109 sandboxtest::internal::RegisterSandboxTest<class_name> \
110 register_test##class_name(#class_name); \ 110 register_test##class_name(#class_name); \
111 } // namespace 111 } // namespace
112 112
113 } // namespace internal 113 } // namespace internal
114 114
115 } // namespace sandboxtest 115 } // namespace sandboxtest
116 116
117 #endif // CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ 117 #endif // CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/common/process_watcher_unittest.cc ('k') | chrome/common/sandbox_mac_unittest_helper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698