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

Unified Diff: chrome/browser/service_process/service_process_control_mac_unittest.mm

Issue 664863003: mac: Fix TestGTMSMJobSubmitRemove on Yosemite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from scottbyer. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..270e9697f082ca326cad17db775346881f70092e 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,8 @@
#include "base/mac/foundation_util.h"
#include "base/mac/launchd.h"
#include "base/mac/scoped_nsobject.h"
+#include "base/test/test_timeouts.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 +60,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 = TestTimeouts::action_timeout();
+ 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.
« 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