| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3589 entries.push_back(std::move(restored_entry)); | 3589 entries.push_back(std::move(restored_entry)); |
| 3590 Shell* new_shell = Shell::CreateNewWindow( | 3590 Shell* new_shell = Shell::CreateNewWindow( |
| 3591 controller.GetBrowserContext(), GURL::EmptyGURL(), nullptr, gfx::Size()); | 3591 controller.GetBrowserContext(), GURL::EmptyGURL(), nullptr, gfx::Size()); |
| 3592 FrameTreeNode* new_root = | 3592 FrameTreeNode* new_root = |
| 3593 static_cast<WebContentsImpl*>(new_shell->web_contents()) | 3593 static_cast<WebContentsImpl*>(new_shell->web_contents()) |
| 3594 ->GetFrameTree() | 3594 ->GetFrameTree() |
| 3595 ->root(); | 3595 ->root(); |
| 3596 NavigationControllerImpl& new_controller = | 3596 NavigationControllerImpl& new_controller = |
| 3597 static_cast<NavigationControllerImpl&>( | 3597 static_cast<NavigationControllerImpl&>( |
| 3598 new_shell->web_contents()->GetController()); | 3598 new_shell->web_contents()->GetController()); |
| 3599 new_controller.Restore( | 3599 new_controller.Restore(entries.size() - 1, |
| 3600 entries.size() - 1, | 3600 RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries); |
| 3601 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); | |
| 3602 ASSERT_EQ(0u, entries.size()); | 3601 ASSERT_EQ(0u, entries.size()); |
| 3603 { | 3602 { |
| 3604 TestNavigationObserver restore_observer(new_shell->web_contents()); | 3603 TestNavigationObserver restore_observer(new_shell->web_contents()); |
| 3605 new_controller.LoadIfNecessary(); | 3604 new_controller.LoadIfNecessary(); |
| 3606 restore_observer.Wait(); | 3605 restore_observer.Wait(); |
| 3607 } | 3606 } |
| 3608 ASSERT_EQ(1U, new_root->child_count()); | 3607 ASSERT_EQ(1U, new_root->child_count()); |
| 3609 EXPECT_EQ(main_url_a, new_root->current_url()); | 3608 EXPECT_EQ(main_url_a, new_root->current_url()); |
| 3610 EXPECT_EQ(frame_url_b, new_root->child_at(0)->current_url()); | 3609 EXPECT_EQ(frame_url_b, new_root->child_at(0)->current_url()); |
| 3611 | 3610 |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4069 entries.push_back(std::move(restored_entry)); | 4068 entries.push_back(std::move(restored_entry)); |
| 4070 Shell* new_shell = Shell::CreateNewWindow( | 4069 Shell* new_shell = Shell::CreateNewWindow( |
| 4071 controller.GetBrowserContext(), GURL::EmptyGURL(), nullptr, gfx::Size()); | 4070 controller.GetBrowserContext(), GURL::EmptyGURL(), nullptr, gfx::Size()); |
| 4072 FrameTreeNode* new_root = | 4071 FrameTreeNode* new_root = |
| 4073 static_cast<WebContentsImpl*>(new_shell->web_contents()) | 4072 static_cast<WebContentsImpl*>(new_shell->web_contents()) |
| 4074 ->GetFrameTree() | 4073 ->GetFrameTree() |
| 4075 ->root(); | 4074 ->root(); |
| 4076 NavigationControllerImpl& new_controller = | 4075 NavigationControllerImpl& new_controller = |
| 4077 static_cast<NavigationControllerImpl&>( | 4076 static_cast<NavigationControllerImpl&>( |
| 4078 new_shell->web_contents()->GetController()); | 4077 new_shell->web_contents()->GetController()); |
| 4079 new_controller.Restore( | 4078 new_controller.Restore(entries.size() - 1, |
| 4080 entries.size() - 1, | 4079 RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries); |
| 4081 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); | |
| 4082 ASSERT_EQ(0u, entries.size()); | 4080 ASSERT_EQ(0u, entries.size()); |
| 4083 { | 4081 { |
| 4084 TestNavigationObserver restore_observer(new_shell->web_contents()); | 4082 TestNavigationObserver restore_observer(new_shell->web_contents()); |
| 4085 new_controller.LoadIfNecessary(); | 4083 new_controller.LoadIfNecessary(); |
| 4086 restore_observer.Wait(); | 4084 restore_observer.Wait(); |
| 4087 } | 4085 } |
| 4088 ASSERT_EQ(1U, new_root->child_count()); | 4086 ASSERT_EQ(1U, new_root->child_count()); |
| 4089 EXPECT_EQ(main_url_a, new_root->current_url()); | 4087 EXPECT_EQ(main_url_a, new_root->current_url()); |
| 4090 EXPECT_EQ(frame_url_b, new_root->child_at(0)->current_url()); | 4088 EXPECT_EQ(frame_url_b, new_root->child_at(0)->current_url()); |
| 4091 | 4089 |
| (...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6005 &headers)); | 6003 &headers)); |
| 6006 | 6004 |
| 6007 // Verify the Origin and Referer headers. | 6005 // Verify the Origin and Referer headers. |
| 6008 EXPECT_THAT(headers, ::testing::HasSubstr("Origin: null")); | 6006 EXPECT_THAT(headers, ::testing::HasSubstr("Origin: null")); |
| 6009 EXPECT_THAT(headers, | 6007 EXPECT_THAT(headers, |
| 6010 ::testing::ContainsRegex( | 6008 ::testing::ContainsRegex( |
| 6011 "Referer: http://a.com:.*/form_that_posts_cross_site.html")); | 6009 "Referer: http://a.com:.*/form_that_posts_cross_site.html")); |
| 6012 } | 6010 } |
| 6013 | 6011 |
| 6014 } // namespace content | 6012 } // namespace content |
| OLD | NEW |