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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( | 274 scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( |
275 IPCTestBase::GetChannelName("PerformanceClient"), &listener)); | 275 IPCTestBase::GetChannelName("PerformanceClient"), &listener)); |
276 listener.Init(channel.get()); | 276 listener.Init(channel.get()); |
277 CHECK(channel->Connect()); | 277 CHECK(channel->Connect()); |
278 | 278 |
279 base::MessageLoop::current()->Run(); | 279 base::MessageLoop::current()->Run(); |
280 return 0; | 280 return 0; |
281 } | 281 } |
282 | 282 |
283 TEST_F(IPCChannelPerfTest, ChannelProxyPingPong) { | 283 TEST_F(IPCChannelPerfTest, ChannelProxyPingPong) { |
284 set_message_loop(make_scoped_ptr(new base::MessageLoop())); | 284 InitWithCustomMessageLoop("PerformanceClient", |
285 Init("PerformanceClient"); | 285 make_scoped_ptr(new base::MessageLoop())); |
286 | 286 |
287 base::TestIOThread io_thread(base::TestIOThread::kAutoStart); | 287 base::TestIOThread io_thread(base::TestIOThread::kAutoStart); |
288 | 288 |
289 // Set up IPC channel and start client. | 289 // Set up IPC channel and start client. |
290 PerformanceChannelListener listener("ChannelProxy"); | 290 PerformanceChannelListener listener("ChannelProxy"); |
291 CreateChannelProxy(&listener, io_thread.task_runner()); | 291 CreateChannelProxy(&listener, io_thread.task_runner()); |
292 listener.Init(channel_proxy()); | 292 listener.Init(channel_proxy()); |
293 ASSERT_TRUE(StartClient()); | 293 ASSERT_TRUE(StartClient()); |
294 | 294 |
295 // Test several sizes. We use 12^N for message size, and limit the message | 295 // Test several sizes. We use 12^N for message size, and limit the message |
(...skipping 21 matching lines...) Expand all Loading... |
317 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); | 317 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); |
318 message->WriteInt(-1); | 318 message->WriteInt(-1); |
319 message->WriteString("quit"); | 319 message->WriteString("quit"); |
320 sender()->Send(message); | 320 sender()->Send(message); |
321 | 321 |
322 EXPECT_TRUE(WaitForClientShutdown()); | 322 EXPECT_TRUE(WaitForClientShutdown()); |
323 DestroyChannelProxy(); | 323 DestroyChannelProxy(); |
324 } | 324 } |
325 | 325 |
326 } // namespace | 326 } // namespace |
OLD | NEW |