| 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 TestRenderViewHost; | 14 class TestRenderViewHost; |
| 14 | 15 |
| 15 // Subclass TabContents to ensure it creates TestRenderViewHosts and does | 16 // Subclass TabContents to ensure it creates TestRenderViewHosts and does |
| 16 // not do anything involving views. | 17 // not do anything involving views. |
| 17 class TestTabContents : public TabContents { | 18 class TestTabContents : public TabContents { |
| 18 public: | 19 public: |
| 19 TestTabContents(content::BrowserContext* browser_context, | 20 TestTabContents(content::BrowserContext* browser_context, |
| 20 SiteInstance* instance); | 21 content::SiteInstance* instance); |
| 21 virtual ~TestTabContents(); | 22 virtual ~TestTabContents(); |
| 22 | 23 |
| 23 TestRenderViewHost* pending_rvh() const; | 24 TestRenderViewHost* pending_rvh() const; |
| 24 | 25 |
| 25 // State accessor. | 26 // State accessor. |
| 26 bool cross_navigation_pending() { | 27 bool cross_navigation_pending() { |
| 27 return render_manager_.cross_navigation_pending_; | 28 return render_manager_.cross_navigation_pending_; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both | 31 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 75 |
| 75 // Allow mocking of the RenderViewHostDelegate::View. | 76 // Allow mocking of the RenderViewHostDelegate::View. |
| 76 virtual content::RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE; | 77 virtual content::RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE; |
| 77 void set_view_delegate(content::RenderViewHostDelegate::View* view) { | 78 void set_view_delegate(content::RenderViewHostDelegate::View* view) { |
| 78 delegate_view_override_ = view; | 79 delegate_view_override_ = view; |
| 79 } | 80 } |
| 80 | 81 |
| 81 // Establish expected arguments for |SetHistoryLengthAndPrune()|. When | 82 // Establish expected arguments for |SetHistoryLengthAndPrune()|. When |
| 82 // |SetHistoryLengthAndPrune()| is called, the arguments are compared | 83 // |SetHistoryLengthAndPrune()| is called, the arguments are compared |
| 83 // with the expected arguments specified here. | 84 // with the expected arguments specified here. |
| 84 void ExpectSetHistoryLengthAndPrune(const SiteInstance* site_instance, | 85 void ExpectSetHistoryLengthAndPrune( |
| 85 int history_length, | 86 const content::SiteInstance* site_instance, |
| 86 int32 min_page_id); | 87 int history_length, |
| 88 int32 min_page_id); |
| 87 | 89 |
| 88 // Compares the arguments passed in with the expected arguments passed in | 90 // Compares the arguments passed in with the expected arguments passed in |
| 89 // to |ExpectSetHistoryLengthAndPrune()|. | 91 // to |ExpectSetHistoryLengthAndPrune()|. |
| 90 virtual void SetHistoryLengthAndPrune(const SiteInstance* site_instance, | 92 virtual void SetHistoryLengthAndPrune( |
| 91 int history_length, | 93 const content::SiteInstance* site_instance, |
| 92 int32 min_page_id) OVERRIDE; | 94 int history_length, |
| 95 int32 min_page_id) OVERRIDE; |
| 93 | 96 |
| 94 private: | 97 private: |
| 95 content::RenderViewHostDelegate::View* delegate_view_override_; | 98 content::RenderViewHostDelegate::View* delegate_view_override_; |
| 96 | 99 |
| 97 // Expectations for arguments of |SetHistoryLengthAndPrune()|. | 100 // Expectations for arguments of |SetHistoryLengthAndPrune()|. |
| 98 bool expect_set_history_length_and_prune_; | 101 bool expect_set_history_length_and_prune_; |
| 99 scoped_refptr<const SiteInstance> | 102 scoped_refptr<const SiteInstanceImpl> |
| 100 expect_set_history_length_and_prune_site_instance_; | 103 expect_set_history_length_and_prune_site_instance_; |
| 101 int expect_set_history_length_and_prune_history_length_; | 104 int expect_set_history_length_and_prune_history_length_; |
| 102 int32 expect_set_history_length_and_prune_min_page_id_; | 105 int32 expect_set_history_length_and_prune_min_page_id_; |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 108 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
| OLD | NEW |