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

Side by Side Diff: printing/printing_test.h

Issue 1544623002: Switch to standard integer types in printing/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « printing/printing_context_win_unittest.cc ('k') | printing/printing_utils.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-2008 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 #ifndef CHROME_BROWSER_PRINTING_PRINTING_TEST_H__ 5 #ifndef CHROME_BROWSER_PRINTING_PRINTING_TEST_H__
6 #define CHROME_BROWSER_PRINTING_PRINTING_TEST_H__ 6 #define CHROME_BROWSER_PRINTING_PRINTING_TEST_H__
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <winspool.h> 9 #include <winspool.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/macros.h"
14 14
15 // Disable the whole test case when executing on a computer that has no printer 15 // Disable the whole test case when executing on a computer that has no printer
16 // installed. 16 // installed.
17 // Note: Parent should be testing::Test or InProcessBrowserTest. 17 // Note: Parent should be testing::Test or InProcessBrowserTest.
18 template<typename Parent> 18 template<typename Parent>
19 class PrintingTest : public Parent { 19 class PrintingTest : public Parent {
20 public: 20 public:
21 static bool IsTestCaseDisabled() { 21 static bool IsTestCaseDisabled() {
22 return GetDefaultPrinter().empty(); 22 return GetDefaultPrinter().empty();
23 } 23 }
24 static std::wstring GetDefaultPrinter() { 24 static std::wstring GetDefaultPrinter() {
25 wchar_t printer_name[MAX_PATH]; 25 wchar_t printer_name[MAX_PATH];
26 DWORD size = arraysize(printer_name); 26 DWORD size = arraysize(printer_name);
27 BOOL result = ::GetDefaultPrinter(printer_name, &size); 27 BOOL result = ::GetDefaultPrinter(printer_name, &size);
28 if (result == 0) { 28 if (result == 0) {
29 if (GetLastError() == ERROR_FILE_NOT_FOUND) { 29 if (GetLastError() == ERROR_FILE_NOT_FOUND) {
30 printf("There is no printer installed, printing can't be tested!\n"); 30 printf("There is no printer installed, printing can't be tested!\n");
31 return std::wstring(); 31 return std::wstring();
32 } 32 }
33 printf("INTERNAL PRINTER ERROR!\n"); 33 printf("INTERNAL PRINTER ERROR!\n");
34 return std::wstring(); 34 return std::wstring();
35 } 35 }
36 return printer_name; 36 return printer_name;
37 } 37 }
38 }; 38 };
39 39
40 #endif // CHROME_BROWSER_PRINTING_PRINTING_TEST_H__ 40 #endif // CHROME_BROWSER_PRINTING_PRINTING_TEST_H__
OLDNEW
« no previous file with comments | « printing/printing_context_win_unittest.cc ('k') | printing/printing_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698