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

Side by Side Diff: chrome/browser/net/quoted_printable_unittest.cc

Issue 6691024: One more fix for gcc-4.5 compile missed in r80277 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 | « no previous file | 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 (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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "chrome/browser/net/quoted_printable.h" 6 #include "chrome/browser/net/quoted_printable.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 } 176 }
177 177
178 TEST(QuotedPrintableTest, Decode) { 178 TEST(QuotedPrintableTest, Decode) {
179 ASSERT_EQ(arraysize(kNormalText), arraysize(kEncodedText)); 179 ASSERT_EQ(arraysize(kNormalText), arraysize(kEncodedText));
180 for (size_t i = 0; i < arraysize(kNormalText); ++i) { 180 for (size_t i = 0; i < arraysize(kNormalText); ++i) {
181 std::string output; 181 std::string output;
182 EXPECT_TRUE(chrome::browser::net::QuotedPrintableDecode( 182 EXPECT_TRUE(chrome::browser::net::QuotedPrintableDecode(
183 kEncodedText[i], &output)); 183 kEncodedText[i], &output));
184 std::string expected(kNormalText[i]); 184 std::string expected(kNormalText[i]);
185 SCOPED_TRACE(::testing::Message::Message() << "Iteration " << i << 185 SCOPED_TRACE(::testing::Message() << "Iteration " << i <<
186 "\n Actual=\n" << output << "\n Expected=\n" << 186 "\n Actual=\n" << output << "\n Expected=\n" <<
187 expected); 187 expected);
188 // We cannot test for equality as EOLs won't match the normal text 188 // We cannot test for equality as EOLs won't match the normal text
189 // (as any EOL is converted to a CRLF during encoding). 189 // (as any EOL is converted to a CRLF during encoding).
190 EXPECT_TRUE(CompareEOLInsensitive(expected, output)); 190 EXPECT_TRUE(CompareEOLInsensitive(expected, output));
191 } 191 }
192 } 192 }
193 193
194 // Tests that we return false but still do our best to decode badly encoded 194 // Tests that we return false but still do our best to decode badly encoded
195 // inputs. 195 // inputs.
196 TEST(QuotedPrintableTest, DecodeBadInput) { 196 TEST(QuotedPrintableTest, DecodeBadInput) {
197 ASSERT_EQ(arraysize(kBadEncodedText), arraysize(kBadEncodedTextDecoded)); 197 ASSERT_EQ(arraysize(kBadEncodedText), arraysize(kBadEncodedTextDecoded));
198 for (size_t i = 0; i < arraysize(kBadEncodedText); ++i) { 198 for (size_t i = 0; i < arraysize(kBadEncodedText); ++i) {
199 SCOPED_TRACE(::testing::Message::Message() << "Iteration " << i); 199 SCOPED_TRACE(::testing::Message() << "Iteration " << i);
200 std::string output; 200 std::string output;
201 EXPECT_FALSE(chrome::browser::net::QuotedPrintableDecode( 201 EXPECT_FALSE(chrome::browser::net::QuotedPrintableDecode(
202 kBadEncodedText[i], &output)); 202 kBadEncodedText[i], &output));
203 std::string expected(kBadEncodedTextDecoded[i]); 203 std::string expected(kBadEncodedTextDecoded[i]);
204 EXPECT_EQ(expected, output); 204 EXPECT_EQ(expected, output);
205 } 205 }
206 } 206 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698