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

Unified Diff: ipc/ipc_tests.cc

Issue 11570038: Remove IPC::MessageIterator. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_tests.cc
diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc
index cecbf45f574e4b272ea05fed5ed4f78e25731812..00a0f6ef39685e88f1bf37727599d0fd5fd64fc6 100644
--- a/ipc/ipc_tests.cc
+++ b/ipc/ipc_tests.cc
@@ -21,6 +21,7 @@
#include "base/command_line.h"
#include "base/debug/debug_on_start_win.h"
#include "base/perftimer.h"
+#include "base/pickle.h"
#include "base/test/perf_test_suite.h"
#include "base/test/test_suite.h"
#include "base/threading/thread.h"
@@ -185,11 +186,14 @@ static void Send(IPC::Sender* sender, const char* text) {
class MyChannelListener : public IPC::Listener {
public:
virtual bool OnMessageReceived(const IPC::Message& message) {
- IPC::MessageIterator iter(message);
-
- iter.NextInt();
- const std::string data = iter.NextString();
- const std::string big_string = iter.NextString();
+ PickleIterator iter(message);
+
+ int ignored;
+ EXPECT_TRUE(iter.ReadInt(&ignored));
+ std::string data;
+ EXPECT_TRUE(iter.ReadString(&data));
+ std::string big_string;
+ EXPECT_TRUE(iter.ReadString(&big_string));
EXPECT_EQ(kLongMessageStringNumBytes - 1, big_string.length());
@@ -339,11 +343,14 @@ class ChannelListenerWithOnConnectedSend : public IPC::Listener {
}
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
- IPC::MessageIterator iter(message);
-
- iter.NextInt();
- const std::string data = iter.NextString();
- const std::string big_string = iter.NextString();
+ PickleIterator iter(message);
+
+ int ignored;
+ EXPECT_TRUE(iter.ReadInt(&ignored));
+ std::string data;
+ EXPECT_TRUE(iter.ReadString(&data));
+ std::string big_string;
+ EXPECT_TRUE(iter.ReadString(&big_string));
EXPECT_EQ(kLongMessageStringNumBytes - 1, big_string.length());
SendNextMessage();
return true;
@@ -459,9 +466,11 @@ class ChannelReflectorListener : public IPC::Listener {
virtual bool OnMessageReceived(const IPC::Message& message) {
count_messages_++;
- IPC::MessageIterator iter(message);
- int time = iter.NextInt();
- int msgid = iter.NextInt();
+ PickleIterator iter(message);
+ int time;
+ EXPECT_TRUE(iter.ReadInt(&time));
+ int msgid;
+ EXPECT_TRUE(iter.ReadInt(&msgid));
std::string payload = iter.NextString();
latency_messages_ += GetTickCount() - time;
@@ -505,15 +514,15 @@ class ChannelPerfListener : public IPC::Listener {
virtual bool OnMessageReceived(const IPC::Message& message) {
count_messages_++;
- // decode the string so this gets counted in the total time
- IPC::MessageIterator iter(message);
- int time = iter.NextInt();
- int msgid = iter.NextInt();
+ // Decode the string so this gets counted in the total time.
+ PickleIterator iter(message);
+ int time;
+ EXPECT_TRUE(iter.ReadInt(&time));
+ int msgid;
+ EXPECT_TRUE(iter.ReadInt(&msgid));
std::string cur = iter.NextString();
latency_messages_ += GetTickCount() - time;
- // cout << "perflistener got message" << endl;
-
count_down_--;
if (count_down_ == 0) {
IPC::Message* msg = new IPC::Message(0,
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698