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

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

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Synced 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_child = SpawnChild("mac_sandbox_test_runner");
81 if (!child_process.IsValid()) { 81 if (!spawn_child.process.IsValid()) {
82 LOG(WARNING) << "SpawnChild failed"; 82 LOG(WARNING) << "SpawnChild failed";
83 return false; 83 return false;
84 } 84 }
85 int code = -1; 85 int code = -1;
86 if (!child_process.WaitForExit(&code)) { 86 if (!spawn_child.process.WaitForExit(&code)) {
87 LOG(WARNING) << "Process::WaitForExit failed"; 87 LOG(WARNING) << "Process::WaitForExit failed";
88 return false; 88 return false;
89 } 89 }
90 return code == 0; 90 return code == 0;
91 } 91 }
92 92
93 bool MacSandboxTestCase::BeforeSandboxInit() { 93 bool MacSandboxTestCase::BeforeSandboxInit() {
94 return true; 94 return true;
95 } 95 }
96 96
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 if (!test_case->SandboxedTest()) { 161 if (!test_case->SandboxedTest()) {
162 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; 162 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test";
163 return -1; 163 return -1;
164 } 164 }
165 165
166 return 0; 166 return 0;
167 } 167 }
168 168
169 } // namespace content 169 } // namespace content
OLDNEW
« no previous file with comments | « content/common/sandbox_mac_diraccess_unittest.mm ('k') | mojo/edk/test/multiprocess_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698