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

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

Issue 8608005: Check for NULL pointer before assigning the test data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 9 years 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 | « no previous file | content/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) 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 29 matching lines...) Expand all
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 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. 50 // to the child process runing in the sandbox, or NULL if additional data is
51 // required.
51 // 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
52 // the corresponding MacSandboxTestCase return false. 53 // the corresponding MacSandboxTestCase return false.
53 bool RunTestInSandbox(sandbox::Sandbox::SandboxProcessType sandbox_type, 54 bool RunTestInSandbox(sandbox::Sandbox::SandboxProcessType sandbox_type,
54 const char* test_name, 55 const char* test_name,
55 const char* test_data); 56 const char* test_data);
56 57
57 // 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,
58 // one by one. 59 // one by one.
59 // Returns true if the test passes, false if either of the functions in 60 // Returns true if the test passes, false if either of the functions in
60 // the corresponding MacSandboxTestCase return false in any of the spawned 61 // the corresponding MacSandboxTestCase return false in any of the spawned
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 namespace { \ 109 namespace { \
109 sandboxtest::internal::RegisterSandboxTest<class_name> \ 110 sandboxtest::internal::RegisterSandboxTest<class_name> \
110 register_test##class_name(#class_name); \ 111 register_test##class_name(#class_name); \
111 } // namespace 112 } // namespace
112 113
113 } // namespace internal 114 } // namespace internal
114 115
115 } // namespace sandboxtest 116 } // namespace sandboxtest
116 117
117 #endif // CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ 118 #endif // CONTENT_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/sandbox_mac_unittest_helper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698