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

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

Issue 7304008: Ensure tests check the return of SpawnChild() when they may wait without timeouts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac compile fixes Created 9 years, 5 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 | « content/common/sandbox_mac_diraccess_unittest.mm ('k') | no next file » | 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 #include "content/common/sandbox_mac_unittest_helper.h" 5 #include "content/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
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const char* test_data) { 74 const char* test_data) {
75 std::stringstream s; 75 std::stringstream s;
76 s << static_cast<int>(static_cast<int>(sandbox_type)); 76 s << static_cast<int>(static_cast<int>(sandbox_type));
77 setenv(kSandboxTypeKey, s.str().c_str(), 1); 77 setenv(kSandboxTypeKey, s.str().c_str(), 1);
78 setenv(kSandboxTestNameKey, test_name, 1); 78 setenv(kSandboxTestNameKey, test_name, 1);
79 if (test_data) 79 if (test_data)
80 setenv(kTestDataKey, test_data, 1); 80 setenv(kTestDataKey, test_data, 1);
81 81
82 base::ProcessHandle child_process = SpawnChild("mac_sandbox_test_runner", 82 base::ProcessHandle child_process = SpawnChild("mac_sandbox_test_runner",
83 false); 83 false);
84 if (child_process == base::kNullProcessHandle) {
85 LOG(WARNING) << "SpawnChild failed";
86 return false;
87 }
84 int code = -1; 88 int code = -1;
85 if (!base::WaitForExitCode(child_process, &code)) { 89 if (!base::WaitForExitCode(child_process, &code)) {
86 LOG(WARNING) << "base::WaitForExitCode failed"; 90 LOG(WARNING) << "base::WaitForExitCode failed";
87 return false; 91 return false;
88 } 92 }
89 return code == 0; 93 return code == 0;
90 } 94 }
91 95
92 bool MacSandboxTestCase::BeforeSandboxInit() { 96 bool MacSandboxTestCase::BeforeSandboxInit() {
93 return true; 97 return true;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 165
162 if (!test_case->SandboxedTest()) { 166 if (!test_case->SandboxedTest()) {
163 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; 167 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test";
164 return -1; 168 return -1;
165 } 169 }
166 170
167 return 0; 171 return 0;
168 } 172 }
169 173
170 } // namespace 174 } // namespace
OLDNEW
« no previous file with comments | « content/common/sandbox_mac_diraccess_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698