Chromium Code Reviews| Index: chrome/browser/service_process/service_process_control_mac_unittest.mm |
| diff --git a/chrome/browser/service_process/service_process_control_mac_unittest.mm b/chrome/browser/service_process/service_process_control_mac_unittest.mm |
| index febb5f21c73b129cb925d2602912b90aa9fb6f73..f2a0e82c5efab8fa78dc902630035b618cf3c49a 100644 |
| --- a/chrome/browser/service_process/service_process_control_mac_unittest.mm |
| +++ b/chrome/browser/service_process/service_process_control_mac_unittest.mm |
| @@ -14,7 +14,7 @@ namespace { |
| // Returns the parameters needed to launch a really simple script from launchd. |
| NSDictionary* TestJobDictionary(NSString* label_ns) { |
| - NSString* shell_script_ns = @"sleep 10; echo TestGTMSMJobSubmitRemove"; |
| + NSString* shell_script_ns = @"echo TestGTMSMJobSubmitRemove"; |
| base::scoped_nsobject<NSMutableArray> job_arguments( |
| [[NSMutableArray alloc] init]); |
| [job_arguments addObject:@"/bin/sh"]; |
| @@ -56,6 +56,19 @@ TEST(ServiceProcessControlMac, TestGTMSMJobSubmitRemove) { |
| pid = base::mac::PIDForJob(label); |
| EXPECT_GT(pid, 0); |
| + // In Yosemite, the behavior of launch_msg() has changed. Using it to remove |
| + // a job that is still in progress succeeds, but the function still returns |
| + // an error message: "The operation couldn’t be completed. Operation now in |
| + // progress". This logic waits for the job to finish running to avoid |
| + // triggering the error message. |
| + if (base::mac::IsOSYosemiteOrLater()) { |
| + while(true) { |
| + pid = base::mac::PIDForJob(label); |
| + if (pid == 0) |
| + break; |
| + } |
| + } |
| + |
| // Remove the job. |
| ASSERT_TRUE(GTMSMJobRemove(label_cf, &error)); |
|
Mark Mentovai
2014/10/20 20:24:38
Shouldn’t we fix GTMSMJobRemove() instead?
erikchen
2014/10/21 00:13:25
I looked more into this. GTMSMJobRemove() is a thi
|
| pid = base::mac::PIDForJob(label); |