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 491b42f625b37d1eb8260ce332b473b03ca0d0a4..0b004fb4ca5b5e54c8d789cee40b1e288e25339f 100644 |
| --- a/chrome/browser/service_process/service_process_control_mac_unittest.mm |
| +++ b/chrome/browser/service_process/service_process_control_mac_unittest.mm |
| @@ -7,6 +7,7 @@ |
| #include "base/mac/foundation_util.h" |
| #include "base/mac/launchd.h" |
| #include "base/mac/scoped_nsobject.h" |
| +#include "base/time/time.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "third_party/google_toolbox_for_mac/src/Foundation/GTMServiceManagement.h" |
| @@ -58,7 +59,20 @@ TEST(ServiceProcessControlMac, TestGTMSMJobSubmitRemove) { |
| // Remove the job. |
| ASSERT_TRUE(GTMSMJobRemove(label_cf, &error)); |
| - pid = base::mac::PIDForJob(label); |
| + |
| + // Wait for the job to be killed. |
| + base::TimeDelta timeout_in_ms = base::TimeDelta::FromMilliseconds(1000); |
|
Scott Byer
2015/01/31 00:18:15
IIRC, there are some testing time constants hangin
erikchen
2015/01/31 00:52:05
Found the class "TestTimeouts" and updated the cod
|
| + base::Time start_time = base::Time::Now(); |
| + while (1) { |
| + pid = base::mac::PIDForJob(label); |
| + if (pid < 0) |
| + break; |
| + |
| + base::Time current_time = base::Time::Now(); |
| + if (current_time - start_time > timeout_in_ms) |
| + break; |
| + } |
| + |
| EXPECT_LT(pid, 0); |
| // Attempting to remove the job again should fail. |