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

Side by Side Diff: base/process/process_util_unittest.cc

Issue 2941283002: fuchsia: Use new, qualified error names, disable old names. (Closed)
Patch Set: don have Created 3 years, 6 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
« no previous file with comments | « base/process/process_handle_fuchsia.cc ('k') | base/rand_util_fuchsia.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #define _CRT_SECURE_NO_WARNINGS 5 #define _CRT_SECURE_NO_WARNINGS
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 } 870 }
871 #endif // !defined(OS_FUCHSIA) 871 #endif // !defined(OS_FUCHSIA)
872 872
873 // TODO(port): port those unit tests. 873 // TODO(port): port those unit tests.
874 bool IsProcessDead(base::ProcessHandle child) { 874 bool IsProcessDead(base::ProcessHandle child) {
875 #if defined(OS_FUCHSIA) 875 #if defined(OS_FUCHSIA)
876 // ProcessHandle is an mx_handle_t, not a pid on Fuchsia, so waitpid() doesn't 876 // ProcessHandle is an mx_handle_t, not a pid on Fuchsia, so waitpid() doesn't
877 // make sense. 877 // make sense.
878 mx_signals_t signals; 878 mx_signals_t signals;
879 // Timeout of 0 to check for termination, but non-blocking. 879 // Timeout of 0 to check for termination, but non-blocking.
880 if (mx_object_wait_one(child, MX_TASK_TERMINATED, 0, &signals) == NO_ERROR) { 880 if (mx_object_wait_one(child, MX_TASK_TERMINATED, 0, &signals) == MX_OK) {
881 DCHECK(signals & MX_TASK_TERMINATED); 881 DCHECK(signals & MX_TASK_TERMINATED);
882 return true; 882 return true;
883 } 883 }
884 return false; 884 return false;
885 #else 885 #else
886 // waitpid() will actually reap the process which is exactly NOT what we 886 // waitpid() will actually reap the process which is exactly NOT what we
887 // want to test for. The good thing is that if it can't find the process 887 // want to test for. The good thing is that if it can't find the process
888 // we'll get a nice value for errno which we can test for. 888 // we'll get a nice value for errno which we can test for.
889 const pid_t result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG)); 889 const pid_t result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG));
890 return result == -1 && errno == ECHILD; 890 return result == -1 && errno == ECHILD;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1039
1040 base::SpawnChildResult spawn_child = 1040 base::SpawnChildResult spawn_child =
1041 SpawnChildWithOptions("SimpleChildProcess", options); 1041 SpawnChildWithOptions("SimpleChildProcess", options);
1042 ASSERT_TRUE(spawn_child.process.IsValid()); 1042 ASSERT_TRUE(spawn_child.process.IsValid());
1043 1043
1044 int exit_code = kSuccess; 1044 int exit_code = kSuccess;
1045 EXPECT_TRUE(spawn_child.process.WaitForExit(&exit_code)); 1045 EXPECT_TRUE(spawn_child.process.WaitForExit(&exit_code));
1046 EXPECT_NE(kSuccess, exit_code); 1046 EXPECT_NE(kSuccess, exit_code);
1047 } 1047 }
1048 #endif // defined(OS_LINUX) 1048 #endif // defined(OS_LINUX)
OLDNEW
« no previous file with comments | « base/process/process_handle_fuchsia.cc ('k') | base/rand_util_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698