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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "content/common/view_messages.h" | 57 #include "content/common/view_messages.h" |
58 #include "content/public/browser/browser_context.h" | 58 #include "content/public/browser/browser_context.h" |
59 #include "content/public/browser/browser_thread.h" | 59 #include "content/public/browser/browser_thread.h" |
60 #include "content/public/browser/interstitial_page_delegate.h" | 60 #include "content/public/browser/interstitial_page_delegate.h" |
61 #include "content/public/browser/navigation_handle.h" | 61 #include "content/public/browser/navigation_handle.h" |
62 #include "content/public/browser/notification_observer.h" | 62 #include "content/public/browser/notification_observer.h" |
63 #include "content/public/browser/notification_service.h" | 63 #include "content/public/browser/notification_service.h" |
64 #include "content/public/browser/notification_types.h" | 64 #include "content/public/browser/notification_types.h" |
65 #include "content/public/browser/resource_dispatcher_host.h" | 65 #include "content/public/browser/resource_dispatcher_host.h" |
66 #include "content/public/common/browser_side_navigation_policy.h" | 66 #include "content/public/common/browser_side_navigation_policy.h" |
| 67 #include "content/public/common/content_features.h" |
67 #include "content/public/common/content_switches.h" | 68 #include "content/public/common/content_switches.h" |
68 #include "content/public/common/url_constants.h" | 69 #include "content/public/common/url_constants.h" |
69 #include "content/public/test/browser_test_utils.h" | 70 #include "content/public/test/browser_test_utils.h" |
70 #include "content/public/test/content_browser_test_utils.h" | 71 #include "content/public/test/content_browser_test_utils.h" |
71 #include "content/public/test/navigation_handle_observer.h" | 72 #include "content/public/test/navigation_handle_observer.h" |
72 #include "content/public/test/test_frame_navigation_observer.h" | 73 #include "content/public/test/test_frame_navigation_observer.h" |
73 #include "content/public/test/test_navigation_observer.h" | 74 #include "content/public/test/test_navigation_observer.h" |
74 #include "content/public/test/test_utils.h" | 75 #include "content/public/test/test_utils.h" |
75 #include "content/shell/browser/shell.h" | 76 #include "content/shell/browser/shell.h" |
76 #include "content/test/content_browser_test_utils_internal.h" | 77 #include "content/test/content_browser_test_utils_internal.h" |
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2494 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
2494 | 2495 |
2495 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2496 // It is safe to obtain the root frame tree node here, as it doesn't change. |
2496 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 2497 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
2497 FrameTreeNode* child = root->child_at(0); | 2498 FrameTreeNode* child = root->child_at(0); |
2498 GURL url_a = child->current_url(); | 2499 GURL url_a = child->current_url(); |
2499 | 2500 |
2500 // Disable host resolution in the test server and try to navigate the subframe | 2501 // Disable host resolution in the test server and try to navigate the subframe |
2501 // cross-site, which will lead to a committed net error. | 2502 // cross-site, which will lead to a committed net error. |
2502 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); | 2503 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); |
2503 bool network_service = base::CommandLine::ForCurrentProcess()->HasSwitch( | 2504 bool network_service = |
2504 switches::kEnableNetworkService); | 2505 base::FeatureList::IsEnabled(features::kNetworkService); |
2505 mojom::URLLoaderFactoryPtr failing_factory; | 2506 mojom::URLLoaderFactoryPtr failing_factory; |
2506 mojo::MakeStrongBinding(base::MakeUnique<FailingLoadFactory>(), | 2507 mojo::MakeStrongBinding(base::MakeUnique<FailingLoadFactory>(), |
2507 mojo::MakeRequest(&failing_factory)); | 2508 mojo::MakeRequest(&failing_factory)); |
2508 StoragePartitionImpl* storage_partition = nullptr; | 2509 StoragePartitionImpl* storage_partition = nullptr; |
2509 if (network_service) { | 2510 if (network_service) { |
2510 storage_partition = static_cast<StoragePartitionImpl*>( | 2511 storage_partition = static_cast<StoragePartitionImpl*>( |
2511 BrowserContext::GetDefaultStoragePartition( | 2512 BrowserContext::GetDefaultStoragePartition( |
2512 shell()->web_contents()->GetBrowserContext())); | 2513 shell()->web_contents()->GetBrowserContext())); |
2513 storage_partition->url_loader_factory_getter()->SetNetworkFactoryForTesting( | 2514 storage_partition->url_loader_factory_getter()->SetNetworkFactoryForTesting( |
2514 std::move(failing_factory)); | 2515 std::move(failing_factory)); |
(...skipping 7964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10479 | 10480 |
10480 // The new tab's grandchild frame should reuse the b.com process. | 10481 // The new tab's grandchild frame should reuse the b.com process. |
10481 EXPECT_EQ(root->child_at(0)->current_frame_host()->GetProcess(), | 10482 EXPECT_EQ(root->child_at(0)->current_frame_host()->GetProcess(), |
10482 new_shell_root->child_at(0) | 10483 new_shell_root->child_at(0) |
10483 ->child_at(0) | 10484 ->child_at(0) |
10484 ->current_frame_host() | 10485 ->current_frame_host() |
10485 ->GetProcess()); | 10486 ->GetProcess()); |
10486 } | 10487 } |
10487 | 10488 |
10488 } // namespace content | 10489 } // namespace content |
OLD | NEW |