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 #ifndef CONTENT_TEST_TEST_RENDERER_HOST_H_ | 5 #ifndef CONTENT_TEST_TEST_RENDERER_HOST_H_ |
6 #define CONTENT_TEST_TEST_RENDERER_HOST_H_ | 6 #define CONTENT_TEST_TEST_RENDERER_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 static RenderViewHost* GetPendingForController( | 50 static RenderViewHost* GetPendingForController( |
51 NavigationController* controller); | 51 NavigationController* controller); |
52 | 52 |
53 // This removes the need to expose | 53 // This removes the need to expose |
54 // RenderViewHostImpl::is_swapped_out() outside of content. | 54 // RenderViewHostImpl::is_swapped_out() outside of content. |
55 // | 55 // |
56 // This is safe to call on any RenderViewHost, not just ones | 56 // This is safe to call on any RenderViewHost, not just ones |
57 // constructed while a RenderViewHostTestEnabler is in play. | 57 // constructed while a RenderViewHostTestEnabler is in play. |
58 static bool IsRenderViewHostSwappedOut(RenderViewHost* rvh); | 58 static bool IsRenderViewHostSwappedOut(RenderViewHost* rvh); |
59 | 59 |
| 60 // Calls the RenderViewHosts' private OnMessageReceived function with the |
| 61 // given message. |
| 62 static bool TestOnMessageReceived(RenderViewHost* rvh, |
| 63 const IPC::Message& msg); |
| 64 |
60 virtual ~RenderViewHostTester() {} | 65 virtual ~RenderViewHostTester() {} |
61 | 66 |
62 // Gives tests access to RenderViewHostImpl::CreateRenderView. | 67 // Gives tests access to RenderViewHostImpl::CreateRenderView. |
63 virtual bool CreateRenderView(const string16& frame_name, | 68 virtual bool CreateRenderView(const string16& frame_name, |
64 int32 max_page_id) = 0; | 69 int32 max_page_id) = 0; |
65 | 70 |
66 // Calls OnMsgNavigate on the RenderViewHost with the given information, | 71 // Calls OnMsgNavigate on the RenderViewHost with the given information, |
67 // setting the rest of the parameters in the message to the "typical" values. | 72 // setting the rest of the parameters in the message to the "typical" values. |
68 // This is a helper function for simulating the most common types of loads. | 73 // This is a helper function for simulating the most common types of loads. |
69 virtual void SendNavigate(int page_id, const GURL& url) = 0; | 74 virtual void SendNavigate(int page_id, const GURL& url) = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
83 virtual void SetContentsMimeType(const std::string& mime_type) = 0; | 88 virtual void SetContentsMimeType(const std::string& mime_type) = 0; |
84 | 89 |
85 // Simulates the SwapOut_ACK that fires if you commit a cross-site | 90 // Simulates the SwapOut_ACK that fires if you commit a cross-site |
86 // navigation without making any network requests. | 91 // navigation without making any network requests. |
87 virtual void SimulateSwapOutACK() = 0; | 92 virtual void SimulateSwapOutACK() = 0; |
88 | 93 |
89 // Makes the WasHidden/WasRestored calls to the RenderWidget that | 94 // Makes the WasHidden/WasRestored calls to the RenderWidget that |
90 // tell it it has been hidden or restored from having been hidden. | 95 // tell it it has been hidden or restored from having been hidden. |
91 virtual void SimulateWasHidden() = 0; | 96 virtual void SimulateWasHidden() = 0; |
92 virtual void SimulateWasRestored() = 0; | 97 virtual void SimulateWasRestored() = 0; |
93 | |
94 // Calls the RenderViewHosts' private OnMessageReceived function with the | |
95 // given message. | |
96 virtual bool TestOnMessageReceived(const IPC::Message& msg) = 0; | |
97 }; | 98 }; |
98 | 99 |
99 // You can instantiate only one class like this at a time. During its | 100 // You can instantiate only one class like this at a time. During its |
100 // lifetime, RenderViewHost objects created may be used via | 101 // lifetime, RenderViewHost objects created may be used via |
101 // RenderViewHostTester. | 102 // RenderViewHostTester. |
102 class RenderViewHostTestEnabler { | 103 class RenderViewHostTestEnabler { |
103 public: | 104 public: |
104 RenderViewHostTestEnabler(); | 105 RenderViewHostTestEnabler(); |
105 ~RenderViewHostTestEnabler(); | 106 ~RenderViewHostTestEnabler(); |
106 | 107 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 scoped_ptr<aura::RootWindow> root_window_; | 174 scoped_ptr<aura::RootWindow> root_window_; |
174 scoped_ptr<aura::test::TestStackingClient> test_stacking_client_; | 175 scoped_ptr<aura::test::TestStackingClient> test_stacking_client_; |
175 #endif | 176 #endif |
176 RenderViewHostTestEnabler rvh_test_enabler_; | 177 RenderViewHostTestEnabler rvh_test_enabler_; |
177 | 178 |
178 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 179 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
179 }; | 180 }; |
180 | 181 |
181 } // namespace content | 182 } // namespace content |
182 | 183 |
183 // TODO(joi): Remove this after converting all clients. | |
184 using content::RenderViewHostTestHarness; | |
185 | |
186 #endif // CONTENT_TEST_TEST_RENDERER_HOST_H_ | 184 #endif // CONTENT_TEST_TEST_RENDERER_HOST_H_ |
OLD | NEW |