| OLD | NEW |
| 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 #include "content/public/test/test_renderer_host.h" | 5 #include "content/public/test/test_renderer_host.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_view_host_factory.h" | 7 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
| 9 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/browser/web_contents/navigation_entry_impl.h" | 11 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 11 #include "content/browser/web_contents/test_web_contents.h" | 12 #include "content/browser/web_contents/test_web_contents.h" |
| 12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/test/mock_render_process_host.h" | 14 #include "content/public/test/mock_render_process_host.h" |
| 14 #include "content/public/test/test_browser_context.h" | 15 #include "content/public/test/test_browser_context.h" |
| 15 #include "content/test/test_render_view_host_factory.h" | 16 #include "content/test/test_render_view_host_factory.h" |
| 16 | 17 |
| 17 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 44 bool RenderViewHostTester::IsRenderViewHostSwappedOut(RenderViewHost* rvh) { | 45 bool RenderViewHostTester::IsRenderViewHostSwappedOut(RenderViewHost* rvh) { |
| 45 return static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out(); | 46 return static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 // static | 49 // static |
| 49 bool RenderViewHostTester::TestOnMessageReceived(RenderViewHost* rvh, | 50 bool RenderViewHostTester::TestOnMessageReceived(RenderViewHost* rvh, |
| 50 const IPC::Message& msg) { | 51 const IPC::Message& msg) { |
| 51 return static_cast<RenderViewHostImpl*>(rvh)->OnMessageReceived(msg); | 52 return static_cast<RenderViewHostImpl*>(rvh)->OnMessageReceived(msg); |
| 52 } | 53 } |
| 53 | 54 |
| 55 // static |
| 56 bool RenderViewHostTester::HasTouchEventHandler(RenderViewHost* rvh) { |
| 57 RenderWidgetHostImpl* host_impl = RenderWidgetHostImpl::From(rvh); |
| 58 return host_impl->has_touch_handler(); |
| 59 } |
| 60 |
| 54 RenderViewHostTestEnabler::RenderViewHostTestEnabler() | 61 RenderViewHostTestEnabler::RenderViewHostTestEnabler() |
| 55 : rph_factory_(new MockRenderProcessHostFactory()), | 62 : rph_factory_(new MockRenderProcessHostFactory()), |
| 56 rvh_factory_(new TestRenderViewHostFactory(rph_factory_.get())) { | 63 rvh_factory_(new TestRenderViewHostFactory(rph_factory_.get())) { |
| 57 } | 64 } |
| 58 | 65 |
| 59 RenderViewHostTestEnabler::~RenderViewHostTestEnabler() { | 66 RenderViewHostTestEnabler::~RenderViewHostTestEnabler() { |
| 60 } | 67 } |
| 61 | 68 |
| 62 RenderViewHostTestHarness::RenderViewHostTestHarness() | 69 RenderViewHostTestHarness::RenderViewHostTestHarness() |
| 63 : contents_(NULL) { | 70 : contents_(NULL) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 154 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 148 message_loop_.RunAllPending(); | 155 message_loop_.RunAllPending(); |
| 149 } | 156 } |
| 150 | 157 |
| 151 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 158 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 152 RenderProcessHostFactory* factory) { | 159 RenderProcessHostFactory* factory) { |
| 153 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 160 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 154 } | 161 } |
| 155 | 162 |
| 156 } // namespace content | 163 } // namespace content |
| OLD | NEW |