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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: fix ContentResourceProviderTest Created 3 years, 11 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <tuple> 9 #include <tuple>
10 #include <utility> 10 #include <utility>
(...skipping 23 matching lines...) Expand all
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "content/public/browser/notification_types.h" 35 #include "content/public/browser/notification_types.h"
36 #include "content/public/browser/render_process_host.h" 36 #include "content/public/browser/render_process_host.h"
37 #include "content/public/browser/render_widget_host_iterator.h" 37 #include "content/public/browser/render_widget_host_iterator.h"
38 #include "content/public/browser/web_contents_delegate.h" 38 #include "content/public/browser/web_contents_delegate.h"
39 #include "content/public/browser/web_contents_observer.h" 39 #include "content/public/browser/web_contents_observer.h"
40 #include "content/public/browser/web_ui_controller.h" 40 #include "content/public/browser/web_ui_controller.h"
41 #include "content/public/common/bindings_policy.h" 41 #include "content/public/common/bindings_policy.h"
42 #include "content/public/common/browser_side_navigation_policy.h" 42 #include "content/public/common/browser_side_navigation_policy.h"
43 #include "content/public/common/javascript_message_type.h" 43 #include "content/public/common/javascript_message_type.h"
44 #include "content/public/common/previews_state.h"
44 #include "content/public/common/url_constants.h" 45 #include "content/public/common/url_constants.h"
45 #include "content/public/common/url_utils.h" 46 #include "content/public/common/url_utils.h"
46 #include "content/public/test/browser_side_navigation_test_utils.h" 47 #include "content/public/test/browser_side_navigation_test_utils.h"
47 #include "content/public/test/mock_render_process_host.h" 48 #include "content/public/test/mock_render_process_host.h"
48 #include "content/public/test/test_notification_tracker.h" 49 #include "content/public/test/test_notification_tracker.h"
49 #include "content/public/test/test_utils.h" 50 #include "content/public/test/test_utils.h"
50 #include "content/test/test_content_browser_client.h" 51 #include "content/test/test_content_browser_client.h"
51 #include "content/test/test_content_client.h" 52 #include "content/test/test_content_client.h"
52 #include "content/test/test_render_frame_host.h" 53 #include "content/test/test_render_frame_host.h"
53 #include "content/test/test_render_view_host.h" 54 #include "content/test/test_render_view_host.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 ->navigator() 430 ->navigator()
430 ->GetController()); 431 ->GetController());
431 FrameMsg_Navigate_Type::Value navigate_type = 432 FrameMsg_Navigate_Type::Value navigate_type =
432 entry.restore_type() == RestoreType::NONE 433 entry.restore_type() == RestoreType::NONE
433 ? FrameMsg_Navigate_Type::NORMAL 434 ? FrameMsg_Navigate_Type::NORMAL
434 : FrameMsg_Navigate_Type::RESTORE; 435 : FrameMsg_Navigate_Type::RESTORE;
435 std::unique_ptr<NavigationRequest> navigation_request = 436 std::unique_ptr<NavigationRequest> navigation_request =
436 NavigationRequest::CreateBrowserInitiated( 437 NavigationRequest::CreateBrowserInitiated(
437 manager->frame_tree_node_, frame_entry->url(), 438 manager->frame_tree_node_, frame_entry->url(),
438 frame_entry->referrer(), *frame_entry, entry, navigate_type, 439 frame_entry->referrer(), *frame_entry, entry, navigate_type,
439 LOFI_UNSPECIFIED, false, false, base::TimeTicks::Now(), 440 PREVIEWS_UNSPECIFIED, false, false, base::TimeTicks::Now(),
440 controller); 441 controller);
441 442
442 // Simulates request creation that triggers the 1st internal call to 443 // Simulates request creation that triggers the 1st internal call to
443 // GetFrameHostForNavigation. 444 // GetFrameHostForNavigation.
444 manager->DidCreateNavigationRequest(navigation_request.get()); 445 manager->DidCreateNavigationRequest(navigation_request.get());
445 446
446 // And also simulates the 2nd and final call to GetFrameHostForNavigation 447 // And also simulates the 2nd and final call to GetFrameHostForNavigation
447 // that determines the final frame that will commit the navigation. 448 // that determines the final frame that will commit the navigation.
448 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>( 449 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>(
449 manager->GetFrameHostForNavigation(*navigation_request)); 450 manager->GetFrameHostForNavigation(*navigation_request));
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 const GURL kUrl("chrome://foo"); 2833 const GURL kUrl("chrome://foo");
2833 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2834 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2834 Referrer(), base::string16() /* title */, 2835 Referrer(), base::string16() /* title */,
2835 ui::PAGE_TRANSITION_TYPED, 2836 ui::PAGE_TRANSITION_TYPED,
2836 false /* is_renderer_init */); 2837 false /* is_renderer_init */);
2837 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2838 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2838 std::unique_ptr<NavigationRequest> navigation_request = 2839 std::unique_ptr<NavigationRequest> navigation_request =
2839 NavigationRequest::CreateBrowserInitiated( 2840 NavigationRequest::CreateBrowserInitiated(
2840 contents()->GetFrameTree()->root(), frame_entry->url(), 2841 contents()->GetFrameTree()->root(), frame_entry->url(),
2841 frame_entry->referrer(), *frame_entry, entry, 2842 frame_entry->referrer(), *frame_entry, entry,
2842 FrameMsg_Navigate_Type::NORMAL, LOFI_UNSPECIFIED, false, false, 2843 FrameMsg_Navigate_Type::NORMAL, PREVIEWS_UNSPECIFIED, false, false,
2843 base::TimeTicks::Now(), 2844 base::TimeTicks::Now(),
2844 static_cast<NavigationControllerImpl*>(&controller())); 2845 static_cast<NavigationControllerImpl*>(&controller()));
2845 manager->DidCreateNavigationRequest(navigation_request.get()); 2846 manager->DidCreateNavigationRequest(navigation_request.get());
2846 2847
2847 // As the initial RenderFrame was not live, the new RenderFrameHost should be 2848 // As the initial RenderFrame was not live, the new RenderFrameHost should be
2848 // made as active/current immediately along with its WebUI at request time. 2849 // made as active/current immediately along with its WebUI at request time.
2849 RenderFrameHostImpl* host = manager->current_frame_host(); 2850 RenderFrameHostImpl* host = manager->current_frame_host();
2850 ASSERT_TRUE(host); 2851 ASSERT_TRUE(host);
2851 EXPECT_NE(host, initial_host); 2852 EXPECT_NE(host, initial_host);
2852 EXPECT_TRUE(host->IsRenderFrameLive()); 2853 EXPECT_TRUE(host->IsRenderFrameLive());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 const GURL kUrl("chrome://foo/bar"); 2894 const GURL kUrl("chrome://foo/bar");
2894 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2895 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2895 Referrer(), base::string16() /* title */, 2896 Referrer(), base::string16() /* title */,
2896 ui::PAGE_TRANSITION_TYPED, 2897 ui::PAGE_TRANSITION_TYPED,
2897 false /* is_renderer_init */); 2898 false /* is_renderer_init */);
2898 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2899 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2899 std::unique_ptr<NavigationRequest> navigation_request = 2900 std::unique_ptr<NavigationRequest> navigation_request =
2900 NavigationRequest::CreateBrowserInitiated( 2901 NavigationRequest::CreateBrowserInitiated(
2901 contents()->GetFrameTree()->root(), frame_entry->url(), 2902 contents()->GetFrameTree()->root(), frame_entry->url(),
2902 frame_entry->referrer(), *frame_entry, entry, 2903 frame_entry->referrer(), *frame_entry, entry,
2903 FrameMsg_Navigate_Type::NORMAL, LOFI_UNSPECIFIED, false, false, 2904 FrameMsg_Navigate_Type::NORMAL, PREVIEWS_UNSPECIFIED, false, false,
2904 base::TimeTicks::Now(), 2905 base::TimeTicks::Now(),
2905 static_cast<NavigationControllerImpl*>(&controller())); 2906 static_cast<NavigationControllerImpl*>(&controller()));
2906 manager->DidCreateNavigationRequest(navigation_request.get()); 2907 manager->DidCreateNavigationRequest(navigation_request.get());
2907 2908
2908 // The current WebUI should still be in place and the pending WebUI should be 2909 // The current WebUI should still be in place and the pending WebUI should be
2909 // set to reuse it. 2910 // set to reuse it.
2910 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2911 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2911 EXPECT_EQ(web_ui, host->web_ui()); 2912 EXPECT_EQ(web_ui, host->web_ui());
2912 EXPECT_EQ(web_ui, host->pending_web_ui()); 2913 EXPECT_EQ(web_ui, host->pending_web_ui());
2913 EXPECT_FALSE(GetPendingFrameHost(manager)); 2914 EXPECT_FALSE(GetPendingFrameHost(manager));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 const GURL kUrl("chrome://bar"); 2952 const GURL kUrl("chrome://bar");
2952 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2953 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2953 Referrer(), base::string16() /* title */, 2954 Referrer(), base::string16() /* title */,
2954 ui::PAGE_TRANSITION_TYPED, 2955 ui::PAGE_TRANSITION_TYPED,
2955 false /* is_renderer_init */); 2956 false /* is_renderer_init */);
2956 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2957 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2957 std::unique_ptr<NavigationRequest> navigation_request = 2958 std::unique_ptr<NavigationRequest> navigation_request =
2958 NavigationRequest::CreateBrowserInitiated( 2959 NavigationRequest::CreateBrowserInitiated(
2959 contents()->GetFrameTree()->root(), frame_entry->url(), 2960 contents()->GetFrameTree()->root(), frame_entry->url(),
2960 frame_entry->referrer(), *frame_entry, entry, 2961 frame_entry->referrer(), *frame_entry, entry,
2961 FrameMsg_Navigate_Type::NORMAL, LOFI_UNSPECIFIED, false, false, 2962 FrameMsg_Navigate_Type::NORMAL, PREVIEWS_UNSPECIFIED, false, false,
2962 base::TimeTicks::Now(), 2963 base::TimeTicks::Now(),
2963 static_cast<NavigationControllerImpl*>(&controller())); 2964 static_cast<NavigationControllerImpl*>(&controller()));
2964 manager->DidCreateNavigationRequest(navigation_request.get()); 2965 manager->DidCreateNavigationRequest(navigation_request.get());
2965 2966
2966 // The current WebUI should still be in place and there should be a new 2967 // The current WebUI should still be in place and there should be a new
2967 // active WebUI instance in the speculative RenderFrameHost. 2968 // active WebUI instance in the speculative RenderFrameHost.
2968 EXPECT_TRUE(manager->current_frame_host()->web_ui()); 2969 EXPECT_TRUE(manager->current_frame_host()->web_ui());
2969 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); 2970 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui());
2970 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); 2971 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager);
2971 EXPECT_TRUE(speculative_host); 2972 EXPECT_TRUE(speculative_host);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 ASSERT_FALSE(delete_observer.deleted()); 3149 ASSERT_FALSE(delete_observer.deleted());
3149 EXPECT_FALSE(initial_rfh->is_active()); 3150 EXPECT_FALSE(initial_rfh->is_active());
3150 3151
3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not 3152 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not
3152 // create a NavigationHandle. 3153 // create a NavigationHandle.
3153 initial_rfh->SimulateNavigationStart(kUrl3); 3154 initial_rfh->SimulateNavigationStart(kUrl3);
3154 EXPECT_FALSE(initial_rfh->navigation_handle()); 3155 EXPECT_FALSE(initial_rfh->navigation_handle());
3155 } 3156 }
3156 3157
3157 } // namespace content 3158 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698