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/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/browser/web_contents/web_contents_view.h" | 9 #include "content/browser/web_contents/web_contents_view.h" |
10 #include "content/public/browser/load_notification_details.h" | 10 #include "content/public/browser/load_notification_details.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 shell()->web_contents()->OpenURL(params); | 356 shell()->web_contents()->OpenURL(params); |
357 | 357 |
358 // Make sure the NavigationEntry ends up with the FrameTreeNode ID. | 358 // Make sure the NavigationEntry ends up with the FrameTreeNode ID. |
359 NavigationController* controller = &shell()->web_contents()->GetController(); | 359 NavigationController* controller = &shell()->web_contents()->GetController(); |
360 EXPECT_TRUE(controller->GetPendingEntry()); | 360 EXPECT_TRUE(controller->GetPendingEntry()); |
361 EXPECT_EQ(frame_tree_node_id, | 361 EXPECT_EQ(frame_tree_node_id, |
362 NavigationEntryImpl::FromNavigationEntry( | 362 NavigationEntryImpl::FromNavigationEntry( |
363 controller->GetPendingEntry())->frame_tree_node_id()); | 363 controller->GetPendingEntry())->frame_tree_node_id()); |
364 } | 364 } |
365 | 365 |
| 366 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, |
| 367 AppendingFrameInWebUIDoesNotCrash) { |
| 368 const GURL kWebUIUrl("chrome://tracing"); |
| 369 const char kJSCodeForAppendingFrame[] = |
| 370 "document.body.appendChild(document.createElement('iframe'));"; |
| 371 |
| 372 NavigateToURL(shell(), kWebUIUrl); |
| 373 |
| 374 bool js_executed = content::ExecuteScript(shell()->web_contents(), |
| 375 kJSCodeForAppendingFrame); |
| 376 EXPECT_TRUE(js_executed); |
| 377 } |
| 378 |
366 // Observer class to track the creation of RenderFrameHost objects. It is used | 379 // Observer class to track the creation of RenderFrameHost objects. It is used |
367 // in subsequent tests. | 380 // in subsequent tests. |
368 class RenderFrameCreatedObserver : public WebContentsObserver { | 381 class RenderFrameCreatedObserver : public WebContentsObserver { |
369 public: | 382 public: |
370 RenderFrameCreatedObserver(Shell* shell) | 383 RenderFrameCreatedObserver(Shell* shell) |
371 : WebContentsObserver(shell->web_contents()), | 384 : WebContentsObserver(shell->web_contents()), |
372 last_rfh_(NULL) { | 385 last_rfh_(NULL) { |
373 } | 386 } |
374 | 387 |
375 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE { | 388 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 new FirstVisuallyNonEmptyPaintObserver(shell())); | 574 new FirstVisuallyNonEmptyPaintObserver(shell())); |
562 | 575 |
563 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 576 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
564 | 577 |
565 observer->WaitForDidFirstVisuallyNonEmptyPaint(); | 578 observer->WaitForDidFirstVisuallyNonEmptyPaint(); |
566 ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_); | 579 ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_); |
567 } | 580 } |
568 | 581 |
569 } // namespace content | 582 } // namespace content |
570 | 583 |
OLD | NEW |