| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/multiprocess_test.h" | |
| 7 #include "base/process_util.h" | 6 #include "base/process_util.h" |
| 7 #include "base/test/multiprocess_test.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/main_function_params.h" | 9 #include "chrome/common/main_function_params.h" |
| 10 #include "ipc/ipc_channel.h" | 10 #include "ipc/ipc_channel.h" |
| 11 #include "ipc/ipc_switches.h" | 11 #include "ipc/ipc_switches.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/multiprocess_func_list.h" |
| 13 | 14 |
| 14 // TODO(port): Bring up this test this on other platforms. | 15 // TODO(port): Bring up this test this on other platforms. |
| 15 #if defined(OS_POSIX) | 16 #if defined(OS_POSIX) |
| 16 | 17 |
| 17 using base::ProcessHandle; | 18 using base::ProcessHandle; |
| 18 | 19 |
| 19 const char kRendererTestChannelName[] = "test"; | 20 const char kRendererTestChannelName[] = "test"; |
| 20 | 21 |
| 21 extern int RendererMain(const MainFunctionParams& parameters); | 22 extern int RendererMain(const MainFunctionParams& parameters); |
| 22 | 23 |
| 23 // TODO(port): The IPC Channel tests have a class with extremely similar | 24 // TODO(port): The IPC Channel tests have a class with extremely similar |
| 24 // functionality, we should combine them. | 25 // functionality, we should combine them. |
| 25 class RendererMainTest : public MultiProcessTest { | 26 class RendererMainTest : public base::MultiProcessTest { |
| 26 protected: | 27 protected: |
| 27 | |
| 28 // Create a new MessageLoopForIO For each test. | 28 // Create a new MessageLoopForIO For each test. |
| 29 virtual void SetUp(); | 29 virtual void SetUp(); |
| 30 virtual void TearDown(); | 30 virtual void TearDown(); |
| 31 | 31 |
| 32 // Spawns a child process of the specified type | 32 // Spawns a child process of the specified type |
| 33 base::ProcessHandle SpawnChild(const std::string& procname, | 33 base::ProcessHandle SpawnChild(const std::string& procname, |
| 34 IPC::Channel* channel); | 34 IPC::Channel* channel); |
| 35 | 35 |
| 36 // Created around each test instantiation. | 36 // Created around each test instantiation. |
| 37 MessageLoopForIO *message_loop_; | 37 MessageLoopForIO *message_loop_; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 control_channel.Connect(); | 95 control_channel.Connect(); |
| 96 MessageLoop::current()->Run(); | 96 MessageLoop::current()->Run(); |
| 97 | 97 |
| 98 // The renderer should exit when we close the channel. | 98 // The renderer should exit when we close the channel. |
| 99 control_channel.Close(); | 99 control_channel.Close(); |
| 100 | 100 |
| 101 EXPECT_TRUE(base::WaitForSingleProcess(renderer_pid, 5000)); | 101 EXPECT_TRUE(base::WaitForSingleProcess(renderer_pid, 5000)); |
| 102 } | 102 } |
| 103 #endif // defined(OS_POSIX) | 103 #endif // defined(OS_POSIX) |
| OLD | NEW |