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 #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.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.h" | 11 #include "content/browser/renderer_host/render_view_host.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.h" | 13 #include "content/browser/site_instance.h" |
14 #include "content/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
15 | 15 |
16 TestTabContents::TestTabContents(content::BrowserContext* browser_context, | 16 TestTabContents::TestTabContents(content::BrowserContext* browser_context, |
17 SiteInstance* instance) | 17 SiteInstance* instance) |
18 : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL), | 18 : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL), |
19 transition_cross_site(false), | 19 transition_cross_site(false), |
20 delegate_view_override_(NULL), | 20 delegate_view_override_(NULL), |
21 expect_set_history_length_and_prune_(false), | 21 expect_set_history_length_and_prune_(false), |
22 expect_set_history_length_and_prune_site_instance_(NULL), | 22 expect_set_history_length_and_prune_site_instance_(NULL), |
23 expect_set_history_length_and_prune_history_length_(0), | 23 expect_set_history_length_and_prune_history_length_(0), |
24 expect_set_history_length_and_prune_min_page_id_(-1) { | 24 expect_set_history_length_and_prune_min_page_id_(-1) { |
(...skipping 15 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 TabContents* TestTabContents::Clone() { | 42 TabContents* TestTabContents::Clone() { |
43 TabContents* tc = new TestTabContents( | 43 TabContents* tc = new TestTabContents( |
44 browser_context(), SiteInstance::CreateSiteInstance(browser_context())); | 44 browser_context(), SiteInstance::CreateSiteInstance(browser_context())); |
45 tc->controller().CopyStateFrom(controller_); | 45 tc->controller().CopyStateFrom(controller_); |
46 return tc; | 46 return tc; |
47 } | 47 } |
48 | 48 |
49 void TestTabContents::NavigateAndCommit(const GURL& url) { | 49 void TestTabContents::NavigateAndCommit(const GURL& url) { |
50 controller().LoadURL(url, GURL(), PageTransition::LINK, std::string()); | 50 controller().LoadURL( |
| 51 url, GURL(), content::PAGE_TRANSITION_LINK, std::string()); |
51 GURL loaded_url(url); | 52 GURL loaded_url(url); |
52 bool reverse_on_redirect = false; | 53 bool reverse_on_redirect = false; |
53 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 54 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
54 &loaded_url, browser_context(), &reverse_on_redirect); | 55 &loaded_url, browser_context(), &reverse_on_redirect); |
55 | 56 |
56 // LoadURL created a navigation entry, now simulate the RenderView sending | 57 // LoadURL created a navigation entry, now simulate the RenderView sending |
57 // a notification that it actually navigated. | 58 // a notification that it actually navigated. |
58 CommitPendingNavigation(); | 59 CommitPendingNavigation(); |
59 } | 60 } |
60 | 61 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 void TestTabContents::SetHistoryLengthAndPrune( | 112 void TestTabContents::SetHistoryLengthAndPrune( |
112 const SiteInstance* site_instance, int history_length, int32 min_page_id) { | 113 const SiteInstance* site_instance, int history_length, int32 min_page_id) { |
113 EXPECT_TRUE(expect_set_history_length_and_prune_); | 114 EXPECT_TRUE(expect_set_history_length_and_prune_); |
114 expect_set_history_length_and_prune_ = false; | 115 expect_set_history_length_and_prune_ = false; |
115 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); | 116 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); |
116 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, | 117 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, |
117 history_length); | 118 history_length); |
118 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); | 119 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); |
119 } | 120 } |
OLD | NEW |