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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/browser/web_contents/web_contents_view.h" | 10 #include "content/browser/web_contents/web_contents_view.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 345 } |
346 | 346 |
347 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, OpenURLSubframe) { | 347 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, OpenURLSubframe) { |
348 // Navigate to a page with frames and grab a subframe's FrameTreeNode ID. | 348 // Navigate to a page with frames and grab a subframe's FrameTreeNode ID. |
349 ASSERT_TRUE(test_server()->Start()); | 349 ASSERT_TRUE(test_server()->Start()); |
350 NavigateToURL(shell(), | 350 NavigateToURL(shell(), |
351 test_server()->GetURL("files/frame_tree/top.html")); | 351 test_server()->GetURL("files/frame_tree/top.html")); |
352 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); | 352 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); |
353 FrameTreeNode* root = wc->GetFrameTree()->root(); | 353 FrameTreeNode* root = wc->GetFrameTree()->root(); |
354 ASSERT_EQ(3UL, root->child_count()); | 354 ASSERT_EQ(3UL, root->child_count()); |
355 int64 frame_tree_node_id = root->child_at(0)->frame_tree_node_id(); | 355 int frame_tree_node_id = root->child_at(0)->frame_tree_node_id(); |
356 EXPECT_NE(-1, frame_tree_node_id); | 356 EXPECT_NE(-1, frame_tree_node_id); |
357 | 357 |
358 // Navigate with the subframe's FrameTreeNode ID. | 358 // Navigate with the subframe's FrameTreeNode ID. |
359 const GURL url(test_server()->GetURL("files/title1.html")); | 359 const GURL url(test_server()->GetURL("files/title1.html")); |
360 OpenURLParams params(url, Referrer(), frame_tree_node_id, CURRENT_TAB, | 360 OpenURLParams params(url, Referrer(), frame_tree_node_id, CURRENT_TAB, |
361 ui::PAGE_TRANSITION_LINK, true); | 361 ui::PAGE_TRANSITION_LINK, true); |
362 shell()->web_contents()->OpenURL(params); | 362 shell()->web_contents()->OpenURL(params); |
363 | 363 |
364 // Make sure the NavigationEntry ends up with the FrameTreeNode ID. | 364 // Make sure the NavigationEntry ends up with the FrameTreeNode ID. |
365 NavigationController* controller = &shell()->web_contents()->GetController(); | 365 NavigationController* controller = &shell()->web_contents()->GetController(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 shell()->web_contents()->GetRenderViewHost()->WasResized(); | 681 shell()->web_contents()->GetRenderViewHost()->WasResized(); |
682 | 682 |
683 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), | 683 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), |
684 "document.title = " | 684 "document.title = " |
685 " window.matchMedia('(display-mode:" | 685 " window.matchMedia('(display-mode:" |
686 " fullscreen)').matches")); | 686 " fullscreen)').matches")); |
687 EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle()); | 687 EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle()); |
688 } | 688 } |
689 | 689 |
690 } // namespace content | 690 } // namespace content |
OLD | NEW |