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

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: remove previews_unspecified Created 4 years 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
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 ->navigator() 429 ->navigator()
430 ->GetController()); 430 ->GetController());
431 FrameMsg_Navigate_Type::Value navigate_type = 431 FrameMsg_Navigate_Type::Value navigate_type =
432 entry.restore_type() == RestoreType::NONE 432 entry.restore_type() == RestoreType::NONE
433 ? FrameMsg_Navigate_Type::NORMAL 433 ? FrameMsg_Navigate_Type::NORMAL
434 : FrameMsg_Navigate_Type::RESTORE; 434 : FrameMsg_Navigate_Type::RESTORE;
435 std::unique_ptr<NavigationRequest> navigation_request = 435 std::unique_ptr<NavigationRequest> navigation_request =
436 NavigationRequest::CreateBrowserInitiated( 436 NavigationRequest::CreateBrowserInitiated(
437 manager->frame_tree_node_, frame_entry->url(), 437 manager->frame_tree_node_, frame_entry->url(),
438 frame_entry->referrer(), *frame_entry, entry, navigate_type, 438 frame_entry->referrer(), *frame_entry, entry, navigate_type,
439 LOFI_UNSPECIFIED, false, false, base::TimeTicks::Now(), 439 0, false, false, base::TimeTicks::Now(), controller);
440 controller);
441 440
442 // Simulates request creation that triggers the 1st internal call to 441 // Simulates request creation that triggers the 1st internal call to
443 // GetFrameHostForNavigation. 442 // GetFrameHostForNavigation.
444 manager->DidCreateNavigationRequest(navigation_request.get()); 443 manager->DidCreateNavigationRequest(navigation_request.get());
445 444
446 // And also simulates the 2nd and final call to GetFrameHostForNavigation 445 // And also simulates the 2nd and final call to GetFrameHostForNavigation
447 // that determines the final frame that will commit the navigation. 446 // that determines the final frame that will commit the navigation.
448 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>( 447 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>(
449 manager->GetFrameHostForNavigation(*navigation_request)); 448 manager->GetFrameHostForNavigation(*navigation_request));
450 CHECK(frame_host); 449 CHECK(frame_host);
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 const GURL kUrl("chrome://foo"); 2831 const GURL kUrl("chrome://foo");
2833 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2832 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2834 Referrer(), base::string16() /* title */, 2833 Referrer(), base::string16() /* title */,
2835 ui::PAGE_TRANSITION_TYPED, 2834 ui::PAGE_TRANSITION_TYPED,
2836 false /* is_renderer_init */); 2835 false /* is_renderer_init */);
2837 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2836 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2838 std::unique_ptr<NavigationRequest> navigation_request = 2837 std::unique_ptr<NavigationRequest> navigation_request =
2839 NavigationRequest::CreateBrowserInitiated( 2838 NavigationRequest::CreateBrowserInitiated(
2840 contents()->GetFrameTree()->root(), frame_entry->url(), 2839 contents()->GetFrameTree()->root(), frame_entry->url(),
2841 frame_entry->referrer(), *frame_entry, entry, 2840 frame_entry->referrer(), *frame_entry, entry,
2842 FrameMsg_Navigate_Type::NORMAL, LOFI_UNSPECIFIED, false, false, 2841 FrameMsg_Navigate_Type::NORMAL, 0, false, false,
2843 base::TimeTicks::Now(), 2842 base::TimeTicks::Now(),
2844 static_cast<NavigationControllerImpl*>(&controller())); 2843 static_cast<NavigationControllerImpl*>(&controller()));
2845 manager->DidCreateNavigationRequest(navigation_request.get()); 2844 manager->DidCreateNavigationRequest(navigation_request.get());
2846 2845
2847 // As the initial RenderFrame was not live, the new RenderFrameHost should be 2846 // 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. 2847 // made as active/current immediately along with its WebUI at request time.
2849 RenderFrameHostImpl* host = manager->current_frame_host(); 2848 RenderFrameHostImpl* host = manager->current_frame_host();
2850 ASSERT_TRUE(host); 2849 ASSERT_TRUE(host);
2851 EXPECT_NE(host, initial_host); 2850 EXPECT_NE(host, initial_host);
2852 EXPECT_TRUE(host->IsRenderFrameLive()); 2851 EXPECT_TRUE(host->IsRenderFrameLive());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 const GURL kUrl("chrome://foo/bar"); 2892 const GURL kUrl("chrome://foo/bar");
2894 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2893 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2895 Referrer(), base::string16() /* title */, 2894 Referrer(), base::string16() /* title */,
2896 ui::PAGE_TRANSITION_TYPED, 2895 ui::PAGE_TRANSITION_TYPED,
2897 false /* is_renderer_init */); 2896 false /* is_renderer_init */);
2898 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2897 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2899 std::unique_ptr<NavigationRequest> navigation_request = 2898 std::unique_ptr<NavigationRequest> navigation_request =
2900 NavigationRequest::CreateBrowserInitiated( 2899 NavigationRequest::CreateBrowserInitiated(
2901 contents()->GetFrameTree()->root(), frame_entry->url(), 2900 contents()->GetFrameTree()->root(), frame_entry->url(),
2902 frame_entry->referrer(), *frame_entry, entry, 2901 frame_entry->referrer(), *frame_entry, entry,
2903 FrameMsg_Navigate_Type::NORMAL, LOFI_UNSPECIFIED, false, false, 2902 FrameMsg_Navigate_Type::NORMAL, 0, false, false,
2904 base::TimeTicks::Now(), 2903 base::TimeTicks::Now(),
2905 static_cast<NavigationControllerImpl*>(&controller())); 2904 static_cast<NavigationControllerImpl*>(&controller()));
2906 manager->DidCreateNavigationRequest(navigation_request.get()); 2905 manager->DidCreateNavigationRequest(navigation_request.get());
2907 2906
2908 // The current WebUI should still be in place and the pending WebUI should be 2907 // The current WebUI should still be in place and the pending WebUI should be
2909 // set to reuse it. 2908 // set to reuse it.
2910 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2909 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2911 EXPECT_EQ(web_ui, host->web_ui()); 2910 EXPECT_EQ(web_ui, host->web_ui());
2912 EXPECT_EQ(web_ui, host->pending_web_ui()); 2911 EXPECT_EQ(web_ui, host->pending_web_ui());
2913 EXPECT_FALSE(GetPendingFrameHost(manager)); 2912 EXPECT_FALSE(GetPendingFrameHost(manager));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 const GURL kUrl("chrome://bar"); 2950 const GURL kUrl("chrome://bar");
2952 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2951 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2953 Referrer(), base::string16() /* title */, 2952 Referrer(), base::string16() /* title */,
2954 ui::PAGE_TRANSITION_TYPED, 2953 ui::PAGE_TRANSITION_TYPED,
2955 false /* is_renderer_init */); 2954 false /* is_renderer_init */);
2956 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2955 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2957 std::unique_ptr<NavigationRequest> navigation_request = 2956 std::unique_ptr<NavigationRequest> navigation_request =
2958 NavigationRequest::CreateBrowserInitiated( 2957 NavigationRequest::CreateBrowserInitiated(
2959 contents()->GetFrameTree()->root(), frame_entry->url(), 2958 contents()->GetFrameTree()->root(), frame_entry->url(),
2960 frame_entry->referrer(), *frame_entry, entry, 2959 frame_entry->referrer(), *frame_entry, entry,
2961 FrameMsg_Navigate_Type::NORMAL, LOFI_UNSPECIFIED, false, false, 2960 FrameMsg_Navigate_Type::NORMAL, 0, false, false,
2962 base::TimeTicks::Now(), 2961 base::TimeTicks::Now(),
2963 static_cast<NavigationControllerImpl*>(&controller())); 2962 static_cast<NavigationControllerImpl*>(&controller()));
2964 manager->DidCreateNavigationRequest(navigation_request.get()); 2963 manager->DidCreateNavigationRequest(navigation_request.get());
2965 2964
2966 // The current WebUI should still be in place and there should be a new 2965 // The current WebUI should still be in place and there should be a new
2967 // active WebUI instance in the speculative RenderFrameHost. 2966 // active WebUI instance in the speculative RenderFrameHost.
2968 EXPECT_TRUE(manager->current_frame_host()->web_ui()); 2967 EXPECT_TRUE(manager->current_frame_host()->web_ui());
2969 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); 2968 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui());
2970 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); 2969 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager);
2971 EXPECT_TRUE(speculative_host); 2970 EXPECT_TRUE(speculative_host);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 ASSERT_FALSE(delete_observer.deleted()); 3147 ASSERT_FALSE(delete_observer.deleted());
3149 EXPECT_FALSE(initial_rfh->is_active()); 3148 EXPECT_FALSE(initial_rfh->is_active());
3150 3149
3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not 3150 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not
3152 // create a NavigationHandle. 3151 // create a NavigationHandle.
3153 initial_rfh->SimulateNavigationStart(kUrl3); 3152 initial_rfh->SimulateNavigationStart(kUrl3);
3154 EXPECT_FALSE(initial_rfh->navigation_handle()); 3153 EXPECT_FALSE(initial_rfh->navigation_handle());
3155 } 3154 }
3156 3155
3157 } // namespace content 3156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698