[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / content / test / test_render_frame_host.h
blob6bdbd89d7efe1bbd8b4fb7b85fe766649e8de835
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/common/page_transition_types.h"
14 #include "content/public/test/test_renderer_host.h"
16 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
18 namespace content {
20 class TestRenderFrameHostCreationObserver : public WebContentsObserver {
21 public:
22 explicit TestRenderFrameHostCreationObserver(WebContents* web_contents);
23 virtual ~TestRenderFrameHostCreationObserver();
25 // WebContentsObserver implementation.
26 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE;
28 RenderFrameHost* last_created_frame() const { return last_created_frame_; }
30 private:
31 RenderFrameHost* last_created_frame_;
34 class TestRenderFrameHost : public RenderFrameHostImpl,
35 public RenderFrameHostTester {
36 public:
37 TestRenderFrameHost(RenderViewHostImpl* render_view_host,
38 RenderFrameHostDelegate* delegate,
39 FrameTree* frame_tree,
40 FrameTreeNode* frame_tree_node,
41 int routing_id,
42 bool is_swapped_out);
43 virtual ~TestRenderFrameHost();
45 // RenderFrameHostTester implementation.
46 virtual RenderFrameHost* AppendChild(const std::string& frame_name) OVERRIDE;
47 virtual void SendNavigateWithTransition(int page_id,
48 const GURL& url,
49 PageTransition transition) OVERRIDE;
51 void SendNavigate(int page_id, const GURL& url);
52 void SendFailedNavigate(int page_id, const GURL& url);
53 void SendNavigateWithTransitionAndResponseCode(
54 int page_id,
55 const GURL& url, PageTransition transition,
56 int response_code);
57 void SendNavigateWithOriginalRequestURL(
58 int page_id,
59 const GURL& url,
60 const GURL& original_request_url);
61 void SendNavigateWithFile(
62 int page_id,
63 const GURL& url,
64 const base::FilePath& file_path);
65 void SendNavigateWithParams(
66 FrameHostMsg_DidCommitProvisionalLoad_Params* params);
67 void SendNavigateWithRedirects(
68 int page_id,
69 const GURL& url,
70 const std::vector<GURL>& redirects);
71 void SendNavigateWithParameters(
72 int page_id,
73 const GURL& url,
74 PageTransition transition,
75 const GURL& original_request_url,
76 int response_code,
77 const base::FilePath* file_path_for_history_item,
78 const std::vector<GURL>& redirects);
79 void SendBeginNavigationWithURL(const GURL& url);
81 void set_contents_mime_type(const std::string& mime_type) {
82 contents_mime_type_ = mime_type;
85 // If set, navigations will appear to have cleared the history list in the
86 // RenderFrame
87 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared).
88 // False by default.
89 void set_simulate_history_list_was_cleared(bool cleared) {
90 simulate_history_list_was_cleared_ = cleared;
93 // TODO(nick): As necessary for testing, override behavior of RenderFrameHost
94 // here.
96 private:
97 TestRenderFrameHostCreationObserver child_creation_observer_;
99 std::string contents_mime_type_;
101 // See set_simulate_history_list_was_cleared() above.
102 bool simulate_history_list_was_cleared_;
104 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost);
107 } // namespace content
109 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_