| Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| index a4b25922bfdd4690db285ed7cd9ef515696418e0..3eca788f95720c819ad1e27b955f30f2d4c5b7fd 100644
|
| --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| @@ -4,29 +4,17 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/strings/stringprintf.h"
|
| -#include "content/browser/frame_host/frame_tree.h"
|
| #include "content/browser/frame_host/navigation_controller_impl.h"
|
| #include "content/browser/frame_host/navigation_entry_impl.h"
|
| -#include "content/browser/web_contents/web_contents_impl.h"
|
| #include "content/public/browser/web_contents.h"
|
| -#include "content/public/browser/web_contents_observer.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "content/public/test/content_browser_test.h"
|
| #include "content/public/test/content_browser_test_utils.h"
|
| -#include "content/public/test/test_utils.h"
|
| #include "content/shell/browser/shell.h"
|
| -#include "content/test/content_browser_test_utils_internal.h"
|
| -#include "net/dns/mock_host_resolver.h"
|
| -#include "net/test/embedded_test_server/embedded_test_server.h"
|
|
|
| namespace content {
|
|
|
| class NavigationControllerBrowserTest : public ContentBrowserTest {
|
| - protected:
|
| - void SetUpOnMainThread() override {
|
| - host_resolver()->AddRule("*", "127.0.0.1");
|
| - ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
|
| - }
|
| };
|
|
|
| IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, LoadDataWithBaseURL) {
|
| @@ -88,98 +76,5 @@
|
| controller.GetLastCommittedEntry()->GetURL());
|
| }
|
|
|
| -struct FrameNavigateParamsCapturer : public WebContentsObserver {
|
| - public:
|
| - explicit FrameNavigateParamsCapturer(FrameTreeNode* node)
|
| - : WebContentsObserver(
|
| - node->current_frame_host()->delegate()->GetAsWebContents()),
|
| - frame_tree_node_id_(node->frame_tree_node_id()),
|
| - message_loop_runner_(new MessageLoopRunner) {}
|
| +} // namespace content
|
|
|
| - void Wait() {
|
| - message_loop_runner_->Run();
|
| - }
|
| -
|
| - const FrameNavigateParams& params() const {
|
| - return params_;
|
| - }
|
| -
|
| - private:
|
| - void DidNavigateAnyFrame(RenderFrameHost* render_frame_host,
|
| - const LoadCommittedDetails& details,
|
| - const FrameNavigateParams& params) override {
|
| - RenderFrameHostImpl* rfh =
|
| - static_cast<RenderFrameHostImpl*>(render_frame_host);
|
| - if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_)
|
| - return;
|
| -
|
| - params_ = params;
|
| - message_loop_runner_->Quit();
|
| - }
|
| -
|
| - // The id of the FrameTreeNode in which navigations are peformed.
|
| - int frame_tree_node_id_;
|
| -
|
| - // The params of the last navigation.
|
| - FrameNavigateParams params_;
|
| -
|
| - // The MessageLoopRunner used to spin the message loop.
|
| - scoped_refptr<MessageLoopRunner> message_loop_runner_;
|
| -};
|
| -
|
| -// Verify that PAGE_TRANSITION_AUTO_SUBFRAME and PAGE_TRANSITION_MANUAL_SUBFRAME
|
| -// are properly set for subframe navigations.
|
| -IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
|
| - ManualAndAutoSubframeNavigationTransitions) {
|
| - GURL main_url(
|
| - embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html"));
|
| - NavigateToURL(shell(), main_url);
|
| -
|
| - // It is safe to obtain the root frame tree node here, as it doesn't change.
|
| - FrameTreeNode* root =
|
| - static_cast<WebContentsImpl*>(shell()->web_contents())->
|
| - GetFrameTree()->root();
|
| -
|
| - ASSERT_EQ(1U, root->child_count());
|
| - ASSERT_NE(nullptr, root->child_at(0));
|
| -
|
| - {
|
| - // Navigate the iframe to a new URL; expect a manual subframe transition.
|
| - FrameNavigateParamsCapturer capturer(root->child_at(0));
|
| - GURL frame_url(
|
| - embedded_test_server()->GetURL("/frame_tree/2-1.html"));
|
| - NavigateFrameToURL(root->child_at(0), frame_url);
|
| - capturer.Wait();
|
| - EXPECT_EQ(ui::PAGE_TRANSITION_MANUAL_SUBFRAME,
|
| - capturer.params().transition);
|
| - }
|
| -
|
| - {
|
| - // History navigations should result in an auto subframe transition.
|
| - FrameNavigateParamsCapturer capturer(root->child_at(0));
|
| - shell()->web_contents()->GetController().GoBack();
|
| - capturer.Wait();
|
| - EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.params().transition);
|
| - }
|
| -
|
| - {
|
| - // History navigations should result in an auto subframe transition.
|
| - FrameNavigateParamsCapturer capturer(root->child_at(0));
|
| - shell()->web_contents()->GetController().GoForward();
|
| - capturer.Wait();
|
| - EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.params().transition);
|
| - }
|
| -
|
| - {
|
| - // Navigate the iframe to a new URL; expect a manual subframe transition.
|
| - FrameNavigateParamsCapturer capturer(root->child_at(0));
|
| - GURL frame_url(
|
| - embedded_test_server()->GetURL("/frame_tree/2-3.html"));
|
| - NavigateFrameToURL(root->child_at(0), frame_url);
|
| - capturer.Wait();
|
| - EXPECT_EQ(ui::PAGE_TRANSITION_MANUAL_SUBFRAME,
|
| - capturer.params().transition);
|
| - }
|
| -}
|
| -
|
| -} // namespace content
|
|
|