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

Side by Side Diff: chrome/utility/media_galleries/pmp_column_reader_unittest.cc

Issue 377683002: Fixes for re-enabling more MSVC level 4 warnings: chrome/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « chrome/test/chromedriver/session_commands.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0); 133 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0);
134 EXPECT_TRUE(InitColumnReaderFromBytes(&reader_good_header, 134 EXPECT_TRUE(InitColumnReaderFromBytes(&reader_good_header,
135 good_header, 135 good_header,
136 PMP_TYPE_STRING)); 136 PMP_TYPE_STRING));
137 EXPECT_EQ(0U, reader_good_header.rows_read()) << 137 EXPECT_EQ(0U, reader_good_header.rows_read()) <<
138 "Read non-zero rows from header-only data."; 138 "Read non-zero rows from header-only data.";
139 139
140 PmpColumnReader reader_bad_magic_bytes; 140 PmpColumnReader reader_bad_magic_bytes;
141 std::vector<char> bad_magic_bytes = 141 std::vector<char> bad_magic_bytes =
142 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0); 142 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0);
143 bad_magic_bytes[0] = (char)0xff; 143 bad_magic_bytes[0] = static_cast<char>(-128);
Peter Kasting 2014/07/07 20:55:46 0xff is considered by the compiler to be a positiv
144 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_bad_magic_bytes, 144 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_bad_magic_bytes,
145 bad_magic_bytes, 145 bad_magic_bytes,
146 PMP_TYPE_STRING)); 146 PMP_TYPE_STRING));
147 147
148 PmpColumnReader reader_inconsistent_types; 148 PmpColumnReader reader_inconsistent_types;
149 std::vector<char> inconsistent_type = 149 std::vector<char> inconsistent_type =
150 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0); 150 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0);
151 inconsistent_type[kPmpFieldType1Offset] = (char)0xff; 151 inconsistent_type[kPmpFieldType1Offset] = static_cast<char>(-128);
152 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_inconsistent_types, 152 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_inconsistent_types,
153 inconsistent_type, 153 inconsistent_type,
154 PMP_TYPE_STRING)); 154 PMP_TYPE_STRING));
155 155
156 PmpColumnReader reader_invalid_type; 156 PmpColumnReader reader_invalid_type;
157 std::vector<char> invalid_type = 157 std::vector<char> invalid_type =
158 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0); 158 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0);
159 invalid_type[kPmpFieldType1Offset] = (char)0xff; 159 invalid_type[kPmpFieldType1Offset] = static_cast<char>(-128);
160 invalid_type[kPmpFieldType2Offset] = (char)0xff; 160 invalid_type[kPmpFieldType2Offset] = static_cast<char>(-128);
161 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_invalid_type, 161 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_invalid_type,
162 invalid_type, 162 invalid_type,
163 PMP_TYPE_STRING)); 163 PMP_TYPE_STRING));
164 164
165 PmpColumnReader reader_incomplete_header; 165 PmpColumnReader reader_incomplete_header;
166 std::vector<char> incomplete_header = 166 std::vector<char> incomplete_header =
167 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0); 167 PmpTestUtil::MakeHeader(PMP_TYPE_STRING, 0);
168 incomplete_header.resize(10); 168 incomplete_header.resize(10);
169 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_incomplete_header, 169 EXPECT_FALSE(InitColumnReaderFromBytes(&reader_incomplete_header,
170 incomplete_header, 170 incomplete_header,
(...skipping 25 matching lines...) Expand all
196 TEST(PmpColumnReaderTest, PrimitiveParsing) { 196 TEST(PmpColumnReaderTest, PrimitiveParsing) {
197 TestPrimitive<uint32>(PMP_TYPE_UINT32); 197 TestPrimitive<uint32>(PMP_TYPE_UINT32);
198 TestPrimitive<double>(PMP_TYPE_DOUBLE64); 198 TestPrimitive<double>(PMP_TYPE_DOUBLE64);
199 TestPrimitive<uint8>(PMP_TYPE_UINT8); 199 TestPrimitive<uint8>(PMP_TYPE_UINT8);
200 TestPrimitive<uint64>(PMP_TYPE_UINT64); 200 TestPrimitive<uint64>(PMP_TYPE_UINT64);
201 } 201 }
202 202
203 } // namespace 203 } // namespace
204 204
205 } // namespace picasa 205 } // namespace picasa
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/session_commands.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698