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/browser_url_handler.h" | 5 #include "chrome/browser/browser_url_handler.h" |
6 #include "chrome/common/render_messages.h" | 6 #include "chrome/common/render_messages.h" |
7 #include "chrome/common/url_constants.h" | |
8 #include "chrome/test/test_notification_tracker.h" | 7 #include "chrome/test/test_notification_tracker.h" |
9 #include "chrome/test/testing_profile.h" | 8 #include "chrome/test/testing_profile.h" |
10 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
11 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
12 #include "content/browser/site_instance.h" | 11 #include "content/browser/site_instance.h" |
13 #include "content/browser/tab_contents/navigation_controller.h" | 12 #include "content/browser/tab_contents/navigation_controller.h" |
14 #include "content/browser/tab_contents/navigation_entry.h" | 13 #include "content/browser/tab_contents/navigation_entry.h" |
15 #include "content/browser/tab_contents/render_view_host_manager.h" | 14 #include "content/browser/tab_contents/render_view_host_manager.h" |
16 #include "content/browser/tab_contents/test_tab_contents.h" | 15 #include "content/browser/tab_contents/test_tab_contents.h" |
17 #include "content/common/notification_details.h" | 16 #include "content/common/notification_details.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry); | 52 return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry); |
54 } | 53 } |
55 }; | 54 }; |
56 | 55 |
57 // Tests that when you navigate from the New TabPage to another page, and | 56 // Tests that when you navigate from the New TabPage to another page, and |
58 // then do that same thing in another tab, that the two resulting pages have | 57 // then do that same thing in another tab, that the two resulting pages have |
59 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is | 58 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is |
60 // a regression test for bug 9364. | 59 // a regression test for bug 9364. |
61 TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { | 60 TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { |
62 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); | 61 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); |
63 GURL ntp(chrome::kChromeUINewTabURL); | 62 const GURL kNtpUrl("chrome://newtab"); |
jam
2011/05/24 01:25:47
ditto and below
| |
64 GURL dest("http://www.google.com/"); | 63 const GURL kDestUrl("http://www.google.com/"); |
65 | 64 |
66 // Navigate our first tab to the new tab page and then to the destination. | 65 // Navigate our first tab to the new tab page and then to the destination. |
67 NavigateActiveAndCommit(ntp); | 66 NavigateActiveAndCommit(kNtpUrl); |
68 NavigateActiveAndCommit(dest); | 67 NavigateActiveAndCommit(kDestUrl); |
69 | 68 |
70 // Make a second tab. | 69 // Make a second tab. |
71 TestTabContents contents2(profile_.get(), NULL); | 70 TestTabContents contents2(profile_.get(), NULL); |
72 | 71 |
73 // Load the two URLs in the second tab. Note that the first navigation creates | 72 // Load the two URLs in the second tab. Note that the first navigation creates |
74 // a RVH that's not pending (since there is no cross-site transition), so | 73 // a RVH that's not pending (since there is no cross-site transition), so |
75 // we use the committed one, but the second one is the opposite. | 74 // we use the committed one, but the second one is the opposite. |
76 contents2.controller().LoadURL(ntp, GURL(), PageTransition::LINK); | 75 contents2.controller().LoadURL(kNtpUrl, GURL(), PageTransition::LINK); |
77 TestRenderViewHost* ntp_rvh2 = static_cast<TestRenderViewHost*>( | 76 TestRenderViewHost* ntp_rvh2 = static_cast<TestRenderViewHost*>( |
78 contents2.render_manager()->current_host()); | 77 contents2.render_manager()->current_host()); |
79 ntp_rvh2->SendNavigate(100, ntp); | 78 ntp_rvh2->SendNavigate(100, kNtpUrl); |
80 contents2.controller().LoadURL(dest, GURL(), PageTransition::LINK); | 79 contents2.controller().LoadURL(kDestUrl, GURL(), PageTransition::LINK); |
81 TestRenderViewHost* dest_rvh2 = static_cast<TestRenderViewHost*>( | 80 TestRenderViewHost* dest_rvh2 = static_cast<TestRenderViewHost*>( |
82 contents2.render_manager()->pending_render_view_host()); | 81 contents2.render_manager()->pending_render_view_host()); |
83 dest_rvh2->SendNavigate(101, dest); | 82 dest_rvh2->SendNavigate(101, kDestUrl); |
84 ntp_rvh2->OnSwapOutACK(); | 83 ntp_rvh2->OnSwapOutACK(); |
85 | 84 |
86 // The two RVH's should be different in every way. | 85 // The two RVH's should be different in every way. |
87 EXPECT_NE(active_rvh()->process(), dest_rvh2->process()); | 86 EXPECT_NE(active_rvh()->process(), dest_rvh2->process()); |
88 EXPECT_NE(active_rvh()->site_instance(), dest_rvh2->site_instance()); | 87 EXPECT_NE(active_rvh()->site_instance(), dest_rvh2->site_instance()); |
89 EXPECT_NE(active_rvh()->site_instance()->browsing_instance(), | 88 EXPECT_NE(active_rvh()->site_instance()->browsing_instance(), |
90 dest_rvh2->site_instance()->browsing_instance()); | 89 dest_rvh2->site_instance()->browsing_instance()); |
91 | 90 |
92 // Navigate both to the new tab page, and verify that they share a | 91 // Navigate both to the new tab page, and verify that they share a |
93 // SiteInstance. | 92 // SiteInstance. |
94 NavigateActiveAndCommit(ntp); | 93 NavigateActiveAndCommit(kNtpUrl); |
95 | 94 |
96 contents2.controller().LoadURL(ntp, GURL(), PageTransition::LINK); | 95 contents2.controller().LoadURL(kNtpUrl, GURL(), PageTransition::LINK); |
97 dest_rvh2->SendShouldCloseACK(true); | 96 dest_rvh2->SendShouldCloseACK(true); |
98 static_cast<TestRenderViewHost*>(contents2.render_manager()-> | 97 static_cast<TestRenderViewHost*>(contents2.render_manager()-> |
99 pending_render_view_host())->SendNavigate(102, ntp); | 98 pending_render_view_host())->SendNavigate(102, kNtpUrl); |
100 dest_rvh2->OnSwapOutACK(); | 99 dest_rvh2->OnSwapOutACK(); |
101 | 100 |
102 EXPECT_EQ(active_rvh()->site_instance(), | 101 EXPECT_EQ(active_rvh()->site_instance(), |
103 contents2.render_view_host()->site_instance()); | 102 contents2.render_view_host()->site_instance()); |
104 } | 103 } |
105 | 104 |
106 // When there is an error with the specified page, renderer exits view-source | 105 // When there is an error with the specified page, renderer exits view-source |
107 // mode. See WebFrameImpl::DidFail(). We check by this test that | 106 // mode. See WebFrameImpl::DidFail(). We check by this test that |
108 // EnableViewSourceMode message is sent on every navigation regardless | 107 // EnableViewSourceMode message is sent on every navigation regardless |
109 // RenderView is being newly created or reused. | 108 // RenderView is being newly created or reused. |
110 TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { | 109 TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { |
111 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); | 110 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); |
112 const GURL kNtpUrl(chrome::kChromeUINewTabURL); | 111 const GURL kNtpUrl("chrome://newtab"); |
113 const GURL kUrl("view-source:http://foo"); | 112 const GURL kUrl("view-source:http://foo"); |
114 | 113 |
115 // We have to navigate to some page at first since without this, the first | 114 // We have to navigate to some page at first since without this, the first |
116 // navigation will reuse the SiteInstance created by Init(), and the second | 115 // navigation will reuse the SiteInstance created by Init(), and the second |
117 // one will create a new SiteInstance. Because current_instance and | 116 // one will create a new SiteInstance. Because current_instance and |
118 // new_instance will be different, a new RenderViewHost will be created for | 117 // new_instance will be different, a new RenderViewHost will be created for |
119 // the second navigation. We have to avoid this in order to exercise the | 118 // the second navigation. We have to avoid this in order to exercise the |
120 // target code patch. | 119 // target code patch. |
121 NavigateActiveAndCommit(kNtpUrl); | 120 NavigateActiveAndCommit(kNtpUrl); |
122 | 121 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 Source<NavigationController>(&tab_contents.controller())); | 183 Source<NavigationController>(&tab_contents.controller())); |
185 | 184 |
186 // Create. | 185 // Create. |
187 RenderViewHostManager manager(&tab_contents, &tab_contents); | 186 RenderViewHostManager manager(&tab_contents, &tab_contents); |
188 | 187 |
189 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); | 188 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); |
190 | 189 |
191 RenderViewHost* host; | 190 RenderViewHost* host; |
192 | 191 |
193 // 1) The first navigation. -------------------------- | 192 // 1) The first navigation. -------------------------- |
194 GURL url1("http://www.google.com/"); | 193 const GURL kUrl1("http://www.google.com/"); |
195 NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, url1, | 194 NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1, |
196 GURL() /* referrer */, string16() /* title */, | 195 GURL() /* referrer */, string16() /* title */, |
197 PageTransition::TYPED); | 196 PageTransition::TYPED); |
198 host = manager.Navigate(entry1); | 197 host = manager.Navigate(entry1); |
199 | 198 |
200 // The RenderViewHost created in Init will be reused. | 199 // The RenderViewHost created in Init will be reused. |
201 EXPECT_TRUE(host == manager.current_host()); | 200 EXPECT_TRUE(host == manager.current_host()); |
202 EXPECT_FALSE(manager.pending_render_view_host()); | 201 EXPECT_FALSE(manager.pending_render_view_host()); |
203 | 202 |
204 // Commit. | 203 // Commit. |
205 manager.DidNavigateMainFrame(host); | 204 manager.DidNavigateMainFrame(host); |
206 // Commit to SiteInstance should be delayed until RenderView commit. | 205 // Commit to SiteInstance should be delayed until RenderView commit. |
207 EXPECT_TRUE(host == manager.current_host()); | 206 EXPECT_TRUE(host == manager.current_host()); |
208 ASSERT_TRUE(host); | 207 ASSERT_TRUE(host); |
209 EXPECT_FALSE(host->site_instance()->has_site()); | 208 EXPECT_FALSE(host->site_instance()->has_site()); |
210 host->site_instance()->SetSite(url1); | 209 host->site_instance()->SetSite(kUrl1); |
211 | 210 |
212 // 2) Navigate to next site. ------------------------- | 211 // 2) Navigate to next site. ------------------------- |
213 GURL url2("http://www.google.com/foo"); | 212 const GURL kUrl2("http://www.google.com/foo"); |
214 NavigationEntry entry2(NULL /* instance */, -1 /* page_id */, url2, | 213 NavigationEntry entry2(NULL /* instance */, -1 /* page_id */, kUrl2, |
215 url1 /* referrer */, string16() /* title */, | 214 kUrl1 /* referrer */, string16() /* title */, |
216 PageTransition::LINK); | 215 PageTransition::LINK); |
217 host = manager.Navigate(entry2); | 216 host = manager.Navigate(entry2); |
218 | 217 |
219 // The RenderViewHost created in Init will be reused. | 218 // The RenderViewHost created in Init will be reused. |
220 EXPECT_TRUE(host == manager.current_host()); | 219 EXPECT_TRUE(host == manager.current_host()); |
221 EXPECT_FALSE(manager.pending_render_view_host()); | 220 EXPECT_FALSE(manager.pending_render_view_host()); |
222 | 221 |
223 // Commit. | 222 // Commit. |
224 manager.DidNavigateMainFrame(host); | 223 manager.DidNavigateMainFrame(host); |
225 EXPECT_TRUE(host == manager.current_host()); | 224 EXPECT_TRUE(host == manager.current_host()); |
226 ASSERT_TRUE(host); | 225 ASSERT_TRUE(host); |
227 EXPECT_TRUE(host->site_instance()->has_site()); | 226 EXPECT_TRUE(host->site_instance()->has_site()); |
228 | 227 |
229 // 3) Cross-site navigate to next site. -------------- | 228 // 3) Cross-site navigate to next site. -------------- |
230 GURL url3("http://webkit.org/"); | 229 const GURL kUrl3("http://webkit.org/"); |
231 NavigationEntry entry3(NULL /* instance */, -1 /* page_id */, url3, | 230 NavigationEntry entry3(NULL /* instance */, -1 /* page_id */, kUrl3, |
232 url2 /* referrer */, string16() /* title */, | 231 kUrl2 /* referrer */, string16() /* title */, |
233 PageTransition::LINK); | 232 PageTransition::LINK); |
234 host = manager.Navigate(entry3); | 233 host = manager.Navigate(entry3); |
235 | 234 |
236 // A new RenderViewHost should be created. | 235 // A new RenderViewHost should be created. |
237 EXPECT_TRUE(manager.pending_render_view_host()); | 236 EXPECT_TRUE(manager.pending_render_view_host()); |
238 EXPECT_TRUE(host == manager.pending_render_view_host()); | 237 EXPECT_TRUE(host == manager.pending_render_view_host()); |
239 | 238 |
240 notifications.Reset(); | 239 notifications.Reset(); |
241 | 240 |
242 // Commit. | 241 // Commit. |
(...skipping 12 matching lines...) Expand all Loading... | |
255 // Tests WebUI creation. | 254 // Tests WebUI creation. |
256 TEST_F(RenderViewHostManagerTest, WebUI) { | 255 TEST_F(RenderViewHostManagerTest, WebUI) { |
257 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); | 256 BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); |
258 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); | 257 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); |
259 | 258 |
260 TestTabContents tab_contents(profile_.get(), instance); | 259 TestTabContents tab_contents(profile_.get(), instance); |
261 RenderViewHostManager manager(&tab_contents, &tab_contents); | 260 RenderViewHostManager manager(&tab_contents, &tab_contents); |
262 | 261 |
263 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); | 262 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); |
264 | 263 |
265 GURL url(chrome::kChromeUINewTabURL); | 264 const GURL kUrl("chrome://newtab"); |
266 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, url, | 265 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, kUrl, |
267 GURL() /* referrer */, string16() /* title */, | 266 GURL() /* referrer */, string16() /* title */, |
268 PageTransition::TYPED); | 267 PageTransition::TYPED); |
269 RenderViewHost* host = manager.Navigate(entry); | 268 RenderViewHost* host = manager.Navigate(entry); |
270 | 269 |
271 EXPECT_TRUE(host); | 270 EXPECT_TRUE(host); |
272 EXPECT_TRUE(host == manager.current_host()); | 271 EXPECT_TRUE(host == manager.current_host()); |
273 EXPECT_FALSE(manager.pending_render_view_host()); | 272 EXPECT_FALSE(manager.pending_render_view_host()); |
274 | 273 |
275 // It's important that the site instance get set on the Web UI page as soon | 274 // It's important that the site instance get set on the Web UI page as soon |
276 // as the navigation starts, rather than lazily after it commits, so we don't | 275 // as the navigation starts, rather than lazily after it commits, so we don't |
277 // try to re-use the SiteInstance/process for non DOM-UI things that may | 276 // try to re-use the SiteInstance/process for non DOM-UI things that may |
278 // get loaded in between. | 277 // get loaded in between. |
279 EXPECT_TRUE(host->site_instance()->has_site()); | 278 EXPECT_TRUE(host->site_instance()->has_site()); |
280 EXPECT_EQ(url, host->site_instance()->site()); | 279 EXPECT_EQ(kUrl, host->site_instance()->site()); |
281 | 280 |
282 // The Web UI is committed immediately because the RenderViewHost has not been | 281 // The Web UI is committed immediately because the RenderViewHost has not been |
283 // used yet. UpdateRendererStateForNavigate() took the short cut path. | 282 // used yet. UpdateRendererStateForNavigate() took the short cut path. |
284 EXPECT_FALSE(manager.pending_web_ui()); | 283 EXPECT_FALSE(manager.pending_web_ui()); |
285 EXPECT_TRUE(manager.web_ui()); | 284 EXPECT_TRUE(manager.web_ui()); |
286 | 285 |
287 // Commit. | 286 // Commit. |
288 manager.DidNavigateMainFrame(host); | 287 manager.DidNavigateMainFrame(host); |
289 } | 288 } |
290 | 289 |
291 // Tests that chrome: URLs that are not Web UI pages do not get grouped into | 290 // Tests that chrome: URLs that are not Web UI pages do not get grouped into |
292 // Web UI renderers, even if --process-per-tab is enabled. In that mode, we | 291 // Web UI renderers, even if --process-per-tab is enabled. In that mode, we |
293 // still swap processes if ShouldSwapProcessesForNavigation is true. | 292 // still swap processes if ShouldSwapProcessesForNavigation is true. |
294 // Regression test for bug 46290. | 293 // Regression test for bug 46290. |
295 TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) { | 294 TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) { |
296 BrowserThread thread(BrowserThread::UI, &message_loop_); | 295 BrowserThread thread(BrowserThread::UI, &message_loop_); |
297 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); | 296 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); |
298 TestTabContents tab_contents(profile_.get(), instance); | 297 TestTabContents tab_contents(profile_.get(), instance); |
299 RenderViewHostManager manager(&tab_contents, &tab_contents); | 298 RenderViewHostManager manager(&tab_contents, &tab_contents); |
300 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); | 299 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); |
301 | 300 |
302 // NTP is a Web UI page. | 301 // NTP is a Web UI page. |
303 GURL ntp_url(chrome::kChromeUINewTabURL); | 302 const GURL kNtpUrl("chrome://newtab"); |
304 NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, ntp_url, | 303 NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl, |
305 GURL() /* referrer */, string16() /* title */, | 304 GURL() /* referrer */, string16() /* title */, |
306 PageTransition::TYPED); | 305 PageTransition::TYPED); |
307 | 306 |
308 // about: URLs are not Web UI pages. | 307 // about: URLs are not Web UI pages. |
309 GURL about_url(chrome::kAboutMemoryURL); | 308 GURL about_url("about:memory"); |
310 // Rewrite so it looks like chrome://about/memory | 309 // Rewrite so it looks like chrome://about/memory |
311 bool reverse_on_redirect = false; | 310 bool reverse_on_redirect = false; |
312 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 311 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
313 &about_url, profile_.get(), &reverse_on_redirect); | 312 &about_url, profile_.get(), &reverse_on_redirect); |
314 NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url, | 313 NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url, |
315 GURL() /* referrer */, string16() /* title */, | 314 GURL() /* referrer */, string16() /* title */, |
316 PageTransition::TYPED); | 315 PageTransition::TYPED); |
317 | 316 |
318 EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry)); | 317 EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry)); |
319 } | 318 } |
320 | 319 |
321 // Tests that we don't end up in an inconsistent state if a page does a back and | 320 // Tests that we don't end up in an inconsistent state if a page does a back and |
322 // then reload. http://crbug.com/51680 | 321 // then reload. http://crbug.com/51680 |
323 TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { | 322 TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { |
324 GURL url1("http://www.google.com/"); | 323 const GURL kUrl1("http://www.google.com/"); |
325 GURL url2("http://www.evil-site.com/"); | 324 const GURL kUrl2("http://www.evil-site.com/"); |
326 | 325 |
327 // Navigate to a safe site, then an evil site. | 326 // Navigate to a safe site, then an evil site. |
328 // This will switch RenderViewHosts. We cannot assert that the first and | 327 // This will switch RenderViewHosts. We cannot assert that the first and |
329 // second RVHs are different, though, because the first one may be promptly | 328 // second RVHs are different, though, because the first one may be promptly |
330 // deleted. | 329 // deleted. |
331 contents()->NavigateAndCommit(url1); | 330 contents()->NavigateAndCommit(kUrl1); |
332 contents()->NavigateAndCommit(url2); | 331 contents()->NavigateAndCommit(kUrl2); |
333 RenderViewHost* evil_rvh = contents()->render_view_host(); | 332 RenderViewHost* evil_rvh = contents()->render_view_host(); |
334 | 333 |
335 // Now let's simulate the evil page calling history.back(). | 334 // Now let's simulate the evil page calling history.back(). |
336 contents()->OnGoToEntryAtOffset(-1); | 335 contents()->OnGoToEntryAtOffset(-1); |
337 // We should have a new pending RVH. | 336 // We should have a new pending RVH. |
338 // Note that in this case, the navigation has not committed, so evil_rvh will | 337 // Note that in this case, the navigation has not committed, so evil_rvh will |
339 // not be deleted yet. | 338 // not be deleted yet. |
340 EXPECT_NE(evil_rvh, contents()->render_manager()->pending_render_view_host()); | 339 EXPECT_NE(evil_rvh, contents()->render_manager()->pending_render_view_host()); |
341 | 340 |
342 // Before that RVH has committed, the evil page reloads itself. | 341 // Before that RVH has committed, the evil page reloads itself. |
343 ViewHostMsg_FrameNavigate_Params params; | 342 ViewHostMsg_FrameNavigate_Params params; |
344 params.page_id = 1; | 343 params.page_id = 1; |
345 params.url = url2; | 344 params.url = kUrl2; |
346 params.transition = PageTransition::CLIENT_REDIRECT; | 345 params.transition = PageTransition::CLIENT_REDIRECT; |
347 params.should_update_history = false; | 346 params.should_update_history = false; |
348 params.gesture = NavigationGestureAuto; | 347 params.gesture = NavigationGestureAuto; |
349 params.was_within_same_page = false; | 348 params.was_within_same_page = false; |
350 params.is_post = false; | 349 params.is_post = false; |
351 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); | 350 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(kUrl2)); |
352 contents()->TestDidNavigate(evil_rvh, params); | 351 contents()->TestDidNavigate(evil_rvh, params); |
353 | 352 |
354 // That should have cancelled the pending RVH, and the evil RVH should be the | 353 // That should have cancelled the pending RVH, and the evil RVH should be the |
355 // current one. | 354 // current one. |
356 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); | 355 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); |
357 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); | 356 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); |
358 | 357 |
359 // Also we should not have a pending navigation entry. | 358 // Also we should not have a pending navigation entry. |
360 NavigationEntry* entry = contents()->controller().GetActiveEntry(); | 359 NavigationEntry* entry = contents()->controller().GetActiveEntry(); |
361 ASSERT_TRUE(entry != NULL); | 360 ASSERT_TRUE(entry != NULL); |
362 EXPECT_EQ(url2, entry->url()); | 361 EXPECT_EQ(kUrl2, entry->url()); |
363 } | 362 } |
OLD | NEW |