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 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2436 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
2436 | 2437 |
2437 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2438 // It is safe to obtain the root frame tree node here, as it doesn't change. |
2438 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 2439 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
2439 FrameTreeNode* child = root->child_at(0); | 2440 FrameTreeNode* child = root->child_at(0); |
2440 GURL url_a = child->current_url(); | 2441 GURL url_a = child->current_url(); |
2441 | 2442 |
2442 // Disable host resolution in the test server and try to navigate the subframe | 2443 // Disable host resolution in the test server and try to navigate the subframe |
2443 // cross-site, which will lead to a committed net error. | 2444 // cross-site, which will lead to a committed net error. |
2444 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); | 2445 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); |
2445 bool network_service = base::CommandLine::ForCurrentProcess()->HasSwitch( | 2446 bool network_service = |
2446 switches::kEnableNetworkService); | 2447 base::FeatureList::IsEnabled(features::kNetworkService); |
2447 mojom::URLLoaderFactoryPtr failing_factory; | 2448 mojom::URLLoaderFactoryPtr failing_factory; |
2448 mojo::MakeStrongBinding(base::MakeUnique<FailingLoadFactory>(), | 2449 mojo::MakeStrongBinding(base::MakeUnique<FailingLoadFactory>(), |
2449 mojo::MakeRequest(&failing_factory)); | 2450 mojo::MakeRequest(&failing_factory)); |
2450 StoragePartitionImpl* storage_partition = nullptr; | 2451 StoragePartitionImpl* storage_partition = nullptr; |
2451 if (network_service) { | 2452 if (network_service) { |
2452 storage_partition = static_cast<StoragePartitionImpl*>( | 2453 storage_partition = static_cast<StoragePartitionImpl*>( |
2453 BrowserContext::GetDefaultStoragePartition( | 2454 BrowserContext::GetDefaultStoragePartition( |
2454 shell()->web_contents()->GetBrowserContext())); | 2455 shell()->web_contents()->GetBrowserContext())); |
2455 storage_partition->url_loader_factory_getter()->SetNetworkFactoryForTesting( | 2456 storage_partition->url_loader_factory_getter()->SetNetworkFactoryForTesting( |
2456 std::move(failing_factory)); | 2457 std::move(failing_factory)); |
(...skipping 7964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10421 | 10422 |
10422 // The new tab's grandchild frame should reuse the b.com process. | 10423 // The new tab's grandchild frame should reuse the b.com process. |
10423 EXPECT_EQ(root->child_at(0)->current_frame_host()->GetProcess(), | 10424 EXPECT_EQ(root->child_at(0)->current_frame_host()->GetProcess(), |
10424 new_shell_root->child_at(0) | 10425 new_shell_root->child_at(0) |
10425 ->child_at(0) | 10426 ->child_at(0) |
10426 ->current_frame_host() | 10427 ->current_frame_host() |
10427 ->GetProcess()); | 10428 ->GetProcess()); |
10428 } | 10429 } |
10429 | 10430 |
10430 } // namespace content | 10431 } // namespace content |
OLD | NEW |