Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: content/browser/tab_contents/render_view_host_manager_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698