OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "printing/printing_utils.h" | 6 #include "printing/printing_utils.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace printing { | 9 namespace printing { |
10 | 10 |
11 std::string Simplify(const char* title) { | 11 std::string Simplify(const char* title) { |
12 return base::UTF16ToUTF8(SimplifyDocumentTitle(base::ASCIIToUTF16(title))); | 12 return base::UTF16ToUTF8( |
| 13 SimplifyDocumentTitleWithLength(base::ASCIIToUTF16(title), 50)); |
13 } | 14 } |
14 | 15 |
15 TEST(PrintingUtilsTest, SimplifyDocumentTitle) { | 16 TEST(PrintingUtilsTest, SimplifyDocumentTitle) { |
16 EXPECT_STREQ("", Simplify("").c_str()); | 17 EXPECT_STREQ("", Simplify("").c_str()); |
17 EXPECT_STREQ("Long string. Long string...ng string. Long string.", | 18 EXPECT_STREQ("Long string. Long string...ng string. Long string.", |
18 Simplify("Long string. Long string. Long string. Long string. " | 19 Simplify("Long string. Long string. Long string. Long string. " |
19 "Long string. Long string. Long string.").c_str()); | 20 "Long string. Long string. Long string.").c_str()); |
20 EXPECT_STREQ("Control Characters", | 21 EXPECT_STREQ("Control Characters", |
21 Simplify("C\ron\ntrol Charac\15ters").c_str()); | 22 Simplify("C\ron\ntrol Charac\15ters").c_str()); |
22 EXPECT_STREQ("", Simplify("\n\r\n\r\t\r").c_str()); | 23 EXPECT_STREQ("", Simplify("\n\r\n\r\t\r").c_str()); |
23 } | 24 } |
24 | 25 |
25 } // namespace printing | 26 } // namespace printing |
26 | 27 |
OLD | NEW |