| 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_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 "content/public/common/page_transition_types.h" |
| 11 #include "webkit/glue/webpreferences.h" | 11 #include "webkit/glue/webpreferences.h" |
| 12 | 12 |
| 13 class SiteInstanceImpl; | 13 class SiteInstanceImpl; |
| 14 |
| 15 namespace content { |
| 14 class TestRenderViewHost; | 16 class TestRenderViewHost; |
| 17 } |
| 15 | 18 |
| 16 // Subclass TabContents to ensure it creates TestRenderViewHosts and does | 19 // Subclass TabContents to ensure it creates TestRenderViewHosts and does |
| 17 // not do anything involving views. | 20 // not do anything involving views. |
| 18 class TestTabContents : public TabContents { | 21 class TestTabContents : public TabContents { |
| 19 public: | 22 public: |
| 20 TestTabContents(content::BrowserContext* browser_context, | 23 TestTabContents(content::BrowserContext* browser_context, |
| 21 content::SiteInstance* instance); | 24 content::SiteInstance* instance); |
| 22 virtual ~TestTabContents(); | 25 virtual ~TestTabContents(); |
| 23 | 26 |
| 24 TestRenderViewHost* pending_rvh() const; | 27 content::TestRenderViewHost* pending_rvh() const; |
| 25 | 28 |
| 26 // State accessor. | 29 // State accessor. |
| 27 bool cross_navigation_pending() { | 30 bool cross_navigation_pending() { |
| 28 return render_manager_.cross_navigation_pending_; | 31 return render_manager_.cross_navigation_pending_; |
| 29 } | 32 } |
| 30 | 33 |
| 31 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both | 34 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both |
| 32 // alternatives without using command-line switches. | 35 // alternatives without using command-line switches. |
| 33 bool ShouldTransitionCrossSite() { return transition_cross_site; } | 36 bool ShouldTransitionCrossSite() { return transition_cross_site; } |
| 34 | 37 |
| 35 void TestDidNavigate(RenderViewHost* render_view_host, | 38 void TestDidNavigate(content::RenderViewHost* render_view_host, |
| 36 int page_id, | 39 int page_id, |
| 37 const GURL& url, | 40 const GURL& url, |
| 38 content::PageTransition transition); | 41 content::PageTransition transition); |
| 39 void TestDidNavigateWithReferrer(RenderViewHost* render_view_host, | 42 void TestDidNavigateWithReferrer(content::RenderViewHost* render_view_host, |
| 40 int page_id, | 43 int page_id, |
| 41 const GURL& url, | 44 const GURL& url, |
| 42 const content::Referrer& referrer, | 45 const content::Referrer& referrer, |
| 43 content::PageTransition transition); | 46 content::PageTransition transition); |
| 44 | 47 |
| 45 // Promote GetWebkitPrefs to public. | 48 // Promote GetWebkitPrefs to public. |
| 46 WebPreferences TestGetWebkitPrefs() { | 49 WebPreferences TestGetWebkitPrefs() { |
| 47 return GetWebkitPrefs(); | 50 return GetWebkitPrefs(); |
| 48 } | 51 } |
| 49 | 52 |
| 50 // Prevent interaction with views. | 53 // Prevent interaction with views. |
| 51 virtual bool CreateRenderViewForRenderManager( | 54 virtual bool CreateRenderViewForRenderManager( |
| 52 RenderViewHost* render_view_host) OVERRIDE; | 55 content::RenderViewHost* render_view_host) OVERRIDE; |
| 53 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} | 56 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} |
| 54 | 57 |
| 55 // Returns a clone of this TestTabContents. The returned object is also a | 58 // Returns a clone of this TestTabContents. The returned object is also a |
| 56 // TestTabContents. The caller owns the returned object. | 59 // TestTabContents. The caller owns the returned object. |
| 57 virtual content::WebContents* Clone() OVERRIDE; | 60 virtual content::WebContents* Clone() OVERRIDE; |
| 58 | 61 |
| 59 // Creates a pending navigation to the given URL with the default parameters | 62 // Creates a pending navigation to the given URL with the default parameters |
| 60 // and then commits the load with a page ID one larger than any seen. This | 63 // and then commits the load with a page ID one larger than any seen. This |
| 61 // emulates what happens on a new navigation. | 64 // emulates what happens on a new navigation. |
| 62 void NavigateAndCommit(const GURL& url); | 65 void NavigateAndCommit(const GURL& url); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 102 |
| 100 // Expectations for arguments of |SetHistoryLengthAndPrune()|. | 103 // Expectations for arguments of |SetHistoryLengthAndPrune()|. |
| 101 bool expect_set_history_length_and_prune_; | 104 bool expect_set_history_length_and_prune_; |
| 102 scoped_refptr<const SiteInstanceImpl> | 105 scoped_refptr<const SiteInstanceImpl> |
| 103 expect_set_history_length_and_prune_site_instance_; | 106 expect_set_history_length_and_prune_site_instance_; |
| 104 int expect_set_history_length_and_prune_history_length_; | 107 int expect_set_history_length_and_prune_history_length_; |
| 105 int32 expect_set_history_length_and_prune_min_page_id_; | 108 int32 expect_set_history_length_and_prune_min_page_id_; |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 111 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
| OLD | NEW |