Index: printing/backend/print_backend_unittest.cc |
diff --git a/printing/backend/print_backend_unittest.cc b/printing/backend/print_backend_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c8016849fed00753a319ba2c019bfe7ae94110aa |
--- /dev/null |
+++ b/printing/backend/print_backend_unittest.cc |
@@ -0,0 +1,25 @@ |
+// Copyright (c) 2012 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 "printing/backend/print_backend.h" |
+#include "base/utf_string_conversions.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace printing { |
+ |
+std::string Simplify(const char* title) { |
+ return UTF16ToUTF8(PrintBackend::SimplifyDocumentTitle(ASCIIToUTF16(title))); |
+} |
+ |
+TEST(PrintBackendTest, SimplifyDocumentTitle) { |
+ EXPECT_STREQ("", Simplify("").c_str()); |
+ EXPECT_STREQ("Document wi...oooong name", |
+ Simplify("Document with very looooooooooong name").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 |
+ |