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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 79 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
80 &success)); | 80 &success)); |
81 EXPECT_TRUE(success); | 81 EXPECT_TRUE(success); |
82 new_tab_observer.Wait(); | 82 new_tab_observer.Wait(); |
83 | 83 |
84 // Opens in new tab. | 84 // Opens in new tab. |
85 EXPECT_EQ(2, browser()->tab_count()); | 85 EXPECT_EQ(2, browser()->tab_count()); |
86 EXPECT_EQ(1, browser()->active_index()); | 86 EXPECT_EQ(1, browser()->active_index()); |
87 | 87 |
88 // Wait for the navigation in the new tab to finish, if it hasn't. | 88 // Wait for the navigation in the new tab to finish, if it hasn't. |
89 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 89 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
90 EXPECT_EQ("/files/navigate_opener.html", | 90 EXPECT_EQ("/files/navigate_opener.html", |
91 chrome::GetActiveWebContents(browser())->GetURL().path()); | 91 chrome::GetActiveWebContents(browser())->GetURL().path()); |
92 EXPECT_EQ(1, browser()->active_index()); | 92 EXPECT_EQ(1, browser()->active_index()); |
93 | 93 |
94 // Should have the same SiteInstance. | 94 // Should have the same SiteInstance. |
95 scoped_refptr<SiteInstance> blank_site_instance( | 95 scoped_refptr<SiteInstance> blank_site_instance( |
96 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 96 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
97 EXPECT_EQ(orig_site_instance, blank_site_instance); | 97 EXPECT_EQ(orig_site_instance, blank_site_instance); |
98 | 98 |
99 // We should have access to the opened tab's location. | 99 // We should have access to the opened tab's location. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (browser()->tab_count() < 2) | 161 if (browser()->tab_count() < 2) |
162 ui_test_utils::WaitForNewTab(browser()); | 162 ui_test_utils::WaitForNewTab(browser()); |
163 | 163 |
164 // Opens in new tab. | 164 // Opens in new tab. |
165 EXPECT_EQ(2, browser()->tab_count()); | 165 EXPECT_EQ(2, browser()->tab_count()); |
166 EXPECT_EQ(1, browser()->active_index()); | 166 EXPECT_EQ(1, browser()->active_index()); |
167 EXPECT_EQ("/files/title2.html", | 167 EXPECT_EQ("/files/title2.html", |
168 chrome::GetActiveWebContents(browser())->GetURL().path()); | 168 chrome::GetActiveWebContents(browser())->GetURL().path()); |
169 | 169 |
170 // Wait for the cross-site transition in the new tab to finish. | 170 // Wait for the cross-site transition in the new tab to finish. |
171 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 171 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
172 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 172 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
173 chrome::GetActiveWebContents(browser())); | 173 chrome::GetActiveWebContents(browser())); |
174 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()-> | 174 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()-> |
175 pending_render_view_host()); | 175 pending_render_view_host()); |
176 | 176 |
177 // Should have a new SiteInstance. | 177 // Should have a new SiteInstance. |
178 scoped_refptr<SiteInstance> noref_blank_site_instance( | 178 scoped_refptr<SiteInstance> noref_blank_site_instance( |
179 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 179 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
180 EXPECT_NE(orig_site_instance, noref_blank_site_instance); | 180 EXPECT_NE(orig_site_instance, noref_blank_site_instance); |
181 } | 181 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (browser()->tab_count() < 2) | 219 if (browser()->tab_count() < 2) |
220 ui_test_utils::WaitForNewTab(browser()); | 220 ui_test_utils::WaitForNewTab(browser()); |
221 | 221 |
222 // Opens in new tab. | 222 // Opens in new tab. |
223 EXPECT_EQ(2, browser()->tab_count()); | 223 EXPECT_EQ(2, browser()->tab_count()); |
224 EXPECT_EQ(1, browser()->active_index()); | 224 EXPECT_EQ(1, browser()->active_index()); |
225 EXPECT_EQ("/files/title2.html", | 225 EXPECT_EQ("/files/title2.html", |
226 chrome::GetActiveWebContents(browser())->GetURL().path()); | 226 chrome::GetActiveWebContents(browser())->GetURL().path()); |
227 | 227 |
228 // Wait for the cross-site transition in the new tab to finish. | 228 // Wait for the cross-site transition in the new tab to finish. |
229 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 229 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
230 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 230 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
231 chrome::GetActiveWebContents(browser())); | 231 chrome::GetActiveWebContents(browser())); |
232 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()-> | 232 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()-> |
233 pending_render_view_host()); | 233 pending_render_view_host()); |
234 | 234 |
235 // Should have a new SiteInstance (in a new BrowsingInstance). | 235 // Should have a new SiteInstance (in a new BrowsingInstance). |
236 scoped_refptr<SiteInstance> noref_blank_site_instance( | 236 scoped_refptr<SiteInstance> noref_blank_site_instance( |
237 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 237 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
238 EXPECT_NE(orig_site_instance, noref_blank_site_instance); | 238 EXPECT_NE(orig_site_instance, noref_blank_site_instance); |
239 } | 239 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 // Wait for the tab to open. | 275 // Wait for the tab to open. |
276 if (browser()->tab_count() < 2) | 276 if (browser()->tab_count() < 2) |
277 ui_test_utils::WaitForNewTab(browser()); | 277 ui_test_utils::WaitForNewTab(browser()); |
278 | 278 |
279 // Opens in new tab. | 279 // Opens in new tab. |
280 EXPECT_EQ(2, browser()->tab_count()); | 280 EXPECT_EQ(2, browser()->tab_count()); |
281 EXPECT_EQ(1, browser()->active_index()); | 281 EXPECT_EQ(1, browser()->active_index()); |
282 | 282 |
283 // Wait for the cross-site transition in the new tab to finish. | 283 // Wait for the cross-site transition in the new tab to finish. |
284 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 284 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
285 EXPECT_EQ("/files/title2.html", | 285 EXPECT_EQ("/files/title2.html", |
286 chrome::GetActiveWebContents(browser())->GetURL().path()); | 286 chrome::GetActiveWebContents(browser())->GetURL().path()); |
287 | 287 |
288 // Should have the same SiteInstance. | 288 // Should have the same SiteInstance. |
289 scoped_refptr<SiteInstance> blank_site_instance( | 289 scoped_refptr<SiteInstance> blank_site_instance( |
290 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 290 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
291 EXPECT_EQ(orig_site_instance, blank_site_instance); | 291 EXPECT_EQ(orig_site_instance, blank_site_instance); |
292 } | 292 } |
293 | 293 |
294 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 294 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
(...skipping 24 matching lines...) Expand all Loading... |
319 | 319 |
320 // Test clicking a rel=noreferrer link. | 320 // Test clicking a rel=noreferrer link. |
321 bool success = false; | 321 bool success = false; |
322 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 322 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
323 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 323 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
324 L"window.domAutomationController.send(clickNoRefLink());", | 324 L"window.domAutomationController.send(clickNoRefLink());", |
325 &success)); | 325 &success)); |
326 EXPECT_TRUE(success); | 326 EXPECT_TRUE(success); |
327 | 327 |
328 // Wait for the cross-site transition in the current tab to finish. | 328 // Wait for the cross-site transition in the current tab to finish. |
329 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 329 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
330 | 330 |
331 // Opens in same tab. | 331 // Opens in same tab. |
332 EXPECT_EQ(1, browser()->tab_count()); | 332 EXPECT_EQ(1, browser()->tab_count()); |
333 EXPECT_EQ(0, browser()->active_index()); | 333 EXPECT_EQ(0, browser()->active_index()); |
334 EXPECT_EQ("/files/title2.html", | 334 EXPECT_EQ("/files/title2.html", |
335 chrome::GetActiveWebContents(browser())->GetURL().path()); | 335 chrome::GetActiveWebContents(browser())->GetURL().path()); |
336 | 336 |
337 // Should have the same SiteInstance. | 337 // Should have the same SiteInstance. |
338 scoped_refptr<SiteInstance> noref_site_instance( | 338 scoped_refptr<SiteInstance> noref_site_instance( |
339 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 339 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 375 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
376 &success)); | 376 &success)); |
377 EXPECT_TRUE(success); | 377 EXPECT_TRUE(success); |
378 new_tab_observer.Wait(); | 378 new_tab_observer.Wait(); |
379 | 379 |
380 // Opens in new tab. | 380 // Opens in new tab. |
381 EXPECT_EQ(2, browser()->tab_count()); | 381 EXPECT_EQ(2, browser()->tab_count()); |
382 EXPECT_EQ(1, browser()->active_index()); | 382 EXPECT_EQ(1, browser()->active_index()); |
383 | 383 |
384 // Wait for the navigation in the new tab to finish, if it hasn't. | 384 // Wait for the navigation in the new tab to finish, if it hasn't. |
385 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 385 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
386 EXPECT_EQ("/files/navigate_opener.html", | 386 EXPECT_EQ("/files/navigate_opener.html", |
387 chrome::GetActiveWebContents(browser())->GetURL().path()); | 387 chrome::GetActiveWebContents(browser())->GetURL().path()); |
388 EXPECT_EQ(1, browser()->active_index()); | 388 EXPECT_EQ(1, browser()->active_index()); |
389 | 389 |
390 // Should have the same SiteInstance. | 390 // Should have the same SiteInstance. |
391 scoped_refptr<SiteInstance> blank_site_instance( | 391 scoped_refptr<SiteInstance> blank_site_instance( |
392 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 392 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
393 EXPECT_EQ(orig_site_instance, blank_site_instance); | 393 EXPECT_EQ(orig_site_instance, blank_site_instance); |
394 | 394 |
395 // Now navigate the new tab to a different site. | 395 // Now navigate the new tab to a different site. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 483 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
484 opener_contents->GetRenderViewHost(), L"", | 484 opener_contents->GetRenderViewHost(), L"", |
485 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 485 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
486 &success)); | 486 &success)); |
487 EXPECT_TRUE(success); | 487 EXPECT_TRUE(success); |
488 new_tab_observer.Wait(); | 488 new_tab_observer.Wait(); |
489 | 489 |
490 // Wait for the navigation in the new tab to finish, if it hasn't, then | 490 // Wait for the navigation in the new tab to finish, if it hasn't, then |
491 // send it to post_message.html on a different site. | 491 // send it to post_message.html on a different site. |
492 content::WebContents* foo_contents = chrome::GetActiveWebContents(browser()); | 492 content::WebContents* foo_contents = chrome::GetActiveWebContents(browser()); |
493 ui_test_utils::WaitForLoadStop(foo_contents); | 493 content::WaitForLoadStop(foo_contents); |
494 EXPECT_EQ("/files/navigate_opener.html", foo_contents->GetURL().path()); | 494 EXPECT_EQ("/files/navigate_opener.html", foo_contents->GetURL().path()); |
495 EXPECT_EQ(1, browser()->active_index()); | 495 EXPECT_EQ(1, browser()->active_index()); |
496 ui_test_utils::NavigateToURL(browser(), | 496 ui_test_utils::NavigateToURL(browser(), |
497 https_server.GetURL("files/post_message.html")); | 497 https_server.GetURL("files/post_message.html")); |
498 scoped_refptr<SiteInstance> foo_site_instance( | 498 scoped_refptr<SiteInstance> foo_site_instance( |
499 foo_contents->GetSiteInstance()); | 499 foo_contents->GetSiteInstance()); |
500 EXPECT_NE(orig_site_instance, foo_site_instance); | 500 EXPECT_NE(orig_site_instance, foo_site_instance); |
501 | 501 |
502 // Second, a target=_blank window. | 502 // Second, a target=_blank window. |
503 chrome::ActivateTabAt(browser(), 0, true); | 503 chrome::ActivateTabAt(browser(), 0, true); |
504 ui_test_utils::WindowedTabAddedNotificationObserver new_tab_observer2(( | 504 ui_test_utils::WindowedTabAddedNotificationObserver new_tab_observer2(( |
505 content::Source<content::WebContentsDelegate>(browser()))); | 505 content::Source<content::WebContentsDelegate>(browser()))); |
506 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 506 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
507 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 507 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
508 L"window.domAutomationController.send(clickSameSiteTargetBlankLink());", | 508 L"window.domAutomationController.send(clickSameSiteTargetBlankLink());", |
509 &success)); | 509 &success)); |
510 EXPECT_TRUE(success); | 510 EXPECT_TRUE(success); |
511 new_tab_observer2.Wait(); | 511 new_tab_observer2.Wait(); |
512 | 512 |
513 // Wait for the navigation in the new tab to finish, if it hasn't, then | 513 // Wait for the navigation in the new tab to finish, if it hasn't, then |
514 // send it to post_message.html on the original site. | 514 // send it to post_message.html on the original site. |
515 content::WebContents* new_contents = chrome::GetActiveWebContents(browser()); | 515 content::WebContents* new_contents = chrome::GetActiveWebContents(browser()); |
516 ui_test_utils::WaitForLoadStop(new_contents); | 516 content::WaitForLoadStop(new_contents); |
517 EXPECT_EQ("/files/title2.html", new_contents->GetURL().path()); | 517 EXPECT_EQ("/files/title2.html", new_contents->GetURL().path()); |
518 EXPECT_EQ(1, browser()->active_index()); | 518 EXPECT_EQ(1, browser()->active_index()); |
519 ui_test_utils::NavigateToURL( | 519 ui_test_utils::NavigateToURL( |
520 browser(), test_server()->GetURL("files/post_message.html")); | 520 browser(), test_server()->GetURL("files/post_message.html")); |
521 EXPECT_EQ(orig_site_instance, new_contents->GetSiteInstance()); | 521 EXPECT_EQ(orig_site_instance, new_contents->GetSiteInstance()); |
522 RenderViewHostManager* new_manager = | 522 RenderViewHostManager* new_manager = |
523 static_cast<WebContentsImpl*>(new_contents)->GetRenderManagerForTesting(); | 523 static_cast<WebContentsImpl*>(new_contents)->GetRenderManagerForTesting(); |
524 | 524 |
525 // We now have three windows. The opener should have a swapped out RVH | 525 // We now have three windows. The opener should have a swapped out RVH |
526 // for the new SiteInstance, but the _blank window should not. | 526 // for the new SiteInstance, but the _blank window should not. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 620 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
621 &success)); | 621 &success)); |
622 EXPECT_TRUE(success); | 622 EXPECT_TRUE(success); |
623 new_tab_observer.Wait(); | 623 new_tab_observer.Wait(); |
624 | 624 |
625 // Opens in new tab. | 625 // Opens in new tab. |
626 EXPECT_EQ(2, browser()->tab_count()); | 626 EXPECT_EQ(2, browser()->tab_count()); |
627 EXPECT_EQ(1, browser()->active_index()); | 627 EXPECT_EQ(1, browser()->active_index()); |
628 | 628 |
629 // Wait for the navigation in the new tab to finish, if it hasn't. | 629 // Wait for the navigation in the new tab to finish, if it hasn't. |
630 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 630 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
631 EXPECT_EQ("/files/navigate_opener.html", | 631 EXPECT_EQ("/files/navigate_opener.html", |
632 chrome::GetActiveWebContents(browser())->GetURL().path()); | 632 chrome::GetActiveWebContents(browser())->GetURL().path()); |
633 EXPECT_EQ(1, browser()->active_index()); | 633 EXPECT_EQ(1, browser()->active_index()); |
634 | 634 |
635 // Should have the same SiteInstance. | 635 // Should have the same SiteInstance. |
636 scoped_refptr<SiteInstance> blank_site_instance( | 636 scoped_refptr<SiteInstance> blank_site_instance( |
637 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 637 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
638 EXPECT_EQ(orig_site_instance, blank_site_instance); | 638 EXPECT_EQ(orig_site_instance, blank_site_instance); |
639 | 639 |
640 // Now navigate the original (opener) tab to a different site. | 640 // Now navigate the original (opener) tab to a different site. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 704 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
705 &success)); | 705 &success)); |
706 EXPECT_TRUE(success); | 706 EXPECT_TRUE(success); |
707 new_tab_observer.Wait(); | 707 new_tab_observer.Wait(); |
708 | 708 |
709 // Opens in new tab. | 709 // Opens in new tab. |
710 EXPECT_EQ(2, browser()->tab_count()); | 710 EXPECT_EQ(2, browser()->tab_count()); |
711 EXPECT_EQ(1, browser()->active_index()); | 711 EXPECT_EQ(1, browser()->active_index()); |
712 | 712 |
713 // Wait for the navigation in the new tab to finish, if it hasn't. | 713 // Wait for the navigation in the new tab to finish, if it hasn't. |
714 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 714 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
715 EXPECT_EQ("/files/navigate_opener.html", | 715 EXPECT_EQ("/files/navigate_opener.html", |
716 chrome::GetActiveWebContents(browser())->GetURL().path()); | 716 chrome::GetActiveWebContents(browser())->GetURL().path()); |
717 EXPECT_EQ(1, browser()->active_index()); | 717 EXPECT_EQ(1, browser()->active_index()); |
718 | 718 |
719 // Should have the same SiteInstance. | 719 // Should have the same SiteInstance. |
720 scoped_refptr<SiteInstance> opened_site_instance( | 720 scoped_refptr<SiteInstance> opened_site_instance( |
721 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 721 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
722 EXPECT_EQ(orig_site_instance, opened_site_instance); | 722 EXPECT_EQ(orig_site_instance, opened_site_instance); |
723 | 723 |
724 // Now navigate the opened tab to a different site. | 724 // Now navigate the opened tab to a different site. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 // Renderer-initiated navigations should work. | 791 // Renderer-initiated navigations should work. |
792 bool success = false; | 792 bool success = false; |
793 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 793 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
794 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 794 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
795 L"window.domAutomationController.send(clickNoRefLink());", | 795 L"window.domAutomationController.send(clickNoRefLink());", |
796 &success)); | 796 &success)); |
797 EXPECT_TRUE(success); | 797 EXPECT_TRUE(success); |
798 | 798 |
799 // Wait for the cross-site transition in the current tab to finish. | 799 // Wait for the cross-site transition in the current tab to finish. |
800 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 800 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
801 | 801 |
802 // Opens in same tab. | 802 // Opens in same tab. |
803 EXPECT_EQ(1, browser()->tab_count()); | 803 EXPECT_EQ(1, browser()->tab_count()); |
804 EXPECT_EQ(0, browser()->active_index()); | 804 EXPECT_EQ(0, browser()->active_index()); |
805 EXPECT_EQ("/files/title2.html", | 805 EXPECT_EQ("/files/title2.html", |
806 chrome::GetActiveWebContents(browser())->GetURL().path()); | 806 chrome::GetActiveWebContents(browser())->GetURL().path()); |
807 | 807 |
808 // Should have the same SiteInstance. | 808 // Should have the same SiteInstance. |
809 scoped_refptr<SiteInstance> noref_site_instance( | 809 scoped_refptr<SiteInstance> noref_site_instance( |
810 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 810 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 967 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
968 &success)); | 968 &success)); |
969 EXPECT_TRUE(success); | 969 EXPECT_TRUE(success); |
970 new_tab_observer.Wait(); | 970 new_tab_observer.Wait(); |
971 | 971 |
972 // Opens in new tab. | 972 // Opens in new tab. |
973 EXPECT_EQ(2, browser()->tab_count()); | 973 EXPECT_EQ(2, browser()->tab_count()); |
974 EXPECT_EQ(1, browser()->active_index()); | 974 EXPECT_EQ(1, browser()->active_index()); |
975 | 975 |
976 // Wait for the navigation in the new tab to finish, if it hasn't. | 976 // Wait for the navigation in the new tab to finish, if it hasn't. |
977 ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser())); | 977 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); |
978 EXPECT_EQ("/files/navigate_opener.html", | 978 EXPECT_EQ("/files/navigate_opener.html", |
979 chrome::GetActiveWebContents(browser())->GetURL().path()); | 979 chrome::GetActiveWebContents(browser())->GetURL().path()); |
980 EXPECT_EQ(1, browser()->active_index()); | 980 EXPECT_EQ(1, browser()->active_index()); |
981 | 981 |
982 RenderViewHost* rvh = | 982 RenderViewHost* rvh = |
983 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 983 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
984 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 984 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
985 rvh, L"", | 985 rvh, L"", |
986 L"window.domAutomationController.send(" | 986 L"window.domAutomationController.send(" |
987 L"document.webkitVisibilityState == 'visible');", | 987 L"document.webkitVisibilityState == 'visible');", |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // Now navigate to a different instance so that we swap out again. | 1113 // Now navigate to a different instance so that we swap out again. |
1114 ui_test_utils::NavigateToURL(browser(), | 1114 ui_test_utils::NavigateToURL(browser(), |
1115 https_server.GetURL("files/title2.html")); | 1115 https_server.GetURL("files/title2.html")); |
1116 rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())-> | 1116 rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())-> |
1117 GetRenderViewHost()); | 1117 GetRenderViewHost()); |
1118 | 1118 |
1119 // This used to leak a render view host. | 1119 // This used to leak a render view host. |
1120 chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser())); | 1120 chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser())); |
1121 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); | 1121 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); |
1122 } | 1122 } |
OLD | NEW |