OLD | NEW |
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 "chrome/test/ui/ui_test_suite.h" | 5 #include "chrome/test/ui/ui_test_suite.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 if (base::GetProcessCount(L"crash_service.exe", NULL)) | 46 if (base::GetProcessCount(L"crash_service.exe", NULL)) |
47 return; | 47 return; |
48 | 48 |
49 job_handle_.Set(CreateJobObject(NULL, NULL)); | 49 job_handle_.Set(CreateJobObject(NULL, NULL)); |
50 if (!job_handle_.IsValid()) { | 50 if (!job_handle_.IsValid()) { |
51 LOG(ERROR) << "Could not create JobObject."; | 51 LOG(ERROR) << "Could not create JobObject."; |
52 return; | 52 return; |
53 } | 53 } |
54 | 54 |
55 JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info = {0}; | 55 if (!SetJobObjectAsKillOnJobClose(job_handle_.Get())) { |
56 limit_info.BasicLimitInformation.LimitFlags = | |
57 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; | |
58 if (0 == SetInformationJobObject(job_handle_.Get(), | |
59 JobObjectExtendedLimitInformation, &limit_info, sizeof(limit_info))) { | |
60 LOG(ERROR) << "Could not SetInformationJobObject."; | 56 LOG(ERROR) << "Could not SetInformationJobObject."; |
61 return; | 57 return; |
62 } | 58 } |
63 | 59 |
64 FilePath exe_dir; | 60 FilePath exe_dir; |
65 if (!PathService::Get(base::DIR_EXE, &exe_dir)) { | 61 if (!PathService::Get(base::DIR_EXE, &exe_dir)) { |
66 LOG(ERROR) << "Failed to get path to DIR_EXE, " | 62 LOG(ERROR) << "Failed to get path to DIR_EXE, " |
67 << "not starting crash_service.exe!"; | 63 << "not starting crash_service.exe!"; |
68 return; | 64 return; |
69 } | 65 } |
70 | 66 |
71 base::LaunchOptions launch_options; | 67 base::LaunchOptions launch_options; |
72 launch_options.job_handle = job_handle_.Get(); | 68 launch_options.job_handle = job_handle_.Get(); |
73 FilePath crash_service = exe_dir.Append(L"crash_service.exe"); | 69 FilePath crash_service = exe_dir.Append(L"crash_service.exe"); |
74 if (!base::LaunchProcess(crash_service.value(), base::LaunchOptions(), | 70 if (!base::LaunchProcess(crash_service.value(), base::LaunchOptions(), |
75 &crash_service_)) { | 71 &crash_service_)) { |
76 LOG(ERROR) << "Couldn't start crash_service.exe, so this ui_tests run " | 72 LOG(ERROR) << "Couldn't start crash_service.exe, so this ui_tests run " |
77 << "won't tell you if any test crashes!"; | 73 << "won't tell you if any test crashes!"; |
78 return; | 74 return; |
79 } | 75 } |
80 } | 76 } |
81 #endif | 77 #endif |
OLD | NEW |