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 <stdint.h> |
| 6 |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" |
7 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
8 #include "base/test/histogram_tester.h" | 11 #include "base/test/histogram_tester.h" |
9 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "build/build_config.h" |
10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 14 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
11 #include "content/browser/frame_host/cross_site_transferring_request.h" | 15 #include "content/browser/frame_host/cross_site_transferring_request.h" |
12 #include "content/browser/frame_host/navigation_controller_impl.h" | 16 #include "content/browser/frame_host/navigation_controller_impl.h" |
13 #include "content/browser/frame_host/navigation_entry_impl.h" | 17 #include "content/browser/frame_host/navigation_entry_impl.h" |
14 #include "content/browser/frame_host/navigation_request.h" | 18 #include "content/browser/frame_host/navigation_request.h" |
15 #include "content/browser/frame_host/navigator.h" | 19 #include "content/browser/frame_host/navigator.h" |
16 #include "content/browser/frame_host/render_frame_host_manager.h" | 20 #include "content/browser/frame_host/render_frame_host_manager.h" |
17 #include "content/browser/frame_host/render_frame_proxy_host.h" | 21 #include "content/browser/frame_host/render_frame_proxy_host.h" |
18 #include "content/browser/site_instance_impl.h" | 22 #include "content/browser/site_instance_impl.h" |
19 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 23 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // been deleted in the meantime. | 341 // been deleted in the meantime. |
338 contents()->GetMainFrame()->PrepareForCommit(); | 342 contents()->GetMainFrame()->PrepareForCommit(); |
339 | 343 |
340 TestRenderFrameHost* old_rfh = contents()->GetMainFrame(); | 344 TestRenderFrameHost* old_rfh = contents()->GetMainFrame(); |
341 TestRenderFrameHost* active_rfh = contents()->GetPendingMainFrame() | 345 TestRenderFrameHost* active_rfh = contents()->GetPendingMainFrame() |
342 ? contents()->GetPendingMainFrame() | 346 ? contents()->GetPendingMainFrame() |
343 : old_rfh; | 347 : old_rfh; |
344 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, old_rfh->rfh_state()); | 348 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, old_rfh->rfh_state()); |
345 | 349 |
346 // Commit the navigation with a new page ID. | 350 // Commit the navigation with a new page ID. |
347 int32 max_page_id = contents()->GetMaxPageIDForSiteInstance( | 351 int32_t max_page_id = |
348 active_rfh->GetSiteInstance()); | 352 contents()->GetMaxPageIDForSiteInstance(active_rfh->GetSiteInstance()); |
349 | 353 |
350 // Use an observer to avoid accessing a deleted renderer later on when the | 354 // Use an observer to avoid accessing a deleted renderer later on when the |
351 // state is being checked. | 355 // state is being checked. |
352 RenderFrameDeletedObserver rfh_observer(old_rfh); | 356 RenderFrameDeletedObserver rfh_observer(old_rfh); |
353 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); | 357 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); |
354 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); | 358 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); |
355 | 359 |
356 // Make sure that we start to run the unload handler at the time of commit. | 360 // Make sure that we start to run the unload handler at the time of commit. |
357 bool expecting_rfh_shutdown = false; | 361 bool expecting_rfh_shutdown = false; |
358 if (old_rfh != active_rfh && !rfh_observer.deleted()) { | 362 if (old_rfh != active_rfh && !rfh_observer.deleted()) { |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 // GetURL() call. | 1001 // GetURL() call. |
998 controller().LoadURL( | 1002 controller().LoadURL( |
999 kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 1003 kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
1000 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 1004 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
1001 | 1005 |
1002 // Simulate response from RenderFrame for DispatchBeforeUnload. | 1006 // Simulate response from RenderFrame for DispatchBeforeUnload. |
1003 contents()->GetMainFrame()->PrepareForCommit(); | 1007 contents()->GetMainFrame()->PrepareForCommit(); |
1004 ASSERT_TRUE(contents()->GetPendingMainFrame()) | 1008 ASSERT_TRUE(contents()->GetPendingMainFrame()) |
1005 << "Expected new pending RenderFrameHost to be created."; | 1009 << "Expected new pending RenderFrameHost to be created."; |
1006 RenderFrameHost* last_rfh = contents()->GetPendingMainFrame(); | 1010 RenderFrameHost* last_rfh = contents()->GetPendingMainFrame(); |
1007 int32 new_id = | 1011 int32_t new_id = |
1008 contents()->GetMaxPageIDForSiteInstance(last_rfh->GetSiteInstance()) + 1; | 1012 contents()->GetMaxPageIDForSiteInstance(last_rfh->GetSiteInstance()) + 1; |
1009 contents()->GetPendingMainFrame()->SendNavigate(new_id, entry_id, true, kUrl); | 1013 contents()->GetPendingMainFrame()->SendNavigate(new_id, entry_id, true, kUrl); |
1010 | 1014 |
1011 EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); | 1015 EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); |
1012 NavigationEntry* last_committed = controller().GetLastCommittedEntry(); | 1016 NavigationEntry* last_committed = controller().GetLastCommittedEntry(); |
1013 ASSERT_NE(nullptr, last_committed); | 1017 ASSERT_NE(nullptr, last_committed); |
1014 EXPECT_EQ(kUrl, last_committed->GetURL()); | 1018 EXPECT_EQ(kUrl, last_committed->GetURL()); |
1015 EXPECT_EQ(kViewSourceUrl, last_committed->GetVirtualURL()); | 1019 EXPECT_EQ(kViewSourceUrl, last_committed->GetVirtualURL()); |
1016 EXPECT_FALSE(controller().GetPendingEntry()); | 1020 EXPECT_FALSE(controller().GetPendingEntry()); |
1017 // Because we're using TestWebContents and TestRenderViewHost in this | 1021 // Because we're using TestWebContents and TestRenderViewHost in this |
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 commit_params.should_enforce_strict_mixed_content_checking = false; | 3240 commit_params.should_enforce_strict_mixed_content_checking = false; |
3237 child_host->SendNavigateWithParams(&commit_params); | 3241 child_host->SendNavigateWithParams(&commit_params); |
3238 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( | 3242 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( |
3239 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); | 3243 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); |
3240 EXPECT_FALSE(root->child_at(0) | 3244 EXPECT_FALSE(root->child_at(0) |
3241 ->current_replication_state() | 3245 ->current_replication_state() |
3242 .should_enforce_strict_mixed_content_checking); | 3246 .should_enforce_strict_mixed_content_checking); |
3243 } | 3247 } |
3244 | 3248 |
3245 } // namespace content | 3249 } // namespace content |
OLD | NEW |