Remove unused code calling WebMediaPlayerClient::requestFullscreen()
[chromium-blink-merge.git] / content / test / test_render_frame_host.h
blob233d501a753d0dfdabfca7b61fc645d397f86f46
1 // Copyright 2013 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.
5 #ifndef CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_
6 #define CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "content/browser/frame_host/render_frame_host_impl.h"
12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/test/mock_render_process_host.h"
14 #include "content/public/test/test_renderer_host.h"
15 #include "content/test/test_render_view_host.h"
16 #include "ui/base/page_transition_types.h"
18 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
20 namespace content {
22 class TestRenderFrameHostCreationObserver : public WebContentsObserver {
23 public:
24 explicit TestRenderFrameHostCreationObserver(WebContents* web_contents);
25 ~TestRenderFrameHostCreationObserver() override;
27 // WebContentsObserver implementation.
28 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
30 RenderFrameHost* last_created_frame() const { return last_created_frame_; }
32 private:
33 RenderFrameHost* last_created_frame_;
36 class TestRenderFrameHost : public RenderFrameHostImpl,
37 public RenderFrameHostTester {
38 public:
39 TestRenderFrameHost(SiteInstance* site_instance,
40 RenderViewHostImpl* render_view_host,
41 RenderFrameHostDelegate* delegate,
42 RenderWidgetHostDelegate* rwh_delegate,
43 FrameTree* frame_tree,
44 FrameTreeNode* frame_tree_node,
45 int routing_id,
46 int flags);
47 ~TestRenderFrameHost() override;
49 // RenderFrameHostImpl overrides (same values, but in Test*/Mock* types)
50 TestRenderViewHost* GetRenderViewHost() override;
51 MockRenderProcessHost* GetProcess() override;
53 // RenderFrameHostTester implementation.
54 void InitializeRenderFrameIfNeeded() override;
55 TestRenderFrameHost* AppendChild(const std::string& frame_name) override;
56 void SendNavigate(int page_id,
57 int nav_entry_id,
58 bool did_create_new_entry,
59 const GURL& url) override;
60 void SendFailedNavigate(int page_id,
61 int nav_entry_id,
62 bool did_create_new_entry,
63 const GURL& url) override;
64 void SendNavigateWithTransition(int page_id,
65 int nav_entry_id,
66 bool did_create_new_entry,
67 const GURL& url,
68 ui::PageTransition transition) override;
69 void SetContentsMimeType(const std::string& mime_type) override;
70 void SendBeforeUnloadACK(bool proceed) override;
71 void SimulateSwapOutACK() override;
73 void SendNavigateWithTransitionAndResponseCode(int page_id,
74 int nav_entry_id,
75 bool did_create_new_entry,
76 const GURL& url,
77 ui::PageTransition transition,
78 int response_code);
79 void SendNavigateWithOriginalRequestURL(int page_id,
80 int nav_entry_id,
81 bool did_create_new_entry,
82 const GURL& url,
83 const GURL& original_request_url);
84 void SendNavigateWithFile(int page_id,
85 int nav_entry_id,
86 bool did_create_new_entry,
87 const GURL& url,
88 const base::FilePath& file_path);
89 void SendNavigateWithParams(
90 FrameHostMsg_DidCommitProvisionalLoad_Params* params);
91 void SendNavigateWithRedirects(int page_id,
92 int nav_entry_id,
93 bool did_create_new_entry,
94 const GURL& url,
95 const std::vector<GURL>& redirects);
96 void SendNavigateWithParameters(
97 int page_id,
98 int nav_entry_id,
99 bool did_create_new_entry,
100 const GURL& url,
101 ui::PageTransition transition,
102 const GURL& original_request_url,
103 int response_code,
104 const base::FilePath* file_path_for_history_item,
105 const std::vector<GURL>& redirects);
107 // Simulate a renderer-initiated navigation up until commit.
108 void NavigateAndCommitRendererInitiated(int page_id,
109 bool did_create_new_entry,
110 const GURL& url);
112 // With the current navigation logic this method is a no-op.
113 // PlzNavigate: this method simulates receiving a BeginNavigation IPC.
114 void SendRendererInitiatedNavigationRequest(const GURL& url,
115 bool has_user_gesture);
117 void DidDisownOpener();
119 // If set, navigations will appear to have cleared the history list in the
120 // RenderFrame
121 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared).
122 // False by default.
123 void set_simulate_history_list_was_cleared(bool cleared) {
124 simulate_history_list_was_cleared_ = cleared;
127 // Advances the RenderFrameHost (and through it the RenderFrameHostManager) to
128 // a state where a new navigation can be committed by a renderer. Currently,
129 // this simulates a BeforeUnload ACK from the renderer.
130 // PlzNavigate: this simulates a BeforeUnload ACK from the renderer, and the
131 // interaction with the IO thread up until the response is ready to commit.
132 void PrepareForCommit();
134 // This method does the same as PrepareForCommit.
135 // PlzNavigate: Beyond doing the same as PrepareForCommit, this method will
136 // also simulate a server redirect to |redirect_url|. If the URL is empty the
137 // redirect step is ignored.
138 void PrepareForCommitWithServerRedirect(const GURL& redirect_url);
140 // PlzNavigate
141 void set_pending_commit(bool pending) { pending_commit_ = pending; }
142 bool pending_commit() const { return pending_commit_; }
144 private:
145 TestRenderFrameHostCreationObserver child_creation_observer_;
147 std::string contents_mime_type_;
149 // See set_simulate_history_list_was_cleared() above.
150 bool simulate_history_list_was_cleared_;
152 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost);
155 } // namespace content
157 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_