summaryrefslogtreecommitdiff
path: root/chromium/printing/printing_utils_unittest.cc
blob: 24a380d4436bee58eaf1cca6e7dd83430f31a388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/strings/utf_string_conversions.h"
#include "printing/printing_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace printing {

std::string Simplify(const char* title) {
  return UTF16ToUTF8(SimplifyDocumentTitle(ASCIIToUTF16(title)));
}

TEST(PrintingUtilsTest, SimplifyDocumentTitle) {
  EXPECT_STREQ("", Simplify("").c_str());
  EXPECT_STREQ("Long string. Long string...ng string. Long string.",
               Simplify("Long string. Long string. Long string. Long string. "
                        "Long string. Long string. Long string.").c_str());
  EXPECT_STREQ("Control Characters",
               Simplify("C\ron\ntrol Charac\15ters").c_str());
  EXPECT_STREQ("", Simplify("\n\r\n\r\t\r").c_str());
}

}  // namespace printing