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

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

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Fixed bots. Created 3 years, 9 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
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool MacSandboxTest::RunTestInSandbox(SandboxType sandbox_type, 70 bool MacSandboxTest::RunTestInSandbox(SandboxType sandbox_type,
71 const char* test_name, 71 const char* test_name,
72 const char* test_data) { 72 const char* test_data) {
73 std::stringstream s; 73 std::stringstream s;
74 s << static_cast<int>(static_cast<int>(sandbox_type)); 74 s << static_cast<int>(static_cast<int>(sandbox_type));
75 setenv(kSandboxTypeKey, s.str().c_str(), 1); 75 setenv(kSandboxTypeKey, s.str().c_str(), 1);
76 setenv(kSandboxTestNameKey, test_name, 1); 76 setenv(kSandboxTestNameKey, test_name, 1);
77 if (test_data) 77 if (test_data)
78 setenv(kTestDataKey, test_data, 1); 78 setenv(kTestDataKey, test_data, 1);
79 79
80 base::Process child_process = SpawnChild("mac_sandbox_test_runner"); 80 base::SpawnChildResult spawn_result = SpawnChild("mac_sandbox_test_runner");
81 base::Process child_process = std::move(spawn_result.process);
81 if (!child_process.IsValid()) { 82 if (!child_process.IsValid()) {
82 LOG(WARNING) << "SpawnChild failed"; 83 LOG(WARNING) << "SpawnChild failed";
83 return false; 84 return false;
84 } 85 }
85 int code = -1; 86 int code = -1;
86 if (!child_process.WaitForExit(&code)) { 87 if (!child_process.WaitForExit(&code)) {
87 LOG(WARNING) << "Process::WaitForExit failed"; 88 LOG(WARNING) << "Process::WaitForExit failed";
88 return false; 89 return false;
89 } 90 }
90 return code == 0; 91 return code == 0;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 161
161 if (!test_case->SandboxedTest()) { 162 if (!test_case->SandboxedTest()) {
162 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; 163 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test";
163 return -1; 164 return -1;
164 } 165 }
165 166
166 return 0; 167 return 0;
167 } 168 }
168 169
169 } // namespace content 170 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698