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/common/frame_messages.h" | 10 #include "content/common/frame_messages.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 569 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
570 | 570 |
571 // Start at a real page. | 571 // Start at a real page. |
572 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 572 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
573 | 573 |
574 // Simulate a navigation that has not completed. | 574 // Simulate a navigation that has not completed. |
575 scoped_ptr<LoadProgressDelegateAndObserver> delegate( | 575 scoped_ptr<LoadProgressDelegateAndObserver> delegate( |
576 new LoadProgressDelegateAndObserver(shell())); | 576 new LoadProgressDelegateAndObserver(shell())); |
577 RenderFrameHost* main_frame = shell()->web_contents()->GetMainFrame(); | 577 RenderFrameHost* main_frame = shell()->web_contents()->GetMainFrame(); |
578 FrameHostMsg_DidStartLoading start_msg(main_frame->GetRoutingID(), true); | 578 FrameHostMsg_DidStartLoading start_msg(main_frame->GetRoutingID(), true); |
579 static_cast<WebContentsImpl*>(shell()->web_contents())->OnMessageReceived( | 579 static_cast<RenderFrameHostImpl*>(main_frame)->OnMessageReceived(start_msg); |
580 main_frame, start_msg); | |
581 EXPECT_TRUE(delegate->did_start_loading); | 580 EXPECT_TRUE(delegate->did_start_loading); |
582 EXPECT_FALSE(delegate->did_stop_loading); | 581 EXPECT_FALSE(delegate->did_stop_loading); |
583 | 582 |
584 // Also simulate a DidChangeLoadProgress, but not a DidStopLoading. | 583 // Also simulate a DidChangeLoadProgress, but not a DidStopLoading. |
585 FrameHostMsg_DidChangeLoadProgress progress_msg(main_frame->GetRoutingID(), | 584 FrameHostMsg_DidChangeLoadProgress progress_msg(main_frame->GetRoutingID(), |
586 1.0); | 585 1.0); |
587 static_cast<WebContentsImpl*>(shell()->web_contents())->OnMessageReceived( | 586 static_cast<RenderFrameHostImpl*>(main_frame)->OnMessageReceived( |
588 main_frame, progress_msg); | 587 progress_msg); |
589 EXPECT_TRUE(delegate->did_start_loading); | 588 EXPECT_TRUE(delegate->did_start_loading); |
590 EXPECT_FALSE(delegate->did_stop_loading); | 589 EXPECT_FALSE(delegate->did_stop_loading); |
591 | 590 |
592 // Now interrupt with a new cross-process navigation. | 591 // Now interrupt with a new cross-process navigation. |
593 TestNavigationObserver tab_observer(shell()->web_contents(), 1); | 592 TestNavigationObserver tab_observer(shell()->web_contents(), 1); |
594 GURL url(embedded_test_server()->GetURL("foo.com", "/title2.html")); | 593 GURL url(embedded_test_server()->GetURL("foo.com", "/title2.html")); |
595 shell()->LoadURL(url); | 594 shell()->LoadURL(url); |
596 tab_observer.Wait(); | 595 tab_observer.Wait(); |
597 EXPECT_EQ(url, shell()->web_contents()->GetLastCommittedURL()); | 596 EXPECT_EQ(url, shell()->web_contents()->GetLastCommittedURL()); |
598 | 597 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 scoped_ptr<FirstVisuallyNonEmptyPaintObserver> observer( | 634 scoped_ptr<FirstVisuallyNonEmptyPaintObserver> observer( |
636 new FirstVisuallyNonEmptyPaintObserver(shell())); | 635 new FirstVisuallyNonEmptyPaintObserver(shell())); |
637 | 636 |
638 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 637 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
639 | 638 |
640 observer->WaitForDidFirstVisuallyNonEmptyPaint(); | 639 observer->WaitForDidFirstVisuallyNonEmptyPaint(); |
641 ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_); | 640 ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_); |
642 } | 641 } |
643 | 642 |
644 } // namespace content | 643 } // namespace content |
OLD | NEW |