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

Side by Side Diff: chrome/renderer/chrome_mock_render_thread.h

Issue 8230034: Split most of RenderViewTest and associated classes into content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build breaks. Created 9 years, 2 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) 2011 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_RENDERER_CHROME_MOCK_RENDER_THREAD_H_
6 #define CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "chrome/common/extensions/extension_set.h"
13 #include "chrome/renderer/mock_printer.h"
14 #include "content/test/mock_render_thread.h"
15
16 namespace base {
17 class DictionaryValue;
18 }
19
20 struct PrintHostMsg_DidGetPreviewPageCount_Params;
21 struct PrintHostMsg_DidPreviewPage_Params;
22 struct PrintHostMsg_ScriptedPrint_Params;
23 struct PrintMsg_PrintPages_Params;
24 struct PrintMsg_Print_Params;
25
26 // Extends content::MockRenderThread to know about printing and
27 // extension messages.
28 class ChromeMockRenderThread : public content::MockRenderThread {
29 public:
30 ChromeMockRenderThread();
31 virtual ~ChromeMockRenderThread();
32
33 //////////////////////////////////////////////////////////////////////////
34 // The following functions are called by the test itself.
35
36 // Returns the pseudo-printer instance.
37 MockPrinter* printer() const { return printer_.get(); }
38
39 // Call with |response| set to true if the user wants to print.
40 // False if the user decides to cancel.
41 void set_print_dialog_user_response(bool response);
42
43 // Cancel print preview when print preview has |page| remaining pages.
44 void set_print_preview_cancel_page_number(int page);
45
46 // Get the number of pages to generate for print preview.
47 int print_preview_pages_remaining();
48
49 private:
50 // Overrides base class implementation to add custom handling for
51 // print and extensions.
52 virtual bool OnMessageReceived(const IPC::Message& msg);
53
54 // The callee expects to be returned a valid channel_id.
55 void OnMsgOpenChannelToExtension(
56 int routing_id, const std::string& extension_id,
57 const std::string& source_extension_id,
58 const std::string& target_extension_id, int* port_id);
59
60 #if defined(OS_CHROMEOS)
61 void OnAllocateTempFileForPrinting(base::FileDescriptor* renderer_fd,
62 int* browser_fd);
63 void OnTempFileForPrintingWritten(int browser_fd);
64 #endif
65
66 // PrintWebViewHelper expects default print settings.
67 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting);
68
69 // PrintWebViewHelper expects final print settings from the user.
70 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params,
71 PrintMsg_PrintPages_Params* settings);
72
73 void OnDidGetPrintedPagesCount(int cookie, int number_pages);
74 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params);
75 void OnDidGetPreviewPageCount(
76 const PrintHostMsg_DidGetPreviewPageCount_Params& params);
77 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params);
78 void OnCheckForCancel(const std::string& preview_ui_addr,
79 int preview_request_id,
80 bool* cancel);
81
82
83 // For print preview, PrintWebViewHelper will update settings.
84 void OnUpdatePrintSettings(int document_cookie,
85 const base::DictionaryValue& job_settings,
86 PrintMsg_PrintPages_Params* params);
87
88 // A mock printer device used for printing tests.
89 scoped_ptr<MockPrinter> printer_;
90
91 // True to simulate user clicking print. False to cancel.
92 bool print_dialog_user_response_;
93
94 // Simulates cancelling print preview if |print_preview_pages_remaining_|
95 // equals this.
96 int print_preview_cancel_page_number_;
97
98 // Number of pages to generate for print preview.
99 int print_preview_pages_remaining_;
100 };
101
102 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/password_autofill_manager_browsertest.cc ('k') | chrome/renderer/chrome_mock_render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698