Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: ipc/ipc_test_channel_listener.cc

Issue 1499793003: Fix classes that have too many virtuals for inline constructors. Base URL: https://chromium.googlesource.com/chromium/src.git@enable-virtuals-as-complexity
Patch Set: Finish fixing the codebase that's accessible from Linux. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ipc/ipc_test_channel_listener.h" 5 #include "ipc/ipc_test_channel_listener.h"
6 6
7 #include "ipc/ipc_message.h" 7 #include "ipc/ipc_message.h"
8 #include "ipc/ipc_sender.h" 8 #include "ipc/ipc_sender.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 // Make sure we can handle large messages. 24 // Make sure we can handle large messages.
25 char junk[kLongMessageStringNumBytes]; 25 char junk[kLongMessageStringNumBytes];
26 memset(junk, 'a', sizeof(junk)-1); 26 memset(junk, 'a', sizeof(junk)-1);
27 junk[sizeof(junk)-1] = 0; 27 junk[sizeof(junk)-1] = 0;
28 message->WriteString(std::string(junk)); 28 message->WriteString(std::string(junk));
29 29
30 sender->Send(message); 30 sender->Send(message);
31 } 31 }
32 32
33 TestChannelListener::TestChannelListener()
34 : sender_(NULL), messages_left_(50) {}
33 35
34 bool TestChannelListener::OnMessageReceived(const IPC::Message& message) { 36 bool TestChannelListener::OnMessageReceived(const IPC::Message& message) {
35 base::PickleIterator iter(message); 37 base::PickleIterator iter(message);
36 38
37 int ignored; 39 int ignored;
38 EXPECT_TRUE(iter.ReadInt(&ignored)); 40 EXPECT_TRUE(iter.ReadInt(&ignored));
39 std::string data; 41 std::string data;
40 EXPECT_TRUE(iter.ReadString(&data)); 42 EXPECT_TRUE(iter.ReadString(&data));
41 std::string big_string; 43 std::string big_string;
42 EXPECT_TRUE(iter.ReadString(&big_string)); 44 EXPECT_TRUE(iter.ReadString(&big_string));
(...skipping 10 matching lines...) Expand all
53 } 55 }
54 56
55 void TestChannelListener::SendNextMessage() { 57 void TestChannelListener::SendNextMessage() {
56 if (--messages_left_ <= 0) 58 if (--messages_left_ <= 0)
57 base::MessageLoop::current()->QuitWhenIdle(); 59 base::MessageLoop::current()->QuitWhenIdle();
58 else 60 else
59 SendOneMessage(sender_, "Foo"); 61 SendOneMessage(sender_, "Foo");
60 } 62 }
61 63
62 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698