OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/mock_render_thread.h" | 5 #include "chrome/renderer/mock_render_thread.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
12 #include "chrome/common/render_messages_params.h" | 12 #include "chrome/common/render_messages_params.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "ipc/ipc_message_utils.h" | 14 #include "ipc/ipc_message_utils.h" |
15 #include "ipc/ipc_sync_message.h" | 15 #include "ipc/ipc_sync_message.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 MockRenderThread::MockRenderThread() | 18 MockRenderThread::MockRenderThread() |
19 : routing_id_(0), | 19 : routing_id_(0), |
20 opener_id_(0), | 20 opener_id_(0), |
21 widget_(NULL), | 21 widget_(NULL), |
22 reply_deserializer_(NULL), | 22 reply_deserializer_(NULL), |
23 printer_(new MockPrinter), | 23 printer_(new MockPrinter), |
24 is_extension_process_(false) { | 24 is_extension_process_(false) { |
25 } | 25 } |
26 | 26 |
27 MockRenderThread::~MockRenderThread() { | 27 MockRenderThread::~MockRenderThread() { |
28 } | 28 } |
29 | 29 |
| 30 const ExtensionRendererInfo* MockRenderThread::GetExtensions() const { |
| 31 return &extensions_; |
| 32 } |
| 33 |
30 // Called by the Widget. The routing_id must match the routing id assigned | 34 // Called by the Widget. The routing_id must match the routing id assigned |
31 // to the Widget in reply to ViewHostMsg_CreateWidget message. | 35 // to the Widget in reply to ViewHostMsg_CreateWidget message. |
32 void MockRenderThread::AddRoute(int32 routing_id, | 36 void MockRenderThread::AddRoute(int32 routing_id, |
33 IPC::Channel::Listener* listener) { | 37 IPC::Channel::Listener* listener) { |
34 EXPECT_EQ(routing_id_, routing_id); | 38 EXPECT_EQ(routing_id_, routing_id); |
35 widget_ = listener; | 39 widget_ = listener; |
36 } | 40 } |
37 | 41 |
38 // Called by the Widget. The routing id must match the routing id of AddRoute. | 42 // Called by the Widget. The routing id must match the routing id of AddRoute. |
39 void MockRenderThread::RemoveRoute(int32 routing_id) { | 43 void MockRenderThread::RemoveRoute(int32 routing_id) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void MockRenderThread::OnDidGetPrintedPagesCount(int cookie, int number_pages) { | 200 void MockRenderThread::OnDidGetPrintedPagesCount(int cookie, int number_pages) { |
197 if (printer_.get()) | 201 if (printer_.get()) |
198 printer_->SetPrintedPagesCount(cookie, number_pages); | 202 printer_->SetPrintedPagesCount(cookie, number_pages); |
199 } | 203 } |
200 | 204 |
201 void MockRenderThread::OnDidPrintPage( | 205 void MockRenderThread::OnDidPrintPage( |
202 const ViewHostMsg_DidPrintPage_Params& params) { | 206 const ViewHostMsg_DidPrintPage_Params& params) { |
203 if (printer_.get()) | 207 if (printer_.get()) |
204 printer_->PrintPage(params); | 208 printer_->PrintPage(params); |
205 } | 209 } |
OLD | NEW |