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

Side by Side Diff: chrome/browser/printing/printing_test.h

Issue 149212: Move printing related stuff to the root printing project from the browser pro... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PRINTING_PRINTING_TEST_H__
6 #define CHROME_BROWSER_PRINTING_PRINTING_TEST_H__
7
8 #include <windows.h>
9 #include <winspool.h>
10
11 // Disable the whole test case when executing on a computer that has no printer
12 // installed.
13 // Note: Parent should be testing::Test or UITest.
14 template<typename Parent>
15 class PrintingTest : public Parent {
16 public:
17 static bool IsTestCaseDisabled() {
18 return GetDefaultPrinter().empty();
19 }
20 static std::wstring GetDefaultPrinter() {
21 wchar_t printer_name[MAX_PATH];
22 DWORD size = arraysize(printer_name);
23 BOOL result = ::GetDefaultPrinter(printer_name, &size);
24 if (result == 0) {
25 if (GetLastError() == ERROR_FILE_NOT_FOUND) {
26 printf("There is no printer installed, printing can't be tested!\n");
27 return std::wstring();
28 }
29 printf("INTERNAL PRINTER ERROR!\n");
30 return std::wstring();
31 }
32 return printer_name;
33 }
34 };
35
36 #endif // CHROME_BROWSER_PRINTING_PRINTING_TEST_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698