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

Side by Side Diff: base/process_util_unittest.cc

Issue 28277: Linux valgrind: patch up flakey test (Closed)
Patch Set: Created 11 years, 10 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 | « no previous file | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/multiprocess_test.h" 7 #include "base/multiprocess_test.h"
8 #include "base/platform_thread.h" 8 #include "base/platform_thread.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #define EXE_SUFFIX L".exe" 54 #define EXE_SUFFIX L".exe"
55 #else 55 #else
56 #define EXE_SUFFIX L"" 56 #define EXE_SUFFIX L""
57 #endif 57 #endif
58 58
59 TEST_F(ProcessUtilTest, KillSlowChild) { 59 TEST_F(ProcessUtilTest, KillSlowChild) {
60 remove("SlowChildProcess.die"); 60 remove("SlowChildProcess.die");
61 int oldcount = GetProcessCount(L"base_unittests" EXE_SUFFIX, 0); 61 int oldcount = GetProcessCount(L"base_unittests" EXE_SUFFIX, 0);
62 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); 62 ProcessHandle handle = this->SpawnChild(L"SlowChildProcess");
63 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); 63 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle);
64 PlatformThread::Sleep(100);
64 EXPECT_EQ(oldcount+1, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0)); 65 EXPECT_EQ(oldcount+1, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
65 FILE *fp = fopen("SlowChildProcess.die", "w"); 66 FILE *fp = fopen("SlowChildProcess.die", "w");
66 fclose(fp); 67 fclose(fp);
67 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); 68 EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000));
68 EXPECT_EQ(oldcount, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0)); 69 EXPECT_EQ(oldcount, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
69 base::CloseProcessHandle(handle); 70 base::CloseProcessHandle(handle);
70 } 71 }
71 72
72 // TODO(estade): if possible, port these 2 tests. 73 // TODO(estade): if possible, port these 2 tests.
73 #if defined(OS_WIN) 74 #if defined(OS_WIN)
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 base::CloseProcessHandle(handle); 224 base::CloseProcessHandle(handle);
224 close(fds[0]); 225 close(fds[0]);
225 close(sockets[0]); 226 close(sockets[0]);
226 close(sockets[1]); 227 close(sockets[1]);
227 close(dev_null); 228 close(dev_null);
228 } 229 }
229 230
230 #endif // defined(OS_POSIX) 231 #endif // defined(OS_POSIX)
231 232
232 } // namespace base 233 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698