| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "printing/printing_utils.h" | 8 #include "printing/printing_utils.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 base::UTF8ToUTF16(owner), base::UTF8ToUTF16(title), kTestLength)); | 24 base::UTF8ToUTF16(owner), base::UTF8ToUTF16(title), kTestLength)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 TEST(PrintingUtilsTest, SimplifyDocumentTitle) { | 29 TEST(PrintingUtilsTest, SimplifyDocumentTitle) { |
| 30 EXPECT_EQ("", Simplify("")); | 30 EXPECT_EQ("", Simplify("")); |
| 31 EXPECT_EQ("abcdefgh", Simplify("abcdefgh")); | 31 EXPECT_EQ("abcdefgh", Simplify("abcdefgh")); |
| 32 EXPECT_EQ("abc...ij", Simplify("abcdefghij")); | 32 EXPECT_EQ("abc...ij", Simplify("abcdefghij")); |
| 33 EXPECT_EQ("Controls", Simplify("C\ron\nt\15rols")); | 33 EXPECT_EQ("Controls", Simplify("C\ron\nt\15rols")); |
| 34 EXPECT_EQ("C:_foo_", Simplify("C:\\foo\\")); |
| 34 EXPECT_EQ("", Simplify("\n\r\n\r\t\r")); | 35 EXPECT_EQ("", Simplify("\n\r\n\r\t\r")); |
| 35 } | 36 } |
| 36 | 37 |
| 37 TEST(PrintingUtilsTest, FormatDocumentTitleWithOwner) { | 38 TEST(PrintingUtilsTest, FormatDocumentTitleWithOwner) { |
| 38 EXPECT_EQ(": ", Format("", "")); | 39 EXPECT_EQ(": ", Format("", "")); |
| 39 EXPECT_EQ("abc: ", Format("abc", "")); | 40 EXPECT_EQ("abc: ", Format("abc", "")); |
| 40 EXPECT_EQ(": 123", Format("", "123")); | 41 EXPECT_EQ(": 123", Format("", "123")); |
| 41 EXPECT_EQ("abc: 123", Format("abc", "123")); | 42 EXPECT_EQ("abc: 123", Format("abc", "123")); |
| 42 EXPECT_EQ("abc: 0.9", Format("abc", "0123456789")); | 43 EXPECT_EQ("abc: 0.9", Format("abc", "0123456789")); |
| 43 EXPECT_EQ("ab...j: ", Format("abcdefghij", "123")); | 44 EXPECT_EQ("ab...j: ", Format("abcdefghij", "123")); |
| 45 EXPECT_EQ("xyz: _.o", Format("xyz", "\\f\\oo")); |
| 44 EXPECT_EQ("ab...j: ", Format("abcdefghij", "0123456789")); | 46 EXPECT_EQ("ab...j: ", Format("abcdefghij", "0123456789")); |
| 45 } | 47 } |
| 46 | 48 |
| 47 } // namespace printing | 49 } // namespace printing |
| 48 | |
| OLD | NEW |