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 "chrome/browser/favicon/favicon_tab_helper.h" | 5 #include "chrome/browser/favicon/favicon_tab_helper.h" |
6 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 6 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
7 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/testing_profile.h" | 9 #include "chrome/test/testing_profile.h" |
10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Load the NTP. | 176 // Load the NTP. |
177 GURL new_tab_url(chrome::kChromeUINewTabURL); | 177 GURL new_tab_url(chrome::kChromeUINewTabURL); |
178 controller().LoadURL(new_tab_url, GURL(), PageTransition::LINK); | 178 controller().LoadURL(new_tab_url, GURL(), PageTransition::LINK); |
179 rvh()->SendNavigate(page_id, new_tab_url); | 179 rvh()->SendNavigate(page_id, new_tab_url); |
180 | 180 |
181 // Navigate to another page. | 181 // Navigate to another page. |
182 GURL next_url("http://google.com/"); | 182 GURL next_url("http://google.com/"); |
183 int next_page_id = page_id + 1; | 183 int next_page_id = page_id + 1; |
184 controller().LoadURL(next_url, GURL(), PageTransition::LINK); | 184 controller().LoadURL(next_url, GURL(), PageTransition::LINK); |
| 185 TestRenderViewHost* old_rvh = rvh(); |
| 186 old_rvh->SendShouldCloseACK(true); |
185 pending_rvh()->SendNavigate(next_page_id, next_url); | 187 pending_rvh()->SendNavigate(next_page_id, next_url); |
| 188 old_rvh->OnSwapOutACK(); |
186 | 189 |
187 // Navigate back. Should focus the location bar. | 190 // Navigate back. Should focus the location bar. |
188 int focus_called = tc->focus_called(); | 191 int focus_called = tc->focus_called(); |
189 ASSERT_TRUE(controller().CanGoBack()); | 192 ASSERT_TRUE(controller().CanGoBack()); |
190 controller().GoBack(); | 193 controller().GoBack(); |
| 194 old_rvh = rvh(); |
| 195 old_rvh->SendShouldCloseACK(true); |
191 pending_rvh()->SendNavigate(page_id, new_tab_url); | 196 pending_rvh()->SendNavigate(page_id, new_tab_url); |
| 197 old_rvh->OnSwapOutACK(); |
192 EXPECT_LT(focus_called, tc->focus_called()); | 198 EXPECT_LT(focus_called, tc->focus_called()); |
193 | 199 |
194 // Navigate forward. Shouldn't focus the location bar. | 200 // Navigate forward. Shouldn't focus the location bar. |
195 focus_called = tc->focus_called(); | 201 focus_called = tc->focus_called(); |
196 ASSERT_TRUE(controller().CanGoForward()); | 202 ASSERT_TRUE(controller().CanGoForward()); |
197 controller().GoForward(); | 203 controller().GoForward(); |
| 204 old_rvh = rvh(); |
| 205 old_rvh->SendShouldCloseACK(true); |
198 pending_rvh()->SendNavigate(next_page_id, next_url); | 206 pending_rvh()->SendNavigate(next_page_id, next_url); |
| 207 old_rvh->OnSwapOutACK(); |
199 EXPECT_EQ(focus_called, tc->focus_called()); | 208 EXPECT_EQ(focus_called, tc->focus_called()); |
200 } | 209 } |
OLD | NEW |