summaryrefslogtreecommitdiffstats
path: root/printing/page_overlays_unittest.cc
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 13:57:10 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 13:57:10 +0000
commit60741b476f12d0a9a7a0adac446d1af75d1208af (patch)
tree97cf98a024b22840a7a0f1b3a0520cce8d919949 /printing/page_overlays_unittest.cc
parent12b38f6e0866c6a88f0724395ed8a60a8eaf1bd3 (diff)
downloadchromium_src-60741b476f12d0a9a7a0adac446d1af75d1208af.zip
chromium_src-60741b476f12d0a9a7a0adac446d1af75d1208af.tar.gz
chromium_src-60741b476f12d0a9a7a0adac446d1af75d1208af.tar.bz2
Fix printing project on linux.
Enable compilation of every files and fix tests. TEST=unit tests BUG=9847 Review URL: http://codereview.chromium.org/193086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/page_overlays_unittest.cc')
-rw-r--r--printing/page_overlays_unittest.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/printing/page_overlays_unittest.cc b/printing/page_overlays_unittest.cc
index ccdc15a..bad78de 100644
--- a/printing/page_overlays_unittest.cc
+++ b/printing/page_overlays_unittest.cc
@@ -13,24 +13,19 @@
namespace {
-class PageOverlaysTest : public testing::Test {
- private:
- MessageLoop message_loop_;
-};
-
struct Keys {
const wchar_t* key;
const wchar_t* expected;
};
const Keys kOverlayKeys[] = {
- printing::PageOverlays::kTitle, L"Foobar Document",
- printing::PageOverlays::kTime, L"",
- printing::PageOverlays::kDate, L"",
- printing::PageOverlays::kPage, L"1",
- printing::PageOverlays::kPageCount, L"2",
- printing::PageOverlays::kPageOnTotal, L"1/2",
- printing::PageOverlays::kUrl, L"http://www.perdu.com/",
+ { printing::PageOverlays::kTitle, L"Foobar Document" },
+ { printing::PageOverlays::kTime, L"" },
+ { printing::PageOverlays::kDate, L"" },
+ { printing::PageOverlays::kPage, L"1" },
+ { printing::PageOverlays::kPageCount, L"2" },
+ { printing::PageOverlays::kPageOnTotal, L"1/2" },
+ { printing::PageOverlays::kUrl, L"http://www.perdu.com/" },
};
class PagesSource : public printing::PrintedPagesSource {
@@ -40,12 +35,16 @@ class PagesSource : public printing::PrintedPagesSource {
}
virtual GURL RenderSourceUrl() {
- return GURL(L"http://www.perdu.com");
+ return GURL("http://www.perdu.com");
}
};
} // namespace
+class PageOverlaysTest : public testing::Test {
+ private:
+ MessageLoop message_loop_;
+};
TEST_F(PageOverlaysTest, StringConversion) {
printing::PageOverlays overlays;
@@ -63,21 +62,22 @@ TEST_F(PageOverlaysTest, StringConversion) {
std::wstring input;
std::wstring out;
- for (int i = 0; i < arraysize(kOverlayKeys); ++i) {
+ for (size_t i = 0; i < arraysize(kOverlayKeys); ++i) {
input = StringPrintf(L"foo%lsbar", kOverlayKeys[i].key);
out = printing::PageOverlays::ReplaceVariables(input, *doc.get(),
*page.get());
EXPECT_FALSE(out.empty());
if (wcslen(kOverlayKeys[i].expected) == 0)
continue;
- EXPECT_EQ(StringPrintf(L"foo%lsbar", kOverlayKeys[i].expected), out) <<
- kOverlayKeys[i].key;
+ std::wstring expected = StringPrintf(L"foo%lsbar",
+ kOverlayKeys[i].expected);
+ EXPECT_EQ(expected, out) << kOverlayKeys[i].key;
}
// Check if SetOverlay really sets the page overlay.
overlays.SetOverlay(printing::PageOverlays::LEFT,
printing::PageOverlays::TOP,
- UTF16ToWide(L"Page {page}"));
+ L"Page {page}");
input = overlays.GetOverlay(printing::PageOverlays::LEFT,
printing::PageOverlays::TOP);
EXPECT_EQ(input, L"Page {page}");