OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <set> | 5 #include <set> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 shell()->web_contents()->GetLastCommittedURL().path()); | 330 shell()->web_contents()->GetLastCommittedURL().path()); |
331 | 331 |
332 // Should have the same SiteInstance. | 332 // Should have the same SiteInstance. |
333 scoped_refptr<SiteInstance> noref_site_instance( | 333 scoped_refptr<SiteInstance> noref_site_instance( |
334 shell()->web_contents()->GetSiteInstance()); | 334 shell()->web_contents()->GetSiteInstance()); |
335 EXPECT_EQ(orig_site_instance, noref_site_instance); | 335 EXPECT_EQ(orig_site_instance, noref_site_instance); |
336 } | 336 } |
337 | 337 |
338 // Test for crbug.com/116192. Targeted links should still work after the | 338 // Test for crbug.com/116192. Targeted links should still work after the |
339 // named target window has swapped processes. | 339 // named target window has swapped processes. |
340 // | |
341 // Flaky under TSANv2. http://crbug.com/400850 | |
342 #if defined(THREAD_SANITIZER) | |
343 #define MAYBE_AllowTargetedNavigationsAfterSwap \ | |
344 DISABLED_AllowTargetedNavigationsAfterSwap | |
345 #else | |
346 #define MAYBE_AllowTargetedNavigationsAfterSwap \ | |
347 AllowTargetedNavigationsAfterSwap | |
348 #endif | |
340 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 349 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
341 AllowTargetedNavigationsAfterSwap) { | 350 MAYBE_AllowTargetedNavigationsAfterSwap) { |
342 StartServer(); | 351 StartServer(); |
343 | 352 |
344 // Load a page with links that open in a new window. | 353 // Load a page with links that open in a new window. |
345 std::string replacement_path; | 354 std::string replacement_path; |
346 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 355 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
347 "files/click-noreferrer-links.html", | 356 "files/click-noreferrer-links.html", |
348 foo_host_port_, | 357 foo_host_port_, |
349 &replacement_path)); | 358 &replacement_path)); |
350 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 359 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
351 | 360 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 navigation_observer.Wait(); | 400 navigation_observer.Wait(); |
392 | 401 |
393 // Should have swapped back and shown the new window again. | 402 // Should have swapped back and shown the new window again. |
394 scoped_refptr<SiteInstance> revisit_site_instance( | 403 scoped_refptr<SiteInstance> revisit_site_instance( |
395 new_shell->web_contents()->GetSiteInstance()); | 404 new_shell->web_contents()->GetSiteInstance()); |
396 EXPECT_EQ(orig_site_instance, revisit_site_instance); | 405 EXPECT_EQ(orig_site_instance, revisit_site_instance); |
397 | 406 |
398 // If it navigates away to another process, the original window should | 407 // If it navigates away to another process, the original window should |
399 // still be able to close it (using a cross-process close message). | 408 // still be able to close it (using a cross-process close message). |
400 NavigateToURL(new_shell, cross_site_url); | 409 NavigateToURL(new_shell, cross_site_url); |
401 EXPECT_EQ(new_site_instance, | 410 EXPECT_EQ(new_site_instance, |
Charlie Reis
2014/08/05 21:49:52
Actually, this is not an important part of the tes
| |
402 new_shell->web_contents()->GetSiteInstance()); | 411 new_shell->web_contents()->GetSiteInstance()); |
403 WebContentsDestroyedWatcher close_watcher(new_shell->web_contents()); | 412 WebContentsDestroyedWatcher close_watcher(new_shell->web_contents()); |
404 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 413 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
405 shell()->web_contents(), | 414 shell()->web_contents(), |
406 "window.domAutomationController.send(testCloseWindow());", | 415 "window.domAutomationController.send(testCloseWindow());", |
407 &success)); | 416 &success)); |
408 EXPECT_TRUE(success); | 417 EXPECT_TRUE(success); |
409 close_watcher.Wait(); | 418 close_watcher.Wait(); |
410 } | 419 } |
411 | 420 |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1457 // Navigate to url1 and check bindings. | 1466 // Navigate to url1 and check bindings. |
1458 NavigateToURL(new_shell, url1); | 1467 NavigateToURL(new_shell, url1); |
1459 // The navigation should have used the first SiteInstance, otherwise | 1468 // The navigation should have used the first SiteInstance, otherwise |
1460 // |initial_rvh| did not have a chance to be used. | 1469 // |initial_rvh| did not have a chance to be used. |
1461 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); | 1470 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); |
1462 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, | 1471 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, |
1463 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); | 1472 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); |
1464 } | 1473 } |
1465 | 1474 |
1466 } // namespace content | 1475 } // namespace content |
OLD | NEW |