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

Side by Side Diff: chrome/browser/printing/page_overlays_unittest.cc

Issue 60118: Implement Printer Preference Persistence (Step 1/3) (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « chrome/browser/printing/page_overlays.cc ('k') | chrome/common/pref_names.h » ('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-2008 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/string_util.h" 6 #include "base/string_util.h"
7 #include "chrome/browser/printing/page_overlays.h" 7 #include "chrome/browser/printing/page_overlays.h"
8 #include "chrome/browser/printing/print_settings.h" 8 #include "chrome/browser/printing/print_settings.h"
9 #include "chrome/browser/printing/printed_document.h" 9 #include "chrome/browser/printing/printed_document.h"
10 #include "chrome/browser/printing/printed_page.h" 10 #include "chrome/browser/printing/printed_page.h"
11 #include "chrome/browser/printing/printed_pages_source.h" 11 #include "chrome/browser/printing/printed_pages_source.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 for (int i = 0; i < arraysize(kOverlayKeys); ++i) { 66 for (int i = 0; i < arraysize(kOverlayKeys); ++i) {
67 input = StringPrintf(L"foo%lsbar", kOverlayKeys[i].key); 67 input = StringPrintf(L"foo%lsbar", kOverlayKeys[i].key);
68 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(), 68 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(),
69 *page.get()); 69 *page.get());
70 EXPECT_FALSE(out.empty()); 70 EXPECT_FALSE(out.empty());
71 if (wcslen(kOverlayKeys[i].expected) == 0) 71 if (wcslen(kOverlayKeys[i].expected) == 0)
72 continue; 72 continue;
73 EXPECT_EQ(StringPrintf(L"foo%lsbar", kOverlayKeys[i].expected), out) << 73 EXPECT_EQ(StringPrintf(L"foo%lsbar", kOverlayKeys[i].expected), out) <<
74 kOverlayKeys[i].key; 74 kOverlayKeys[i].key;
75 } 75 }
76
77 // Check if SetOverlay really sets the page overlay.
78 overlays.SetOverlay(printing::PageOverlays::LEFT,
79 printing::PageOverlays::TOP,
80 UTF16ToWide(L"Page {page}"));
81 input = overlays.GetOverlay(printing::PageOverlays::LEFT,
82 printing::PageOverlays::TOP);
83 EXPECT_EQ(input, L"Page {page}");
84
85 // Replace the variables to see if the page number is correct.
86 out = printing::PageOverlays::ReplaceVariables(input, *doc.get(),
87 *page.get());
88 EXPECT_EQ(out, L"Page 1");
76 } 89 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/page_overlays.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698