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

Side by Side Diff: printing/page_overlays_unittest.cc

Issue 7016011: iwyu: Include stringprintf.h where appropriate, part 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix. Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/flip_server/balsa_headers.cc ('k') | remoting/jingle_glue/iq_request_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/string16.h" 6 #include "base/string16.h"
7 #include "base/string_util.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "printing/page_overlays.h" 9 #include "printing/page_overlays.h"
10 #include "printing/print_settings.h" 10 #include "printing/print_settings.h"
11 #include "printing/printed_document.h" 11 #include "printing/printed_document.h"
12 #include "printing/printed_page.h" 12 #include "printing/printed_page.h"
13 #include "printing/printed_pages_source.h" 13 #include "printing/printed_pages_source.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace { 16 namespace {
17 17
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 new printing::PrintedDocument(settings, &source, cookie)); 59 new printing::PrintedDocument(settings, &source, cookie));
60 doc->set_page_count(2); 60 doc->set_page_count(2);
61 gfx::Size page_size(100, 100); 61 gfx::Size page_size(100, 100);
62 gfx::Rect page_content_area(5, 5, 90, 90); 62 gfx::Rect page_content_area(5, 5, 90, 90);
63 scoped_refptr<printing::PrintedPage> page( 63 scoped_refptr<printing::PrintedPage> page(
64 new printing::PrintedPage(1, NULL, page_size, page_content_area, true)); 64 new printing::PrintedPage(1, NULL, page_size, page_content_area, true));
65 65
66 std::wstring input; 66 std::wstring input;
67 std::wstring out; 67 std::wstring out;
68 for (size_t i = 0; i < arraysize(kOverlayKeys); ++i) { 68 for (size_t i = 0; i < arraysize(kOverlayKeys); ++i) {
69 input = StringPrintf(L"foo%lsbar", kOverlayKeys[i].key); 69 input = base::StringPrintf(L"foo%lsbar", kOverlayKeys[i].key);
70 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(), 70 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(),
71 *page.get()); 71 *page.get());
72 EXPECT_FALSE(out.empty()); 72 EXPECT_FALSE(out.empty());
73 if (wcslen(kOverlayKeys[i].expected) == 0) 73 if (wcslen(kOverlayKeys[i].expected) == 0)
74 continue; 74 continue;
75 std::wstring expected = StringPrintf(L"foo%lsbar", 75 std::wstring expected =
76 kOverlayKeys[i].expected); 76 base::StringPrintf(L"foo%lsbar", kOverlayKeys[i].expected);
77 EXPECT_EQ(expected, out) << kOverlayKeys[i].key; 77 EXPECT_EQ(expected, out) << kOverlayKeys[i].key;
78 } 78 }
79 79
80 // Check if SetOverlay really sets the page overlay. 80 // Check if SetOverlay really sets the page overlay.
81 overlays.SetOverlay(printing::PageOverlays::LEFT, 81 overlays.SetOverlay(printing::PageOverlays::LEFT,
82 printing::PageOverlays::TOP, 82 printing::PageOverlays::TOP,
83 L"Page {page}"); 83 L"Page {page}");
84 input = overlays.GetOverlay(printing::PageOverlays::LEFT, 84 input = overlays.GetOverlay(printing::PageOverlays::LEFT,
85 printing::PageOverlays::TOP); 85 printing::PageOverlays::TOP);
86 EXPECT_EQ(input, L"Page {page}"); 86 EXPECT_EQ(input, L"Page {page}");
87 87
88 // Replace the variables to see if the page number is correct. 88 // Replace the variables to see if the page number is correct.
89 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(), 89 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(),
90 *page.get()); 90 *page.get());
91 EXPECT_EQ(out, L"Page 1"); 91 EXPECT_EQ(out, L"Page 1");
92 } 92 }
OLDNEW
« no previous file with comments | « net/tools/flip_server/balsa_headers.cc ('k') | remoting/jingle_glue/iq_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698