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 #include "content/browser/tab_contents/test_tab_contents.h" | 5 #include "content/browser/tab_contents/test_tab_contents.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/browser_url_handler.h" | 9 #include "content/browser/browser_url_handler_impl.h" |
10 #include "content/browser/renderer_host/mock_render_process_host.h" | 10 #include "content/browser/renderer_host/mock_render_process_host.h" |
11 #include "content/browser/renderer_host/render_view_host_impl.h" | 11 #include "content/browser/renderer_host/render_view_host_impl.h" |
12 #include "content/browser/renderer_host/test_render_view_host.h" | 12 #include "content/browser/renderer_host/test_render_view_host.h" |
13 #include "content/browser/site_instance_impl.h" | 13 #include "content/browser/site_instance_impl.h" |
14 #include "content/browser/tab_contents/navigation_entry_impl.h" | 14 #include "content/browser/tab_contents/navigation_entry_impl.h" |
15 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
16 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
17 #include "webkit/glue/webkit_glue.h" | 17 #include "webkit/glue/webkit_glue.h" |
18 #include "webkit/forms/password_form.h" | 18 #include "webkit/forms/password_form.h" |
19 | 19 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 SiteInstance::Create(GetBrowserContext())); | 94 SiteInstance::Create(GetBrowserContext())); |
95 tc->GetControllerImpl().CopyStateFrom(controller_); | 95 tc->GetControllerImpl().CopyStateFrom(controller_); |
96 return tc; | 96 return tc; |
97 } | 97 } |
98 | 98 |
99 void TestTabContents::NavigateAndCommit(const GURL& url) { | 99 void TestTabContents::NavigateAndCommit(const GURL& url) { |
100 GetController().LoadURL( | 100 GetController().LoadURL( |
101 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); | 101 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); |
102 GURL loaded_url(url); | 102 GURL loaded_url(url); |
103 bool reverse_on_redirect = false; | 103 bool reverse_on_redirect = false; |
104 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 104 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
105 &loaded_url, GetBrowserContext(), &reverse_on_redirect); | 105 &loaded_url, GetBrowserContext(), &reverse_on_redirect); |
106 | 106 |
107 // LoadURL created a navigation entry, now simulate the RenderView sending | 107 // LoadURL created a navigation entry, now simulate the RenderView sending |
108 // a notification that it actually navigated. | 108 // a notification that it actually navigated. |
109 CommitPendingNavigation(); | 109 CommitPendingNavigation(); |
110 } | 110 } |
111 | 111 |
112 void TestTabContents::CommitPendingNavigation() { | 112 void TestTabContents::CommitPendingNavigation() { |
113 // If we are doing a cross-site navigation, this simulates the current RVH | 113 // If we are doing a cross-site navigation, this simulates the current RVH |
114 // notifying that it has unloaded so the pending RVH is resumed and can | 114 // notifying that it has unloaded so the pending RVH is resumed and can |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void TestTabContents::SetHistoryLengthAndPrune( | 162 void TestTabContents::SetHistoryLengthAndPrune( |
163 const SiteInstance* site_instance, int history_length, | 163 const SiteInstance* site_instance, int history_length, |
164 int32 min_page_id) { | 164 int32 min_page_id) { |
165 EXPECT_TRUE(expect_set_history_length_and_prune_); | 165 EXPECT_TRUE(expect_set_history_length_and_prune_); |
166 expect_set_history_length_and_prune_ = false; | 166 expect_set_history_length_and_prune_ = false; |
167 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); | 167 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); |
168 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, | 168 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, |
169 history_length); | 169 history_length); |
170 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); | 170 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); |
171 } | 171 } |
OLD | NEW |