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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 TEST_F(IPCChannelTest, Performance) { | 494 TEST_F(IPCChannelTest, Performance) { |
495 // setup IPC channel | 495 // setup IPC channel |
496 IPC::Channel chan(kReflectorChannel, IPC::Channel::MODE_SERVER, NULL); | 496 IPC::Channel chan(kReflectorChannel, IPC::Channel::MODE_SERVER, NULL); |
497 ChannelPerfListener perf_listener(&chan, 10000, 100000); | 497 ChannelPerfListener perf_listener(&chan, 10000, 100000); |
498 chan.set_listener(&perf_listener); | 498 chan.set_listener(&perf_listener); |
499 ASSERT_TRUE(chan.Connect()); | 499 ASSERT_TRUE(chan.Connect()); |
500 | 500 |
501 HANDLE process = SpawnChild(TEST_REFLECTOR, &chan); | 501 HANDLE process = SpawnChild(TEST_REFLECTOR, &chan); |
502 ASSERT_TRUE(process); | 502 ASSERT_TRUE(process); |
503 | 503 |
504 PlatformThread::Sleep(1000); | 504 PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); |
505 | 505 |
506 PerfTimeLogger logger("IPC_Perf"); | 506 PerfTimeLogger logger("IPC_Perf"); |
507 | 507 |
508 // this initial message will kick-start the ping-pong of messages | 508 // this initial message will kick-start the ping-pong of messages |
509 IPC::Message* message = new IPC::Message(0, | 509 IPC::Message* message = new IPC::Message(0, |
510 2, | 510 2, |
511 IPC::Message::PRIORITY_NORMAL); | 511 IPC::Message::PRIORITY_NORMAL); |
512 message->WriteInt(GetTickCount()); | 512 message->WriteInt(GetTickCount()); |
513 message->WriteInt(-1); | 513 message->WriteInt(-1); |
514 message->WriteString("Hello"); | 514 message->WriteString("Hello"); |
(...skipping 22 matching lines...) Expand all Loading... |
537 #endif // PERFORMANCE_TEST | 537 #endif // PERFORMANCE_TEST |
538 | 538 |
539 int main(int argc, char** argv) { | 539 int main(int argc, char** argv) { |
540 #ifdef PERFORMANCE_TEST | 540 #ifdef PERFORMANCE_TEST |
541 int retval = base::PerfTestSuite(argc, argv).Run(); | 541 int retval = base::PerfTestSuite(argc, argv).Run(); |
542 #else | 542 #else |
543 int retval = base::TestSuite(argc, argv).Run(); | 543 int retval = base::TestSuite(argc, argv).Run(); |
544 #endif | 544 #endif |
545 return retval; | 545 return retval; |
546 } | 546 } |
OLD | NEW |