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

Side by Side Diff: third_party/WebKit/Source/wtf/text/TextCodecLatin1Test.cpp

Issue 2700123003: DO NOT COMMIT: Results of running old (current) clang-format on Blink (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "wtf/text/TextCodecLatin1.h" 5 #include "wtf/text/TextCodecLatin1.h"
6 6
7 #include <memory>
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 #include "wtf/text/CString.h" 9 #include "wtf/text/CString.h"
9 #include "wtf/text/TextCodec.h" 10 #include "wtf/text/TextCodec.h"
10 #include "wtf/text/TextEncoding.h" 11 #include "wtf/text/TextEncoding.h"
11 #include "wtf/text/TextEncodingRegistry.h" 12 #include "wtf/text/TextEncodingRegistry.h"
12 #include <memory>
13 13
14 TEST(TextCodecLatin1Test, QuestionMarksAndSurrogates) { 14 TEST(TextCodecLatin1Test, QuestionMarksAndSurrogates) {
15 WTF::TextEncoding encoding("windows-1252"); 15 WTF::TextEncoding encoding("windows-1252");
16 std::unique_ptr<WTF::TextCodec> codec(newTextCodec(encoding)); 16 std::unique_ptr<WTF::TextCodec> codec(newTextCodec(encoding));
17 17
18 { 18 {
19 const LChar testCase[] = {0xd1, 0x16, 0x86}; 19 const LChar testCase[] = {0xd1, 0x16, 0x86};
20 size_t testCaseSize = WTF_ARRAY_LENGTH(testCase); 20 size_t testCaseSize = WTF_ARRAY_LENGTH(testCase);
21 CString result = codec->encode(testCase, testCaseSize, 21 CString result = codec->encode(testCase, testCaseSize,
22 WTF::QuestionMarksForUnencodables); 22 WTF::QuestionMarksForUnencodables);
23 EXPECT_STREQ("\xd1\x16?", result.data()); 23 EXPECT_STREQ("\xd1\x16?", result.data());
24 } 24 }
25 { 25 {
26 const UChar testCase[] = {0xd9f0, 0xdcd9}; 26 const UChar testCase[] = {0xd9f0, 0xdcd9};
27 size_t testCaseSize = WTF_ARRAY_LENGTH(testCase); 27 size_t testCaseSize = WTF_ARRAY_LENGTH(testCase);
28 CString result = codec->encode(testCase, testCaseSize, 28 CString result = codec->encode(testCase, testCaseSize,
29 WTF::QuestionMarksForUnencodables); 29 WTF::QuestionMarksForUnencodables);
30 EXPECT_STREQ("?", result.data()); 30 EXPECT_STREQ("?", result.data());
31 } 31 }
32 { 32 {
33 const UChar testCase[] = {0xd9f0, 0xdcd9, 0xd9f0, 0xdcd9}; 33 const UChar testCase[] = {0xd9f0, 0xdcd9, 0xd9f0, 0xdcd9};
34 size_t testCaseSize = WTF_ARRAY_LENGTH(testCase); 34 size_t testCaseSize = WTF_ARRAY_LENGTH(testCase);
35 CString result = codec->encode(testCase, testCaseSize, 35 CString result = codec->encode(testCase, testCaseSize,
36 WTF::QuestionMarksForUnencodables); 36 WTF::QuestionMarksForUnencodables);
37 EXPECT_STREQ("??", result.data()); 37 EXPECT_STREQ("??", result.data());
38 } 38 }
39 } 39 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp ('k') | third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698