| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 8 |
| 9 #if !defined(OS_MACOSX) | 9 #if !defined(OS_MACOSX) |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 #include "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 27 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 28 #include "chrome/common/auto_start_linux.h" | 28 #include "chrome/common/auto_start_linux.h" |
| 29 #include <glib.h> | 29 #include <glib.h> |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #if defined(TOUCH_UI) |
| 33 // This test fails http://crbug/84854 |
| 34 #define MAYBE_ForceShutdown FAILS_ForceShutdown |
| 35 #else |
| 36 #define MAYBE_ForceShutdown ForceShutdown |
| 37 #endif |
| 38 |
| 32 namespace { | 39 namespace { |
| 33 | 40 |
| 34 bool g_good_shutdown = false; | 41 bool g_good_shutdown = false; |
| 35 | 42 |
| 36 void ShutdownTask(MessageLoop* loop) { | 43 void ShutdownTask(MessageLoop* loop) { |
| 37 // Quit the main message loop. | 44 // Quit the main message loop. |
| 38 ASSERT_FALSE(g_good_shutdown); | 45 ASSERT_FALSE(g_good_shutdown); |
| 39 g_good_shutdown = true; | 46 g_good_shutdown = true; |
| 40 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 47 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 41 } | 48 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // don't have this issue. Until we have a more stable shared memory | 166 // don't have this issue. Until we have a more stable shared memory |
| 160 // implementation on Posix, this check will only execute on Windows. | 167 // implementation on Posix, this check will only execute on Windows. |
| 161 ASSERT_FALSE(GetServiceProcessData(&version, &pid)); | 168 ASSERT_FALSE(GetServiceProcessData(&version, &pid)); |
| 162 #endif // defined(OS_WIN) | 169 #endif // defined(OS_WIN) |
| 163 ServiceProcessState state; | 170 ServiceProcessState state; |
| 164 ASSERT_TRUE(state.Initialize()); | 171 ASSERT_TRUE(state.Initialize()); |
| 165 ASSERT_TRUE(GetServiceProcessData(&version, &pid)); | 172 ASSERT_TRUE(GetServiceProcessData(&version, &pid)); |
| 166 ASSERT_EQ(base::GetCurrentProcId(), pid); | 173 ASSERT_EQ(base::GetCurrentProcId(), pid); |
| 167 } | 174 } |
| 168 | 175 |
| 169 TEST_F(ServiceProcessStateTest, ForceShutdown) { | 176 TEST_F(ServiceProcessStateTest, MAYBE_ForceShutdown) { |
| 170 base::ProcessHandle handle = SpawnChild("ServiceProcessStateTestShutdown", | 177 base::ProcessHandle handle = SpawnChild("ServiceProcessStateTestShutdown", |
| 171 true); | 178 true); |
| 172 ASSERT_TRUE(handle); | 179 ASSERT_TRUE(handle); |
| 173 for (int i = 0; !CheckServiceProcessReady() && i < 10; ++i) { | 180 for (int i = 0; !CheckServiceProcessReady() && i < 10; ++i) { |
| 174 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); | 181 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); |
| 175 } | 182 } |
| 176 ASSERT_TRUE(CheckServiceProcessReady()); | 183 ASSERT_TRUE(CheckServiceProcessReady()); |
| 177 std::string version; | 184 std::string version; |
| 178 base::ProcessId pid; | 185 base::ProcessId pid; |
| 179 ASSERT_TRUE(GetServiceProcessData(&version, &pid)); | 186 ASSERT_TRUE(GetServiceProcessData(&version, &pid)); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 ScopedAttributesRestorer restorer(bundle_path(), 0777); | 548 ScopedAttributesRestorer restorer(bundle_path(), 0777); |
| 542 GetIOMessageLoopProxy()->PostTask( | 549 GetIOMessageLoopProxy()->PostTask( |
| 543 FROM_HERE, | 550 FROM_HERE, |
| 544 NewRunnableFunction(&ChangeAttr, bundle_path(), 0222)); | 551 NewRunnableFunction(&ChangeAttr, bundle_path(), 0222)); |
| 545 Run(); | 552 Run(); |
| 546 ASSERT_TRUE(mock_launchd()->remove_called()); | 553 ASSERT_TRUE(mock_launchd()->remove_called()); |
| 547 ASSERT_TRUE(mock_launchd()->delete_called()); | 554 ASSERT_TRUE(mock_launchd()->delete_called()); |
| 548 } | 555 } |
| 549 | 556 |
| 550 #endif // !OS_MACOSX | 557 #endif // !OS_MACOSX |
| OLD | NEW |