| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 @autoreleasepool { | 110 @autoreleasepool { |
| 111 std::string cookie; | 111 std::string cookie; |
| 112 for (int index = 0; index < 16; ++index) { | 112 for (int index = 0; index < 16; ++index) { |
| 113 cookie.append(1, base::RandInt('A', 'Z')); | 113 cookie.append(1, base::RandInt('A', 'Z')); |
| 114 } | 114 } |
| 115 | 115 |
| 116 std::string shell_script = | 116 std::string shell_script = |
| 117 base::StringPrintf("sleep 10; echo %s", cookie.c_str()); | 117 base::StringPrintf("sleep 10; echo %s", cookie.c_str()); |
| 118 NSString* shell_script_ns = base::SysUTF8ToNSString(shell_script); | 118 NSString* shell_script_ns = base::SysUTF8ToNSString(shell_script); |
| 119 | 119 |
| 120 const char kJobLabel[] = "com.googlecode.crashpad.test.service_management"; | 120 const char kJobLabel[] = "org.chromium.crashpad.test.service_management"; |
| 121 NSDictionary* job_dictionary_ns = @{ | 121 NSDictionary* job_dictionary_ns = @{ |
| 122 @LAUNCH_JOBKEY_LABEL : @"com.googlecode.crashpad.test.service_management", | 122 @LAUNCH_JOBKEY_LABEL : @"org.chromium.crashpad.test.service_management", |
| 123 @LAUNCH_JOBKEY_RUNATLOAD : @YES, | 123 @LAUNCH_JOBKEY_RUNATLOAD : @YES, |
| 124 @LAUNCH_JOBKEY_PROGRAMARGUMENTS : | 124 @LAUNCH_JOBKEY_PROGRAMARGUMENTS : |
| 125 @[ @"/bin/sh", @"-c", shell_script_ns, ], | 125 @[ @"/bin/sh", @"-c", shell_script_ns, ], |
| 126 }; | 126 }; |
| 127 CFDictionaryRef job_dictionary_cf = | 127 CFDictionaryRef job_dictionary_cf = |
| 128 base::mac::NSToCFCast(job_dictionary_ns); | 128 base::mac::NSToCFCast(job_dictionary_ns); |
| 129 | 129 |
| 130 // The job may be left over from a failed previous run. | 130 // The job may be left over from a failed previous run. |
| 131 if (ServiceManagementIsJobLoaded(kJobLabel)) { | 131 if (ServiceManagementIsJobLoaded(kJobLabel)) { |
| 132 EXPECT_TRUE(ServiceManagementRemoveJob(kJobLabel, true)); | 132 EXPECT_TRUE(ServiceManagementRemoveJob(kJobLabel, true)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 154 // an error. | 154 // an error. |
| 155 EXPECT_FALSE(ServiceManagementRemoveJob(kJobLabel, false)); | 155 EXPECT_FALSE(ServiceManagementRemoveJob(kJobLabel, false)); |
| 156 | 156 |
| 157 ExpectProcessIsNotRunning(job_pid, shell_script); | 157 ExpectProcessIsNotRunning(job_pid, shell_script); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace | 161 } // namespace |
| 162 } // namespace test | 162 } // namespace test |
| 163 } // namespace crashpad | 163 } // namespace crashpad |
| OLD | NEW |