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

Unified Diff: webkit/glue/webcursor_unittest.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webcursor_mac.mm ('k') | webkit/glue/webcursor_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webcursor_unittest.cc
diff --git a/webkit/glue/webcursor_unittest.cc b/webkit/glue/webcursor_unittest.cc
index 00f2760caadcf5e61c1c11d79d798bfe7ab2dd97..830905bc5648ec50b51d41daf4cb4daa4bfa9019 100644
--- a/webkit/glue/webcursor_unittest.cc
+++ b/webkit/glue/webcursor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,8 +26,8 @@ TEST(WebCursorTest, OKCursorSerialization) {
ok_custom_pickle.WriteUInt32(0);
// Custom Windows message.
ok_custom_pickle.WriteUInt32(0);
- void* iter = NULL;
- EXPECT_TRUE(custom_cursor.Deserialize(&ok_custom_pickle, &iter));
+ PickleIterator iter(ok_custom_pickle);
+ EXPECT_TRUE(custom_cursor.Deserialize(&iter));
#if defined(TOOLKIT_USES_GTK)
// On GTK+ using platforms, we should get a real native GdkCursor object back
@@ -51,8 +51,8 @@ TEST(WebCursorTest, BrokenCursorSerialization) {
// Data len not including enough data for a 1x1 image.
short_custom_pickle.WriteInt(3);
short_custom_pickle.WriteUInt32(0);
- void* iter = NULL;
- EXPECT_FALSE(custom_cursor.Deserialize(&short_custom_pickle, &iter));
+ PickleIterator iter(short_custom_pickle);
+ EXPECT_FALSE(custom_cursor.Deserialize(&iter));
// This custom cursor has enough data but is too big.
Pickle large_custom_pickle;
@@ -68,8 +68,8 @@ TEST(WebCursorTest, BrokenCursorSerialization) {
large_custom_pickle.WriteInt(kTooBigSize * 4);
for (int i = 0; i < kTooBigSize; ++i)
large_custom_pickle.WriteUInt32(0);
- iter = NULL;
- EXPECT_FALSE(custom_cursor.Deserialize(&large_custom_pickle, &iter));
+ iter = PickleIterator(large_custom_pickle);
+ EXPECT_FALSE(custom_cursor.Deserialize(&iter));
// This custom cursor uses negative lengths.
Pickle neg_custom_pickle;
@@ -85,8 +85,8 @@ TEST(WebCursorTest, BrokenCursorSerialization) {
neg_custom_pickle.WriteUInt32(0);
// Custom Windows message.
neg_custom_pickle.WriteUInt32(0);
- iter = NULL;
- EXPECT_FALSE(custom_cursor.Deserialize(&neg_custom_pickle, &iter));
+ iter = PickleIterator(neg_custom_pickle);
+ EXPECT_FALSE(custom_cursor.Deserialize(&iter));
}
#if defined(OS_WIN)
@@ -97,8 +97,8 @@ TEST(WebCursorTest, WindowsCursorConversion) {
win32_custom_cursor.InitFromExternalCursor(
reinterpret_cast<HCURSOR>(1000));
EXPECT_TRUE(win32_custom_cursor.Serialize(&win32_custom_pickle));
- void* iter = NULL;
- EXPECT_TRUE(custom_cursor.Deserialize(&win32_custom_pickle, &iter));
+ PickleIterator iter(win32_custom_pickle);
+ EXPECT_TRUE(custom_cursor.Deserialize(&iter));
EXPECT_EQ(reinterpret_cast<HCURSOR>(1000), custom_cursor.GetCursor(NULL));
}
#endif // OS_WIN
@@ -121,8 +121,8 @@ TEST(WebCursorTest, ClampHotspot) {
ok_custom_pickle.WriteUInt32(0);
// Custom Windows message.
ok_custom_pickle.WriteUInt32(0);
- void* iter = NULL;
- ASSERT_TRUE(custom_cursor.Deserialize(&ok_custom_pickle, &iter));
+ PickleIterator iter(ok_custom_pickle);
+ ASSERT_TRUE(custom_cursor.Deserialize(&iter));
// Convert to WebCursorInfo, make sure the hotspot got clamped.
WebCursorInfo info;
@@ -154,8 +154,8 @@ TEST(WebCursorTest, EmptyImage) {
// Make sure we can read this on all platforms; it is technicaally a valid
// cursor.
- void* iter = NULL;
- ASSERT_TRUE(custom_cursor.Deserialize(&broken_cursor_pickle, &iter));
+ PickleIterator iter(broken_cursor_pickle);
+ ASSERT_TRUE(custom_cursor.Deserialize(&iter));
#if defined(TOOLKIT_USES_GTK)
// On GTK+ using platforms, we make sure that we get NULL back from this
« no previous file with comments | « webkit/glue/webcursor_mac.mm ('k') | webkit/glue/webcursor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698