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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_ui.h

Issue 383623002: Add a browser test that can communicate with the layout test framework and print pdfs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added the keyword 'virtual' to overriden functions for combatibility with clang. Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
14 14
15 class PrintPreviewDataService; 15 class PrintPreviewDataService;
16 class PrintPreviewHandler; 16 class PrintPreviewHandler;
17 struct PrintHostMsg_DidGetPreviewPageCount_Params; 17 struct PrintHostMsg_DidGetPreviewPageCount_Params;
18 struct PrintHostMsg_RequestPrintPreview_Params; 18 struct PrintHostMsg_RequestPrintPreview_Params;
19 19
20 namespace base { 20 namespace base {
21 class FilePath;
21 class RefCountedBytes; 22 class RefCountedBytes;
22 } 23 }
23 24
24 namespace gfx { 25 namespace gfx {
25 class Rect; 26 class Rect;
26 } 27 }
27 28
28 namespace printing { 29 namespace printing {
29 struct PageSizeMargins; 30 struct PageSizeMargins;
30 } 31 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // also instructs the dialog to auto-cancel, which is used for testing only. 148 // also instructs the dialog to auto-cancel, which is used for testing only.
148 class TestingDelegate { 149 class TestingDelegate {
149 public: 150 public:
150 virtual bool IsAutoCancelEnabled() = 0; 151 virtual bool IsAutoCancelEnabled() = 0;
151 virtual void DidGetPreviewPageCount(int page_count) = 0; 152 virtual void DidGetPreviewPageCount(int page_count) = 0;
152 virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0; 153 virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) = 0;
153 }; 154 };
154 155
155 static void SetDelegateForTesting(TestingDelegate* delegate); 156 static void SetDelegateForTesting(TestingDelegate* delegate);
156 157
158 // Allows for tests to set a file path to print a PDF to. This also initiates
159 // the printing without having to click a button on the print preview dialog.
160 void SetSelectedFileForTesting(const base::FilePath& path);
161
157 private: 162 private:
158 friend class PrintPreviewHandlerTest; 163 friend class PrintPreviewHandlerTest;
159 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom); 164 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom);
160 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault); 165 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsDefault);
161 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, 166 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest,
162 StickyMarginsCustomThenDefault); 167 StickyMarginsCustomThenDefault);
163 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, 168 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest,
164 GetLastUsedMarginSettingsCustom); 169 GetLastUsedMarginSettingsCustom);
165 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, 170 FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest,
166 GetLastUsedMarginSettingsDefault); 171 GetLastUsedMarginSettingsDefault);
(...skipping 25 matching lines...) Expand all
192 // title. 197 // title.
193 base::string16 initiator_title_; 198 base::string16 initiator_title_;
194 199
195 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not. 200 // Keeps track of whether OnClosePrintPreviewDialog() has been called or not.
196 bool dialog_closed_; 201 bool dialog_closed_;
197 202
198 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI); 203 DISALLOW_COPY_AND_ASSIGN(PrintPreviewUI);
199 }; 204 };
200 205
201 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_ 206 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698