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

Side by Side Diff: ipc/ipc_fuzzing_tests.cc

Issue 2968003005: Support Serializing and Deserializing RepeatedField / RepeatedPtrField in IPC::Message (Closed)
Patch Set: Resolve review comments Created 3 years, 5 months 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 (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 <stdint.h> 5 #include <stdint.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL); 119 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL);
120 EXPECT_TRUE(m.WriteInt(0x71000000)); // This is the count of elements. 120 EXPECT_TRUE(m.WriteInt(0x71000000)); // This is the count of elements.
121 EXPECT_TRUE(m.WriteInt64(1)); 121 EXPECT_TRUE(m.WriteInt64(1));
122 EXPECT_TRUE(m.WriteInt64(2)); 122 EXPECT_TRUE(m.WriteInt64(2));
123 123
124 std::vector<int64_t> vec; 124 std::vector<int64_t> vec;
125 base::PickleIterator iter(m); 125 base::PickleIterator iter(m);
126 EXPECT_FALSE(ReadParam(&m, &iter, &vec)); 126 EXPECT_FALSE(ReadParam(&m, &iter, &vec));
127 } 127 }
128 128
129 // This test needs ~20 seconds in Debug mode, or ~4 seconds in Release mode.
130 // See http://crbug.com/741866 for details.
131 TEST(IPCMessageIntegrity, DISABLED_ReadVectorTooLarge3) {
132 base::Pickle pickle;
133 IPC::WriteParam(&pickle, 256 * 1024 * 1024);
134 IPC::WriteParam(&pickle, 0);
135 IPC::WriteParam(&pickle, 1);
136 IPC::WriteParam(&pickle, 2);
137
138 base::PickleIterator iter(pickle);
139 std::vector<int> vec;
140 EXPECT_FALSE(IPC::ReadParam(&pickle, &iter, &vec));
141 }
142
129 class SimpleListener : public IPC::Listener { 143 class SimpleListener : public IPC::Listener {
130 public: 144 public:
131 SimpleListener() : other_(NULL) { 145 SimpleListener() : other_(NULL) {
132 } 146 }
133 void Init(IPC::Sender* s) { 147 void Init(IPC::Sender* s) {
134 other_ = s; 148 other_ = s;
135 } 149 }
136 protected: 150 protected:
137 IPC::Sender* other_; 151 IPC::Sender* other_;
138 }; 152 };
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // thrown out of sync by the extra argument. 356 // thrown out of sync by the extra argument.
343 msg = new MsgClassIS(3, base::ASCIIToUTF16("expect three")); 357 msg = new MsgClassIS(3, base::ASCIIToUTF16("expect three"));
344 sender()->Send(msg); 358 sender()->Send(msg);
345 EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID)); 359 EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID));
346 360
347 EXPECT_TRUE(WaitForClientShutdown()); 361 EXPECT_TRUE(WaitForClientShutdown());
348 DestroyChannel(); 362 DestroyChannel();
349 } 363 }
350 364
351 } // namespace 365 } // namespace
OLDNEW
« no previous file with comments | « ipc/DEPS ('k') | ipc/ipc_message_protobuf_utils.h » ('j') | ipc/ipc_message_protobuf_utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698