Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: printing/printing_utils_unittest.cc

Issue 1212883003: Include user email into document title before spooling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tue Jul 7 10:19:02 PDT 2015 Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/printing_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printing_utils_unittest.cc
diff --git a/printing/printing_utils_unittest.cc b/printing/printing_utils_unittest.cc
index be66fab83c8742b5a53eef5d7a4d627bb876c4f0..331451d6b16c2852ed7f619f5ffb090c0e9353f6 100644
--- a/printing/printing_utils_unittest.cc
+++ b/printing/printing_utils_unittest.cc
@@ -8,18 +8,38 @@
namespace printing {
-std::string Simplify(const char* title) {
- return base::UTF16ToUTF8(SimplifyDocumentTitle(base::ASCIIToUTF16(title)));
+namespace {
+
+const size_t kTestLength = 8;
+
+std::string Simplify(const std::string& title) {
+ return base::UTF16ToUTF8(
+ SimplifyDocumentTitleWithLength(base::UTF8ToUTF16(title), kTestLength));
+}
+
+std::string Format(const std::string& owner, const std::string& title) {
+ return base::UTF16ToUTF8(FormatDocumentTitleWithOwnerAndLength(
+ base::UTF8ToUTF16(owner), base::UTF8ToUTF16(title), kTestLength));
}
+} // namespace
+
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());
+ EXPECT_EQ("", Simplify(""));
+ EXPECT_EQ("abcdefgh", Simplify("abcdefgh"));
+ EXPECT_EQ("abc...ij", Simplify("abcdefghij"));
+ EXPECT_EQ("Controls", Simplify("C\ron\nt\15rols"));
+ EXPECT_EQ("", Simplify("\n\r\n\r\t\r"));
+}
+
+TEST(PrintingUtilsTest, FormatDocumentTitleWithOwner) {
+ EXPECT_EQ(": ", Format("", ""));
+ EXPECT_EQ("abc: ", Format("abc", ""));
+ EXPECT_EQ(": 123", Format("", "123"));
+ EXPECT_EQ("abc: 123", Format("abc", "123"));
+ EXPECT_EQ("abc: 0.9", Format("abc", "0123456789"));
+ EXPECT_EQ("ab...j: ", Format("abcdefghij", "123"));
+ EXPECT_EQ("ab...j: ", Format("abcdefghij", "0123456789"));
}
} // namespace printing
« no previous file with comments | « printing/printing_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698