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

Side by Side Diff: ipc/ipc_tests.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_sync_message.cc ('k') | ipc/param_traits_macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 TEST_F(IPCChannelTest, BasicMessageTest) { 133 TEST_F(IPCChannelTest, BasicMessageTest) {
134 int v1 = 10; 134 int v1 = 10;
135 std::string v2("foobar"); 135 std::string v2("foobar");
136 std::wstring v3(L"hello world"); 136 std::wstring v3(L"hello world");
137 137
138 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL); 138 IPC::Message m(0, 1, IPC::Message::PRIORITY_NORMAL);
139 EXPECT_TRUE(m.WriteInt(v1)); 139 EXPECT_TRUE(m.WriteInt(v1));
140 EXPECT_TRUE(m.WriteString(v2)); 140 EXPECT_TRUE(m.WriteString(v2));
141 EXPECT_TRUE(m.WriteWString(v3)); 141 EXPECT_TRUE(m.WriteWString(v3));
142 142
143 void* iter = NULL; 143 PickleIterator iter(m);
144 144
145 int vi; 145 int vi;
146 std::string vs; 146 std::string vs;
147 std::wstring vw; 147 std::wstring vw;
148 148
149 EXPECT_TRUE(m.ReadInt(&iter, &vi)); 149 EXPECT_TRUE(m.ReadInt(&iter, &vi));
150 EXPECT_EQ(v1, vi); 150 EXPECT_EQ(v1, vi);
151 151
152 EXPECT_TRUE(m.ReadString(&iter, &vs)); 152 EXPECT_TRUE(m.ReadString(&iter, &vs));
153 EXPECT_EQ(v2, vs); 153 EXPECT_EQ(v2, vs);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 #endif // PERFORMANCE_TEST 579 #endif // PERFORMANCE_TEST
580 580
581 int main(int argc, char** argv) { 581 int main(int argc, char** argv) {
582 #ifdef PERFORMANCE_TEST 582 #ifdef PERFORMANCE_TEST
583 int retval = base::PerfTestSuite(argc, argv).Run(); 583 int retval = base::PerfTestSuite(argc, argv).Run();
584 #else 584 #else
585 int retval = base::TestSuite(argc, argv).Run(); 585 int retval = base::TestSuite(argc, argv).Run();
586 #endif 586 #endif
587 return retval; 587 return retval;
588 } 588 }
OLDNEW
« no previous file with comments | « ipc/ipc_sync_message.cc ('k') | ipc/param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698