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 "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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 // cleanup child process | 282 // cleanup child process |
283 EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000)); | 283 EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000)); |
284 base::CloseProcessHandle(process_handle); | 284 base::CloseProcessHandle(process_handle); |
285 } | 285 } |
286 thread.Stop(); | 286 thread.Stop(); |
287 } | 287 } |
288 | 288 |
289 class ChannelListenerWithOnConnectedSend : public IPC::Channel::Listener { | 289 class ChannelListenerWithOnConnectedSend : public IPC::Channel::Listener { |
290 public: | 290 public: |
291 virtual void OnChannelConnected(int32 peer_pid) { | 291 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE { |
292 SendNextMessage(); | 292 SendNextMessage(); |
293 } | 293 } |
294 | 294 |
295 virtual bool OnMessageReceived(const IPC::Message& message) { | 295 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
296 IPC::MessageIterator iter(message); | 296 IPC::MessageIterator iter(message); |
297 | 297 |
298 iter.NextInt(); | 298 iter.NextInt(); |
299 const std::string data = iter.NextString(); | 299 const std::string data = iter.NextString(); |
300 const std::string big_string = iter.NextString(); | 300 const std::string big_string = iter.NextString(); |
301 EXPECT_EQ(kLongMessageStringNumBytes - 1, big_string.length()); | 301 EXPECT_EQ(kLongMessageStringNumBytes - 1, big_string.length()); |
302 SendNextMessage(); | 302 SendNextMessage(); |
303 return true; | 303 return true; |
304 } | 304 } |
305 | 305 |
306 virtual void OnChannelError() { | 306 virtual void OnChannelError() OVERRIDE { |
307 // There is a race when closing the channel so the last message may be lost. | 307 // There is a race when closing the channel so the last message may be lost. |
308 EXPECT_LE(messages_left_, 1); | 308 EXPECT_LE(messages_left_, 1); |
309 MessageLoop::current()->Quit(); | 309 MessageLoop::current()->Quit(); |
310 } | 310 } |
311 | 311 |
312 void Init(IPC::Message::Sender* s) { | 312 void Init(IPC::Message::Sender* s) { |
313 sender_ = s; | 313 sender_ = s; |
314 messages_left_ = 50; | 314 messages_left_ = 50; |
315 } | 315 } |
316 | 316 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |