| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 ASSERT_TRUE(base::WaitForExitCode(handle, &exit_code)); | 101 ASSERT_TRUE(base::WaitForExitCode(handle, &exit_code)); |
| 102 ASSERT_EQ(exit_code, 0); | 102 ASSERT_EQ(exit_code, 0); |
| 103 } | 103 } |
| 104 | 104 |
| 105 TEST_F(ServiceProcessStateTest, Singleton) { | 105 TEST_F(ServiceProcessStateTest, Singleton) { |
| 106 ServiceProcessState state; | 106 ServiceProcessState state; |
| 107 ASSERT_TRUE(state.Initialize()); | 107 ASSERT_TRUE(state.Initialize()); |
| 108 LaunchAndWait("ServiceProcessStateTestSingleton"); | 108 LaunchAndWait("ServiceProcessStateTestSingleton"); |
| 109 } | 109 } |
| 110 | 110 |
| 111 TEST_F(ServiceProcessStateTest, ReadyState) { | 111 // http://crbug.com/396390 |
| 112 TEST_F(ServiceProcessStateTest, DISABLED_ReadyState) { |
| 112 ASSERT_FALSE(CheckServiceProcessReady()); | 113 ASSERT_FALSE(CheckServiceProcessReady()); |
| 113 ServiceProcessState state; | 114 ServiceProcessState state; |
| 114 ASSERT_TRUE(state.Initialize()); | 115 ASSERT_TRUE(state.Initialize()); |
| 115 ASSERT_TRUE(state.SignalReady(IOMessageLoopProxy(), base::Closure())); | 116 ASSERT_TRUE(state.SignalReady(IOMessageLoopProxy(), base::Closure())); |
| 116 LaunchAndWait("ServiceProcessStateTestReadyTrue"); | 117 LaunchAndWait("ServiceProcessStateTestReadyTrue"); |
| 117 state.SignalStopped(); | 118 state.SignalStopped(); |
| 118 LaunchAndWait("ServiceProcessStateTestReadyFalse"); | 119 LaunchAndWait("ServiceProcessStateTestReadyFalse"); |
| 119 } | 120 } |
| 120 | 121 |
| 121 TEST_F(ServiceProcessStateTest, AutoRun) { | 122 TEST_F(ServiceProcessStateTest, AutoRun) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
| 161 EXPECT_FALSE(base::win::ReadCommandFromAutoRun(HKEY_CURRENT_USER, | 162 EXPECT_FALSE(base::win::ReadCommandFromAutoRun(HKEY_CURRENT_USER, |
| 162 base::UTF8ToWide(value_name), | 163 base::UTF8ToWide(value_name), |
| 163 &value)); | 164 &value)); |
| 164 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 165 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
| 165 EXPECT_FALSE(AutoStart::GetAutostartFileValue( | 166 EXPECT_FALSE(AutoStart::GetAutostartFileValue( |
| 166 GetServiceProcessScopedName(base_desktop_name), "Exec", &exec_value)); | 167 GetServiceProcessScopedName(base_desktop_name), "Exec", &exec_value)); |
| 167 #endif // defined(OS_WIN) | 168 #endif // defined(OS_WIN) |
| 168 } | 169 } |
| 169 | 170 |
| 170 TEST_F(ServiceProcessStateTest, SharedMem) { | 171 // http://crbug.com/396390 |
| 172 TEST_F(ServiceProcessStateTest, DISABLED_SharedMem) { |
| 171 std::string version; | 173 std::string version; |
| 172 base::ProcessId pid; | 174 base::ProcessId pid; |
| 173 #if defined(OS_WIN) | 175 #if defined(OS_WIN) |
| 174 // On Posix, named shared memory uses a file on disk. This file | 176 // On Posix, named shared memory uses a file on disk. This file |
| 175 // could be lying around from previous crashes which could cause | 177 // could be lying around from previous crashes which could cause |
| 176 // GetServiceProcessPid to lie. On Windows, we use a named event so we | 178 // GetServiceProcessPid to lie. On Windows, we use a named event so we |
| 177 // don't have this issue. Until we have a more stable shared memory | 179 // don't have this issue. Until we have a more stable shared memory |
| 178 // implementation on Posix, this check will only execute on Windows. | 180 // implementation on Posix, this check will only execute on Windows. |
| 179 ASSERT_FALSE(GetServiceProcessData(&version, &pid)); | 181 ASSERT_FALSE(GetServiceProcessData(&version, &pid)); |
| 180 #endif // defined(OS_WIN) | 182 #endif // defined(OS_WIN) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 ScopedAttributesRestorer restorer(bundle_path(), 0777); | 413 ScopedAttributesRestorer restorer(bundle_path(), 0777); |
| 412 GetIOMessageLoopProxy()->PostTask( | 414 GetIOMessageLoopProxy()->PostTask( |
| 413 FROM_HERE, | 415 FROM_HERE, |
| 414 base::Bind(&ChangeAttr, bundle_path(), 0222)); | 416 base::Bind(&ChangeAttr, bundle_path(), 0222)); |
| 415 Run(); | 417 Run(); |
| 416 ASSERT_TRUE(mock_launchd()->remove_called()); | 418 ASSERT_TRUE(mock_launchd()->remove_called()); |
| 417 ASSERT_TRUE(mock_launchd()->delete_called()); | 419 ASSERT_TRUE(mock_launchd()->delete_called()); |
| 418 } | 420 } |
| 419 | 421 |
| 420 #endif // !OS_MACOSX | 422 #endif // !OS_MACOSX |
| OLD | NEW |