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

Unified Diff: net/spdy/spdy_frame_reader_test.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_frame_reader.cc ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_frame_reader_test.cc
diff --git a/net/spdy/spdy_frame_reader_test.cc b/net/spdy/spdy_frame_reader_test.cc
index 867d97c1788457be70c6e581144179ed8dd2fe5b..ca178de33f5aa89a3475294795b56233443e94ba 100644
--- a/net/spdy/spdy_frame_reader_test.cc
+++ b/net/spdy/spdy_frame_reader_test.cc
@@ -14,7 +14,7 @@ namespace net {
TEST(SpdyFrameReaderTest, ReadUInt16) {
// Frame data in network byte order.
- const uint16 kFrameData[] = {
+ const uint16_t kFrameData[] = {
base::HostToNet16(1), base::HostToNet16(1 << 15),
};
@@ -22,7 +22,7 @@ TEST(SpdyFrameReaderTest, ReadUInt16) {
sizeof(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_TRUE(frame_reader.ReadUInt16(&uint16_val));
EXPECT_FALSE(frame_reader.IsDoneReading());
EXPECT_EQ(1, uint16_val);
@@ -34,15 +34,15 @@ TEST(SpdyFrameReaderTest, ReadUInt16) {
TEST(SpdyFrameReaderTest, ReadUInt32) {
// Frame data in network byte order.
- const uint32 kFrameData[] = {
+ const uint32_t kFrameData[] = {
base::HostToNet32(1), base::HostToNet32(0x80000000),
};
- SpdyFrameReader frame_reader(reinterpret_cast<const char *>(kFrameData),
- arraysize(kFrameData) * sizeof(uint32));
+ SpdyFrameReader frame_reader(reinterpret_cast<const char*>(kFrameData),
+ arraysize(kFrameData) * sizeof(uint32_t));
EXPECT_FALSE(frame_reader.IsDoneReading());
- uint32 uint32_val;
+ uint32_t uint32_val;
EXPECT_TRUE(frame_reader.ReadUInt32(&uint32_val));
EXPECT_FALSE(frame_reader.IsDoneReading());
EXPECT_EQ(1u, uint32_val);
@@ -55,13 +55,11 @@ TEST(SpdyFrameReaderTest, ReadUInt32) {
TEST(SpdyFrameReaderTest, ReadStringPiece16) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, 0x02, // uint16(2)
- 0x48, 0x69, // "Hi"
- 0x00, 0x10, // uint16(16)
- 0x54, 0x65, 0x73, 0x74,
- 0x69, 0x6e, 0x67, 0x2c,
- 0x20, 0x31, 0x2c, 0x20,
- 0x32, 0x2c, 0x20, 0x33, // "Testing, 1, 2, 3"
+ 0x00, 0x02, // uint16_t(2)
+ 0x48, 0x69, // "Hi"
+ 0x00, 0x10, // uint16_t(16)
+ 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2c,
+ 0x20, 0x31, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x33, // "Testing, 1, 2, 3"
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
@@ -80,13 +78,11 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16) {
TEST(SpdyFrameReaderTest, ReadStringPiece32) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, 0x00, 0x00, 0x03, // uint32(3)
- 0x66, 0x6f, 0x6f, // "foo"
- 0x00, 0x00, 0x00, 0x10, // uint32(16)
- 0x54, 0x65, 0x73, 0x74,
- 0x69, 0x6e, 0x67, 0x2c,
- 0x20, 0x34, 0x2c, 0x20,
- 0x35, 0x2c, 0x20, 0x36, // "Testing, 4, 5, 6"
+ 0x00, 0x00, 0x00, 0x03, // uint32_t(3)
+ 0x66, 0x6f, 0x6f, // "foo"
+ 0x00, 0x00, 0x00, 0x10, // uint32_t(16)
+ 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2c,
+ 0x20, 0x34, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x36, // "Testing, 4, 5, 6"
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
@@ -105,31 +101,32 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32) {
TEST(SpdyFrameReaderTest, ReadUInt16WithBufferTooSmall) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, // part of a uint16
+ 0x00, // part of a uint16_t
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_FALSE(frame_reader.ReadUInt16(&uint16_val));
}
TEST(SpdyFrameReaderTest, ReadUInt32WithBufferTooSmall) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, 0x00, 0x00, // part of a uint32
+ 0x00, 0x00, 0x00, // part of a uint32_t
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- uint32 uint32_val;
+ uint32_t uint32_val;
EXPECT_FALSE(frame_reader.ReadUInt32(&uint32_val));
- // Also make sure that trying to read a uint16, which technically could work,
+ // Also make sure that trying to read a uint16_t, which technically could
+ // work,
// fails immediately due to previously encountered failed read.
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_FALSE(frame_reader.ReadUInt16(&uint16_val));
}
@@ -137,8 +134,8 @@ TEST(SpdyFrameReaderTest, ReadUInt32WithBufferTooSmall) {
TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferTooSmall) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, 0x03, // uint16(3)
- 0x48, 0x69, // "Hi"
+ 0x00, 0x03, // uint16_t(3)
+ 0x48, 0x69, // "Hi"
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
@@ -147,9 +144,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferTooSmall) {
base::StringPiece stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece16(&stringpiece_val));
- // Also make sure that trying to read a uint16, which technically could work,
+ // Also make sure that trying to read a uint16_t, which technically could
+ // work,
// fails immediately due to previously encountered failed read.
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_FALSE(frame_reader.ReadUInt16(&uint16_val));
}
@@ -157,7 +155,7 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferTooSmall) {
TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferWayTooSmall) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, // part of a uint16
+ 0x00, // part of a uint16_t
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
@@ -166,9 +164,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferWayTooSmall) {
base::StringPiece stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece16(&stringpiece_val));
- // Also make sure that trying to read a uint16, which technically could work,
+ // Also make sure that trying to read a uint16_t, which technically could
+ // work,
// fails immediately due to previously encountered failed read.
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_FALSE(frame_reader.ReadUInt16(&uint16_val));
}
@@ -176,8 +175,8 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferWayTooSmall) {
TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferTooSmall) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, 0x00, 0x00, 0x03, // uint32(3)
- 0x48, 0x69, // "Hi"
+ 0x00, 0x00, 0x00, 0x03, // uint32_t(3)
+ 0x48, 0x69, // "Hi"
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
@@ -186,9 +185,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferTooSmall) {
base::StringPiece stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece32(&stringpiece_val));
- // Also make sure that trying to read a uint16, which technically could work,
+ // Also make sure that trying to read a uint16_t, which technically could
+ // work,
// fails immediately due to previously encountered failed read.
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_FALSE(frame_reader.ReadUInt16(&uint16_val));
}
@@ -196,7 +196,7 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferTooSmall) {
TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferWayTooSmall) {
// Frame data in network byte order.
const char kFrameData[] = {
- 0x00, 0x00, 0x00, // part of a uint32
+ 0x00, 0x00, 0x00, // part of a uint32_t
};
SpdyFrameReader frame_reader(kFrameData, arraysize(kFrameData));
@@ -205,9 +205,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferWayTooSmall) {
base::StringPiece stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece32(&stringpiece_val));
- // Also make sure that trying to read a uint16, which technically could work,
+ // Also make sure that trying to read a uint16_t, which technically could
+ // work,
// fails immediately due to previously encountered failed read.
- uint16 uint16_val;
+ uint16_t uint16_val;
EXPECT_FALSE(frame_reader.ReadUInt16(&uint16_val));
}
« no previous file with comments | « net/spdy/spdy_frame_reader.cc ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698