| Index: third_party/WebKit/Source/wtf/text/TextCodecICUTest.cpp
 | 
| diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICUTest.cpp b/third_party/WebKit/Source/wtf/text/TextCodecICUTest.cpp
 | 
| index be01823a2b42b50ee3bd2e2dfc66523159f743e5..bb3146f4592c9ec1ac40a5fa2553441a8107202d 100644
 | 
| --- a/third_party/WebKit/Source/wtf/text/TextCodecICUTest.cpp
 | 
| +++ b/third_party/WebKit/Source/wtf/text/TextCodecICUTest.cpp
 | 
| @@ -5,6 +5,7 @@
 | 
|  #include "wtf/text/TextCodecICU.h"
 | 
|  
 | 
|  #include "testing/gtest/include/gtest/gtest.h"
 | 
| +#include "wtf/Vector.h"
 | 
|  #include "wtf/text/CharacterNames.h"
 | 
|  
 | 
|  namespace WTF {
 | 
| @@ -19,4 +20,39 @@ TEST(TextCodecICUTest, IgnorableCodePoint) {
 | 
|        codec->encode(source.data(), source.size(), EntitiesForUnencodables);
 | 
|    EXPECT_STREQ("a‍", encoded.data());
 | 
|  }
 | 
| +
 | 
| +TEST(TextCodecICUTest, UTF32AndQuestionMarks) {
 | 
| +  Vector<String> aliases;
 | 
| +  Vector<CString> results;
 | 
| +
 | 
| +  const UChar poo[] = {0xd83d, 0xdca9};  // U+1F4A9 PILE OF POO
 | 
| +
 | 
| +  aliases.append("UTF-32");
 | 
| +  results.append("\xFF\xFE\x00\x00\xA9\xF4\x01\x00");
 | 
| +
 | 
| +  aliases.append("UTF-32LE");
 | 
| +  results.append("\xA9\xF4\x01\x00");
 | 
| +
 | 
| +  aliases.append("UTF-32BE");
 | 
| +  results.append("\x00\x01\xF4\xA9");
 | 
| +
 | 
| +  ASSERT_EQ(aliases.size(), results.size());
 | 
| +  for (unsigned i = 0; i < aliases.size(); ++i) {
 | 
| +    const String& alias = aliases[i];
 | 
| +    const CString& expected = results[i];
 | 
| +
 | 
| +    TextEncoding encoding(alias);
 | 
| +    std::unique_ptr<TextCodec> codec = TextCodecICU::create(encoding, nullptr);
 | 
| +    {
 | 
| +      const UChar* data = nullptr;
 | 
| +      CString encoded = codec->encode(data, 0, QuestionMarksForUnencodables);
 | 
| +      EXPECT_STREQ("", encoded.data());
 | 
| +    }
 | 
| +    {
 | 
| +      CString encoded = codec->encode(poo, WTF_ARRAY_LENGTH(poo),
 | 
| +                                      QuestionMarksForUnencodables);
 | 
| +      EXPECT_STREQ(expected.data(), encoded.data());
 | 
| +    }
 | 
| +  }
 | 
| +}
 | 
|  }
 | 
| 
 |