1f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/utf_string_conversions.h" 6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "printing/printing_utils.h" 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h" 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace printing { 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)std::string Simplify(const char* title) { 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return base::UTF16ToUTF8(SimplifyDocumentTitle(base::ASCIIToUTF16(title))); 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 15f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)TEST(PrintingUtilsTest, SimplifyDocumentTitle) { 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) EXPECT_STREQ("", Simplify("").c_str()); 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) EXPECT_STREQ("Long string. Long string...ng string. Long string.", 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Simplify("Long string. Long string. Long string. Long string. " 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) "Long string. Long string. Long string.").c_str()); 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) EXPECT_STREQ("Control Characters", 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Simplify("C\ron\ntrol Charac\15ters").c_str()); 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) EXPECT_STREQ("", Simplify("\n\r\n\r\t\r").c_str()); 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace printing 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 27