| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <launch.h> | 5 #include <launch.h> |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" |
| 7 #include "base/mac/launchd.h" | 8 #include "base/mac/launchd.h" |
| 8 #include "base/mac/mac_util.h" | |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "third_party/google_toolbox_for_mac/src/Foundation/GTMServiceManagement
.h" | 11 #include "third_party/google_toolbox_for_mac/src/Foundation/GTMServiceManagement
.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // Returns the parameters needed to launch a really simple script from launchd. | 15 // Returns the parameters needed to launch a really simple script from launchd. |
| 16 NSDictionary* TestJobDictionary(NSString* label_ns) { | 16 NSDictionary* TestJobDictionary(NSString* label_ns) { |
| 17 NSString* shell_script_ns = @"sleep 10; echo TestGTMSMJobSubmitRemove"; | 17 NSString* shell_script_ns = @"sleep 10; echo TestGTMSMJobSubmitRemove"; |
| 18 base::scoped_nsobject<NSMutableArray> job_arguments( | 18 base::scoped_nsobject<NSMutableArray> job_arguments( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 EXPECT_GT(pid, 0); | 57 EXPECT_GT(pid, 0); |
| 58 | 58 |
| 59 // Remove the job. | 59 // Remove the job. |
| 60 ASSERT_TRUE(GTMSMJobRemove(label_cf, &error)); | 60 ASSERT_TRUE(GTMSMJobRemove(label_cf, &error)); |
| 61 pid = base::mac::PIDForJob(label); | 61 pid = base::mac::PIDForJob(label); |
| 62 EXPECT_LT(pid, 0); | 62 EXPECT_LT(pid, 0); |
| 63 | 63 |
| 64 // Attempting to remove the job again should fail. | 64 // Attempting to remove the job again should fail. |
| 65 EXPECT_FALSE(GTMSMJobRemove(label_cf, &error)); | 65 EXPECT_FALSE(GTMSMJobRemove(label_cf, &error)); |
| 66 } | 66 } |
| OLD | NEW |