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

Side by Side Diff: content/test/test_render_view_host.h

Issue 636673002: Remove navigation from TestRenderViewHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a TODO Created 6 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
« no previous file with comments | « content/test/test_render_frame_host.cc ('k') | content/test/test_render_view_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 5 #ifndef CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
6 #define CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 6 #define CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 RenderViewHostDelegate* delegate, 204 RenderViewHostDelegate* delegate,
205 RenderWidgetHostDelegate* widget_delegate, 205 RenderWidgetHostDelegate* widget_delegate,
206 int routing_id, 206 int routing_id,
207 int main_frame_routing_id, 207 int main_frame_routing_id,
208 bool swapped_out); 208 bool swapped_out);
209 virtual ~TestRenderViewHost(); 209 virtual ~TestRenderViewHost();
210 210
211 // RenderViewHostTester implementation. Note that CreateRenderView 211 // RenderViewHostTester implementation. Note that CreateRenderView
212 // is not specified since it is synonymous with the one from 212 // is not specified since it is synonymous with the one from
213 // RenderViewHostImpl, see below. 213 // RenderViewHostImpl, see below.
214 virtual void SetContentsMimeType(const std::string& mime_type) override;
215 virtual void SimulateWasHidden() override; 214 virtual void SimulateWasHidden() override;
216 virtual void SimulateWasShown() override; 215 virtual void SimulateWasShown() override;
217 216
218 // NOTE: These methods are deprecated and the equivalents in
219 // TestRenderFrameHost should be used.
220 virtual void SendNavigate(int page_id, const GURL& url) override;
221 virtual void SendFailedNavigate(int page_id, const GURL& url) override;
222 virtual void SendNavigateWithTransition(
223 int page_id,
224 const GURL& url,
225 ui::PageTransition transition) override;
226
227 // Calls OnNavigate on the RenderViewHost with the given information,
228 // including a custom original request URL. Sets the rest of the
229 // parameters in the message to the "typical" values. This is a helper
230 // function for simulating the most common types of loads.
231 void SendNavigateWithOriginalRequestURL(
232 int page_id, const GURL& url, const GURL& original_request_url);
233
234 void SendNavigateWithFile(
235 int page_id, const GURL& url, const base::FilePath& file_path);
236
237 void SendNavigateWithParams(
238 FrameHostMsg_DidCommitProvisionalLoad_Params* params);
239
240 void TestOnUpdateStateWithFile( 217 void TestOnUpdateStateWithFile(
241 int page_id, const base::FilePath& file_path); 218 int page_id, const base::FilePath& file_path);
242 219
243 void TestOnStartDragging(const DropData& drop_data); 220 void TestOnStartDragging(const DropData& drop_data);
244 221
245 // If set, *delete_counter is incremented when this object destructs. 222 // If set, *delete_counter is incremented when this object destructs.
246 void set_delete_counter(int* delete_counter) { 223 void set_delete_counter(int* delete_counter) {
247 delete_counter_ = delete_counter; 224 delete_counter_ = delete_counter;
248 } 225 }
249 226
250 // Sets whether the RenderView currently exists or not. This controls the 227 // Sets whether the RenderView currently exists or not. This controls the
251 // return value from IsRenderViewLive, which the rest of the system uses to 228 // return value from IsRenderViewLive, which the rest of the system uses to
252 // check whether the RenderView has crashed or not. 229 // check whether the RenderView has crashed or not.
253 void set_render_view_created(bool created) { 230 void set_render_view_created(bool created) {
254 render_view_created_ = created; 231 render_view_created_ = created;
255 } 232 }
256 233
257 // If set, navigations will appear to have loaded through a proxy
258 // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy).
259 // False by default.
260 void set_simulate_fetch_via_proxy(bool proxy);
261
262 // If set, navigations will appear to have cleared the history list in the
263 // RenderView
264 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared).
265 // False by default.
266 void set_simulate_history_list_was_cleared(bool cleared);
267
268 // The opener route id passed to CreateRenderView(). 234 // The opener route id passed to CreateRenderView().
269 int opener_route_id() const { return opener_route_id_; } 235 int opener_route_id() const { return opener_route_id_; }
270 236
271 // TODO(creis): Remove the need for these methods.
272 TestRenderFrameHost* main_render_frame_host() const {
273 return main_render_frame_host_;
274 }
275 void set_main_render_frame_host(TestRenderFrameHost* rfh) {
276 main_render_frame_host_ = rfh;
277 }
278
279 // RenderViewHost overrides -------------------------------------------------- 237 // RenderViewHost overrides --------------------------------------------------
280 238
281 virtual bool CreateRenderView(const base::string16& frame_name, 239 virtual bool CreateRenderView(const base::string16& frame_name,
282 int opener_route_id, 240 int opener_route_id,
283 int proxy_route_id, 241 int proxy_route_id,
284 int32 max_page_id, 242 int32 max_page_id,
285 bool window_was_created_with_opener) override; 243 bool window_was_created_with_opener) override;
286 virtual bool IsRenderViewLive() const override; 244 virtual bool IsRenderViewLive() const override;
287 virtual bool IsFullscreen() const override; 245 virtual bool IsFullscreen() const override;
288 246
(...skipping 16 matching lines...) Expand all
305 int response_code, 263 int response_code,
306 const base::FilePath* file_path_for_history_item); 264 const base::FilePath* file_path_for_history_item);
307 265
308 // Tracks if the caller thinks if it created the RenderView. This is so we can 266 // Tracks if the caller thinks if it created the RenderView. This is so we can
309 // respond to IsRenderViewLive appropriately. 267 // respond to IsRenderViewLive appropriately.
310 bool render_view_created_; 268 bool render_view_created_;
311 269
312 // See set_delete_counter() above. May be NULL. 270 // See set_delete_counter() above. May be NULL.
313 int* delete_counter_; 271 int* delete_counter_;
314 272
315 // See set_simulate_fetch_via_proxy() above.
316 bool simulate_fetch_via_proxy_;
317
318 // See set_simulate_history_list_was_cleared() above.
319 bool simulate_history_list_was_cleared_;
320
321 // See SetContentsMimeType() above.
322 std::string contents_mime_type_;
323
324 // See opener_route_id() above. 273 // See opener_route_id() above.
325 int opener_route_id_; 274 int opener_route_id_;
326 275
327 TestRenderFrameHost* main_render_frame_host_;
328
329 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); 276 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost);
330 }; 277 };
331 278
332 #if defined(COMPILER_MSVC) 279 #if defined(COMPILER_MSVC)
333 #pragma warning(pop) 280 #pragma warning(pop)
334 #endif 281 #endif
335 282
336 // Adds methods to get straight at the impl classes. 283 // Adds methods to get straight at the impl classes.
337 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness { 284 class RenderViewHostImplTestHarness : public RenderViewHostTestHarness {
338 public: 285 public:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 private: 322 private:
376 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> 323 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors>
377 ScopedSetSupportedScaleFactors; 324 ScopedSetSupportedScaleFactors;
378 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; 325 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_;
379 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); 326 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness);
380 }; 327 };
381 328
382 } // namespace content 329 } // namespace content
383 330
384 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 331 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
OLDNEW
« no previous file with comments | « content/test/test_render_frame_host.cc ('k') | content/test/test_render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698