OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 338 } |
339 | 339 |
340 TEST_F(ServiceProcessStateFileManipulationTest, VerifyLaunchD) { | 340 TEST_F(ServiceProcessStateFileManipulationTest, VerifyLaunchD) { |
341 // There have been problems where launchd has gotten into a bad state, usually | 341 // There have been problems where launchd has gotten into a bad state, usually |
342 // because something had deleted all the files in /tmp. launchd depends on | 342 // because something had deleted all the files in /tmp. launchd depends on |
343 // a Unix Domain Socket that it creates at /tmp/launchd*/sock. | 343 // a Unix Domain Socket that it creates at /tmp/launchd*/sock. |
344 // The symptom of this problem is that the service process connect fails | 344 // The symptom of this problem is that the service process connect fails |
345 // on Mac and "launch_msg(): Socket is not connected" appears. | 345 // on Mac and "launch_msg(): Socket is not connected" appears. |
346 // This test is designed to make sure that launchd is working. | 346 // This test is designed to make sure that launchd is working. |
347 // http://crbug/75518 | 347 // http://crbug/75518 |
| 348 // Note: This particular problem no longer affects launchd in 10.10+, since |
| 349 // there is no user owned launchd process and sockets are no longer made at |
| 350 // /tmp/launchd*/sock. This test is still useful as a sanity check to make |
| 351 // sure that launchd appears to be working. |
348 | 352 |
349 CommandLine cl(base::FilePath("/bin/launchctl")); | 353 CommandLine cl(base::FilePath("/bin/launchctl")); |
350 cl.AppendArg("list"); | 354 cl.AppendArg("limit"); |
351 cl.AppendArg("com.apple.launchctl.Aqua"); | |
352 | 355 |
353 std::string output; | 356 std::string output; |
354 int exit_code = -1; | 357 int exit_code = -1; |
355 ASSERT_TRUE(base::GetAppOutputWithExitCode(cl, &output, &exit_code) | 358 ASSERT_TRUE(base::GetAppOutputWithExitCode(cl, &output, &exit_code) |
356 && exit_code == 0) | 359 && exit_code == 0) |
357 << " exit_code:" << exit_code << " " << output; | 360 << " exit_code:" << exit_code << " " << output; |
358 } | 361 } |
359 | 362 |
360 TEST_F(ServiceProcessStateFileManipulationTest, DeleteFile) { | 363 TEST_F(ServiceProcessStateFileManipulationTest, DeleteFile) { |
361 GetIOMessageLoopProxy()->PostTask( | 364 GetIOMessageLoopProxy()->PostTask( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 ScopedAttributesRestorer restorer(bundle_path(), 0777); | 416 ScopedAttributesRestorer restorer(bundle_path(), 0777); |
414 GetIOMessageLoopProxy()->PostTask( | 417 GetIOMessageLoopProxy()->PostTask( |
415 FROM_HERE, | 418 FROM_HERE, |
416 base::Bind(&ChangeAttr, bundle_path(), 0222)); | 419 base::Bind(&ChangeAttr, bundle_path(), 0222)); |
417 Run(); | 420 Run(); |
418 ASSERT_TRUE(mock_launchd()->remove_called()); | 421 ASSERT_TRUE(mock_launchd()->remove_called()); |
419 ASSERT_TRUE(mock_launchd()->delete_called()); | 422 ASSERT_TRUE(mock_launchd()->delete_called()); |
420 } | 423 } |
421 | 424 |
422 #endif // !OS_MACOSX | 425 #endif // !OS_MACOSX |
OLD | NEW |