| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/frame_host/cross_site_transferring_request.h" | 8 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 9 #include "content/browser/frame_host/interstitial_page_impl.h" | 9 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 513 |
| 514 // Navigations should be suspended in pending_rfh until BeforeUnloadACK. | 514 // Navigations should be suspended in pending_rfh until BeforeUnloadACK. |
| 515 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 515 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 516 switches::kEnableBrowserSideNavigation)) { | 516 switches::kEnableBrowserSideNavigation)) { |
| 517 EXPECT_TRUE(pending_rfh->are_navigations_suspended()); | 517 EXPECT_TRUE(pending_rfh->are_navigations_suspended()); |
| 518 orig_rfh->SendBeforeUnloadACK(true); | 518 orig_rfh->SendBeforeUnloadACK(true); |
| 519 EXPECT_FALSE(pending_rfh->are_navigations_suspended()); | 519 EXPECT_FALSE(pending_rfh->are_navigations_suspended()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 // DidNavigate from the pending page | 522 // DidNavigate from the pending page |
| 523 pending_rfh->PrepareForCommit(url2); |
| 523 contents()->TestDidNavigate( | 524 contents()->TestDidNavigate( |
| 524 pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); | 525 pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); |
| 525 SiteInstance* instance2 = contents()->GetSiteInstance(); | 526 SiteInstance* instance2 = contents()->GetSiteInstance(); |
| 526 | 527 |
| 527 // Keep the number of active frames in pending_rfh's SiteInstance | 528 // Keep the number of active frames in pending_rfh's SiteInstance |
| 528 // non-zero so that orig_rfh doesn't get deleted when it gets | 529 // non-zero so that orig_rfh doesn't get deleted when it gets |
| 529 // swapped out. | 530 // swapped out. |
| 530 pending_rfh->GetSiteInstance()->increment_active_frame_count(); | 531 pending_rfh->GetSiteInstance()->increment_active_frame_count(); |
| 531 | 532 |
| 532 EXPECT_FALSE(contents()->cross_navigation_pending()); | 533 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| (...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3038 frame->SendBeforeUnloadHandlersPresent(false); | 3039 frame->SendBeforeUnloadHandlersPresent(false); |
| 3039 EXPECT_FALSE(frame->SuddenTerminationAllowed()); | 3040 EXPECT_FALSE(frame->SuddenTerminationAllowed()); |
| 3040 frame->SendBeforeUnloadHandlersPresent(true); | 3041 frame->SendBeforeUnloadHandlersPresent(true); |
| 3041 frame->SendUnloadHandlersPresent(false); | 3042 frame->SendUnloadHandlersPresent(false); |
| 3042 EXPECT_FALSE(frame->SuddenTerminationAllowed()); | 3043 EXPECT_FALSE(frame->SuddenTerminationAllowed()); |
| 3043 frame->SendBeforeUnloadHandlersPresent(false); | 3044 frame->SendBeforeUnloadHandlersPresent(false); |
| 3044 EXPECT_TRUE(frame->SuddenTerminationAllowed()); | 3045 EXPECT_TRUE(frame->SuddenTerminationAllowed()); |
| 3045 } | 3046 } |
| 3046 | 3047 |
| 3047 } // namespace content | 3048 } // namespace content |
| OLD | NEW |