OLD | NEW |
1 // Copyright (c) 2010 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
8 #include "base/test/multiprocess_test.h" | 8 #include "base/test/multiprocess_test.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 return command_line; | 82 return command_line; |
83 } | 83 } |
84 | 84 |
85 // Listener class that kills the message loop when it connects. | 85 // Listener class that kills the message loop when it connects. |
86 class SuicidalListener : public IPC::Channel::Listener { | 86 class SuicidalListener : public IPC::Channel::Listener { |
87 public: | 87 public: |
88 void OnChannelConnected(int32 peer_pid) { | 88 void OnChannelConnected(int32 peer_pid) { |
89 MessageLoop::current()->Quit(); | 89 MessageLoop::current()->Quit(); |
90 } | 90 } |
91 | 91 |
92 void OnMessageReceived(const IPC::Message& message) { | 92 bool OnMessageReceived(const IPC::Message& message) { |
93 // We shouldn't receive any messages | 93 // We shouldn't receive any messages |
94 ASSERT_TRUE(false); | 94 NOTREACHED(); |
| 95 return false; |
95 } | 96 } |
96 }; | 97 }; |
97 | 98 |
98 MULTIPROCESS_TEST_MAIN(SimpleRenderer) { | 99 MULTIPROCESS_TEST_MAIN(SimpleRenderer) { |
99 SandboxInitWrapper dummy_sandbox_init; | 100 SandboxInitWrapper dummy_sandbox_init; |
100 CommandLine cl(*CommandLine::ForCurrentProcess()); | 101 CommandLine cl(*CommandLine::ForCurrentProcess()); |
101 cl.AppendSwitchASCII(switches::kProcessChannelID, kRendererTestChannelName); | 102 cl.AppendSwitchASCII(switches::kProcessChannelID, kRendererTestChannelName); |
102 | 103 |
103 MainFunctionParams dummy_params(cl, dummy_sandbox_init, NULL); | 104 MainFunctionParams dummy_params(cl, dummy_sandbox_init, NULL); |
104 return RendererMain(dummy_params); | 105 return RendererMain(dummy_params); |
(...skipping 11 matching lines...) Expand all Loading... |
116 | 117 |
117 MessageLoop::current()->Run(); | 118 MessageLoop::current()->Run(); |
118 | 119 |
119 // The renderer should exit when we close the channel. | 120 // The renderer should exit when we close the channel. |
120 control_channel.Close(); | 121 control_channel.Close(); |
121 | 122 |
122 EXPECT_TRUE(base::WaitForSingleProcess(renderer_pid, | 123 EXPECT_TRUE(base::WaitForSingleProcess(renderer_pid, |
123 TestTimeouts::action_timeout_ms())); | 124 TestTimeouts::action_timeout_ms())); |
124 } | 125 } |
125 #endif // defined(OS_POSIX) | 126 #endif // defined(OS_POSIX) |
OLD | NEW |