| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
| 10 #include "content/public/common/page_transition_types.h" |
| 10 #include "webkit/glue/webpreferences.h" | 11 #include "webkit/glue/webpreferences.h" |
| 11 | 12 |
| 12 class TestRenderViewHost; | 13 class TestRenderViewHost; |
| 13 | 14 |
| 14 // Subclass TabContents to ensure it creates TestRenderViewHosts and does | 15 // Subclass TabContents to ensure it creates TestRenderViewHosts and does |
| 15 // not do anything involving views. | 16 // not do anything involving views. |
| 16 class TestTabContents : public TabContents { | 17 class TestTabContents : public TabContents { |
| 17 public: | 18 public: |
| 18 TestTabContents(content::BrowserContext* browser_context, | 19 TestTabContents(content::BrowserContext* browser_context, |
| 19 SiteInstance* instance); | 20 SiteInstance* instance); |
| 20 virtual ~TestTabContents(); | 21 virtual ~TestTabContents(); |
| 21 | 22 |
| 22 TestRenderViewHost* pending_rvh() const; | 23 TestRenderViewHost* pending_rvh() const; |
| 23 | 24 |
| 24 // State accessor. | 25 // State accessor. |
| 25 bool cross_navigation_pending() { | 26 bool cross_navigation_pending() { |
| 26 return render_manager_.cross_navigation_pending_; | 27 return render_manager_.cross_navigation_pending_; |
| 27 } | 28 } |
| 28 | 29 |
| 29 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both | 30 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both |
| 30 // alternatives without using command-line switches. | 31 // alternatives without using command-line switches. |
| 31 bool ShouldTransitionCrossSite() { return transition_cross_site; } | 32 bool ShouldTransitionCrossSite() { return transition_cross_site; } |
| 32 | 33 |
| 33 // Promote DidNavigate to public. | |
| 34 void TestDidNavigate(RenderViewHost* render_view_host, | 34 void TestDidNavigate(RenderViewHost* render_view_host, |
| 35 const ViewHostMsg_FrameNavigate_Params& params) { | 35 int page_id, |
| 36 DidNavigate(render_view_host, params); | 36 const GURL& url, |
| 37 } | 37 content::PageTransition transition); |
| 38 void TestDidNavigateWithReferrer(RenderViewHost* render_view_host, |
| 39 int page_id, |
| 40 const GURL& url, |
| 41 const content::Referrer& referrer, |
| 42 content::PageTransition transition); |
| 38 | 43 |
| 39 // Promote GetWebkitPrefs to public. | 44 // Promote GetWebkitPrefs to public. |
| 40 WebPreferences TestGetWebkitPrefs() { | 45 WebPreferences TestGetWebkitPrefs() { |
| 41 return GetWebkitPrefs(); | 46 return GetWebkitPrefs(); |
| 42 } | 47 } |
| 43 | 48 |
| 44 // Prevent interaction with views. | 49 // Prevent interaction with views. |
| 45 virtual bool CreateRenderViewForRenderManager( | 50 virtual bool CreateRenderViewForRenderManager( |
| 46 RenderViewHost* render_view_host) OVERRIDE; | 51 RenderViewHost* render_view_host) OVERRIDE; |
| 47 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} | 52 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 96 |
| 92 // Expectations for arguments of |SetHistoryLengthAndPrune()|. | 97 // Expectations for arguments of |SetHistoryLengthAndPrune()|. |
| 93 bool expect_set_history_length_and_prune_; | 98 bool expect_set_history_length_and_prune_; |
| 94 scoped_refptr<const SiteInstance> | 99 scoped_refptr<const SiteInstance> |
| 95 expect_set_history_length_and_prune_site_instance_; | 100 expect_set_history_length_and_prune_site_instance_; |
| 96 int expect_set_history_length_and_prune_history_length_; | 101 int expect_set_history_length_and_prune_history_length_; |
| 97 int32 expect_set_history_length_and_prune_min_page_id_; | 102 int32 expect_set_history_length_and_prune_min_page_id_; |
| 98 }; | 103 }; |
| 99 | 104 |
| 100 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 105 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
| OLD | NEW |