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

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

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/sandbox_mac_unittest_helper.h ('k') | chrome/renderer/renderer_main_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:eol-style
- LF
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 #include "chrome/common/sandbox_mac_unittest_helper.h" 5 #include "chrome/common/sandbox_mac_unittest_helper.h"
6 6
7 extern "C" { 7 extern "C" {
8 #include <sandbox.h> 8 #include <sandbox.h>
9 } 9 }
10 10
11 #include <map>
12
13 #include "base/logging.h"
14 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
15 #include "chrome/common/sandbox_mac.h" 12 #include "chrome/common/sandbox_mac.h"
16 #include "testing/multiprocess_func_list.h"
17 13
18 namespace { 14 namespace {
19 15
20 const char* kSandboxTypeKey = "CHROMIUM_SANDBOX_SANDBOX_TYPE"; 16 const char* kSandboxTypeKey = "CHROMIUM_SANDBOX_SANDBOX_TYPE";
21 const char* kSandboxTestNameKey = "CHROMIUM_SANDBOX_TEST_NAME"; 17 const char* kSandboxTestNameKey = "CHROMIUM_SANDBOX_TEST_NAME";
22 const char* kTestDataKey = "CHROMIUM_SANDBOX_USER_DATA"; 18 const char* kTestDataKey = "CHROMIUM_SANDBOX_USER_DATA";
23 19
24 } // namespace 20 } // namespace
25 21
26 namespace sandboxtest { 22 namespace sandboxtest {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool MacSandboxTest::RunTestInSandbox(sandbox::SandboxProcessType sandbox_type, 64 bool MacSandboxTest::RunTestInSandbox(sandbox::SandboxProcessType sandbox_type,
69 const char* test_name, 65 const char* test_name,
70 const char* test_data) { 66 const char* test_data) {
71 std::stringstream s; 67 std::stringstream s;
72 s << static_cast<int>(static_cast<int>(sandbox_type)); 68 s << static_cast<int>(static_cast<int>(sandbox_type));
73 setenv(kSandboxTypeKey, s.str().c_str(), 1); 69 setenv(kSandboxTypeKey, s.str().c_str(), 1);
74 setenv(kSandboxTestNameKey, test_name, 1); 70 setenv(kSandboxTestNameKey, test_name, 1);
75 if (test_data) 71 if (test_data)
76 setenv(kTestDataKey, test_data, 1); 72 setenv(kTestDataKey, test_data, 1);
77 73
78 base::ProcessHandle child_process = SpawnChild("mac_sandbox_test_runner", 74 base::ProcessHandle child_process = SpawnChild("mac_sandbox_test_runner");
79 false);
80 int code = -1; 75 int code = -1;
81 if (!base::WaitForExitCode(child_process, &code)) { 76 if (!base::WaitForExitCode(child_process, &code)) {
82 LOG(WARNING) << "base::WaitForExitCode failed"; 77 LOG(WARNING) << "base::WaitForExitCode failed";
83 return false; 78 return false;
84 } 79 }
85 return code == 0; 80 return code == 0;
86 } 81 }
87 82
88 // Given a test name specified by |name| return that test case. 83 // Given a test name specified by |name| return that test case.
89 // If no test case is found for the given name, return NULL. 84 // If no test case is found for the given name, return NULL.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 144
150 if (!test_case->SandboxedTest()) { 145 if (!test_case->SandboxedTest()) {
151 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; 146 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test";
152 return -1; 147 return -1;
153 } 148 }
154 149
155 return 0; 150 return 0;
156 } 151 }
157 152
158 } // namespace 153 } // namespace
OLDNEW
« no previous file with comments | « chrome/common/sandbox_mac_unittest_helper.h ('k') | chrome/renderer/renderer_main_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698