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_BROWSER_WEB_CONTENTS_TEST_WEB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_TEST_WEB_CONTENTS_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_TEST_WEB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_TEST_WEB_CONTENTS_H_ |
7 | 7 |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/public/common/page_transition_types.h" | 9 #include "content/public/common/page_transition_types.h" |
10 #include "content/public/test/web_contents_tester.h" | 10 #include "content/public/test/web_contents_tester.h" |
11 #include "webkit/glue/webpreferences.h" | 11 #include "webkit/glue/webpreferences.h" |
12 | 12 |
13 class SiteInstanceImpl; | 13 class SiteInstanceImpl; |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class RenderViewHost; | 17 class RenderViewHost; |
18 class TestRenderViewHost; | 18 class TestRenderViewHost; |
19 class WebContentsTester; | 19 class WebContentsTester; |
20 | 20 |
21 // Subclass WebContentsImpl to ensure it creates TestRenderViewHosts | 21 // Subclass WebContentsImpl to ensure it creates TestRenderViewHosts |
22 // and does not do anything involving views. | 22 // and does not do anything involving views. |
23 class TestWebContents : public WebContentsImpl, public WebContentsTester { | 23 class TestWebContents : public WebContentsImpl, public WebContentsTester { |
24 public: | 24 public: |
25 TestWebContents(BrowserContext* browser_context, SiteInstance* instance); | |
26 virtual ~TestWebContents(); | 25 virtual ~TestWebContents(); |
27 | 26 |
27 static TestWebContents* Create(BrowserContext* browser_context, | |
28 SiteInstance* instance); | |
29 | |
28 // WebContentsTester implementation. | 30 // WebContentsTester implementation. |
29 virtual void CommitPendingNavigation() OVERRIDE; | 31 virtual void CommitPendingNavigation() OVERRIDE; |
30 virtual int GetNumberOfFocusCalls() OVERRIDE; | 32 virtual int GetNumberOfFocusCalls() OVERRIDE; |
31 virtual RenderViewHost* GetPendingRenderViewHost() const OVERRIDE; | 33 virtual RenderViewHost* GetPendingRenderViewHost() const OVERRIDE; |
32 virtual void NavigateAndCommit(const GURL& url) OVERRIDE; | 34 virtual void NavigateAndCommit(const GURL& url) OVERRIDE; |
33 virtual void TestSetIsLoading(bool value) OVERRIDE; | 35 virtual void TestSetIsLoading(bool value) OVERRIDE; |
34 virtual void ProceedWithCrossSiteNavigation() OVERRIDE; | 36 virtual void ProceedWithCrossSiteNavigation() OVERRIDE; |
35 virtual void TestDidNavigate(RenderViewHost* render_view_host, | 37 virtual void TestDidNavigate(RenderViewHost* render_view_host, |
36 int page_id, | 38 int page_id, |
37 const GURL& url, | 39 const GURL& url, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 void ExpectSetHistoryLengthAndPrune(const SiteInstance* site_instance, | 83 void ExpectSetHistoryLengthAndPrune(const SiteInstance* site_instance, |
82 int history_length, | 84 int history_length, |
83 int32 min_page_id); | 85 int32 min_page_id); |
84 | 86 |
85 // Compares the arguments passed in with the expected arguments passed in | 87 // Compares the arguments passed in with the expected arguments passed in |
86 // to |ExpectSetHistoryLengthAndPrune()|. | 88 // to |ExpectSetHistoryLengthAndPrune()|. |
87 virtual void SetHistoryLengthAndPrune(const SiteInstance* site_instance, | 89 virtual void SetHistoryLengthAndPrune(const SiteInstance* site_instance, |
88 int history_length, | 90 int history_length, |
89 int32 min_page_id) OVERRIDE; | 91 int32 min_page_id) OVERRIDE; |
90 | 92 |
93 protected: | |
94 // The deprecated WebContentsTester still needs to subclass this. | |
95 explicit TestWebContents(BrowserContext* browser_context); | |
96 | |
91 private: | 97 private: |
98 | |
Charlie Reis
2012/08/02 23:06:47
No newline here?
awong
2012/08/03 00:31:04
Done.
| |
92 // WebContentsImpl overrides | 99 // WebContentsImpl overrides |
93 virtual void CreateNewWindow( | 100 virtual void CreateNewWindow( |
94 int route_id, | 101 int route_id, |
95 const ViewHostMsg_CreateWindow_Params& params, | 102 const ViewHostMsg_CreateWindow_Params& params, |
96 SessionStorageNamespace* session_storage_namespace) OVERRIDE; | 103 SessionStorageNamespace* session_storage_namespace) OVERRIDE; |
97 virtual void CreateNewWidget(int route_id, | 104 virtual void CreateNewWidget(int route_id, |
98 WebKit::WebPopupType popup_type) OVERRIDE; | 105 WebKit::WebPopupType popup_type) OVERRIDE; |
99 virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; | 106 virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; |
100 virtual void ShowCreatedWindow(int route_id, | 107 virtual void ShowCreatedWindow(int route_id, |
101 WindowOpenDisposition disposition, | 108 WindowOpenDisposition disposition, |
(...skipping 10 matching lines...) Expand all Loading... | |
112 bool expect_set_history_length_and_prune_; | 119 bool expect_set_history_length_and_prune_; |
113 scoped_refptr<const SiteInstanceImpl> | 120 scoped_refptr<const SiteInstanceImpl> |
114 expect_set_history_length_and_prune_site_instance_; | 121 expect_set_history_length_and_prune_site_instance_; |
115 int expect_set_history_length_and_prune_history_length_; | 122 int expect_set_history_length_and_prune_history_length_; |
116 int32 expect_set_history_length_and_prune_min_page_id_; | 123 int32 expect_set_history_length_and_prune_min_page_id_; |
117 }; | 124 }; |
118 | 125 |
119 } // namespace content | 126 } // namespace content |
120 | 127 |
121 #endif // CONTENT_BROWSER_WEB_CONTENTS_TEST_WEB_CONTENTS_H_ | 128 #endif // CONTENT_BROWSER_WEB_CONTENTS_TEST_WEB_CONTENTS_H_ |
OLD | NEW |