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

Side by Side Diff: base/big_endian_unittest.cc

Issue 145873006: ui/base/resource: Roll our own version of ReadBigEndian() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 | « base/big_endian.cc ('k') | chrome/utility/cloud_print/pwg_encoder.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/big_endian.h"
6
5 #include "base/strings/string_piece.h" 7 #include "base/strings/string_piece.h"
6 #include "net/base/big_endian.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace net { 10 namespace base {
10 11
11 TEST(BigEndianReaderTest, ReadsValues) { 12 TEST(BigEndianReaderTest, ReadsValues) {
12 char data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC }; 13 char data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC };
13 char buf[2]; 14 char buf[2];
14 uint8 u8; 15 uint8 u8;
15 uint16 u16; 16 uint16 u16;
16 uint32 u32; 17 uint32 u32;
17 base::StringPiece piece; 18 base::StringPiece piece;
18 BigEndianReader reader(data, sizeof(data)); 19 BigEndianReader reader(data, sizeof(data));
19 20
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 EXPECT_TRUE(writer.Skip(2)); 90 EXPECT_TRUE(writer.Skip(2));
90 // 1 left 91 // 1 left
91 EXPECT_FALSE(writer.WriteU16(u16)); 92 EXPECT_FALSE(writer.WriteU16(u16));
92 EXPECT_FALSE(writer.WriteBytes(buf, 2)); 93 EXPECT_FALSE(writer.WriteBytes(buf, 2));
93 EXPECT_TRUE(writer.Skip(1)); 94 EXPECT_TRUE(writer.Skip(1));
94 // 0 left 95 // 0 left
95 EXPECT_FALSE(writer.WriteU8(u8)); 96 EXPECT_FALSE(writer.WriteU8(u8));
96 EXPECT_EQ(0, writer.remaining()); 97 EXPECT_EQ(0, writer.remaining());
97 } 98 }
98 99
99 } // namespace net 100 } // namespace base
100
OLDNEW
« no previous file with comments | « base/big_endian.cc ('k') | chrome/utility/cloud_print/pwg_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698