| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 574 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 575 | 575 |
| 576 // Start at a real page. | 576 // Start at a real page. |
| 577 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 577 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
| 578 | 578 |
| 579 // Simulate a navigation that has not completed. | 579 // Simulate a navigation that has not completed. |
| 580 scoped_ptr<LoadProgressDelegateAndObserver> delegate( | 580 scoped_ptr<LoadProgressDelegateAndObserver> delegate( |
| 581 new LoadProgressDelegateAndObserver(shell())); | 581 new LoadProgressDelegateAndObserver(shell())); |
| 582 RenderFrameHost* main_frame = shell()->web_contents()->GetMainFrame(); | 582 RenderFrameHost* main_frame = shell()->web_contents()->GetMainFrame(); |
| 583 FrameHostMsg_DidStartLoading start_msg(main_frame->GetRoutingID(), true); | 583 FrameHostMsg_DidStartLoading start_msg(main_frame->GetRoutingID(), true); |
| 584 static_cast<WebContentsImpl*>(shell()->web_contents())->OnMessageReceived( | 584 static_cast<RenderFrameHostImpl*>(main_frame)->OnMessageReceived(start_msg); |
| 585 main_frame, start_msg); | |
| 586 EXPECT_TRUE(delegate->did_start_loading); | 585 EXPECT_TRUE(delegate->did_start_loading); |
| 587 EXPECT_FALSE(delegate->did_stop_loading); | 586 EXPECT_FALSE(delegate->did_stop_loading); |
| 588 | 587 |
| 589 // Also simulate a DidChangeLoadProgress, but not a DidStopLoading. | 588 // Also simulate a DidChangeLoadProgress, but not a DidStopLoading. |
| 590 FrameHostMsg_DidChangeLoadProgress progress_msg(main_frame->GetRoutingID(), | 589 FrameHostMsg_DidChangeLoadProgress progress_msg(main_frame->GetRoutingID(), |
| 591 1.0); | 590 1.0); |
| 592 static_cast<WebContentsImpl*>(shell()->web_contents())->OnMessageReceived( | 591 static_cast<RenderFrameHostImpl*>(main_frame)->OnMessageReceived( |
| 593 main_frame, progress_msg); | 592 progress_msg); |
| 594 EXPECT_TRUE(delegate->did_start_loading); | 593 EXPECT_TRUE(delegate->did_start_loading); |
| 595 EXPECT_FALSE(delegate->did_stop_loading); | 594 EXPECT_FALSE(delegate->did_stop_loading); |
| 596 | 595 |
| 597 // Now interrupt with a new cross-process navigation. | 596 // Now interrupt with a new cross-process navigation. |
| 598 TestNavigationObserver tab_observer(shell()->web_contents(), 1); | 597 TestNavigationObserver tab_observer(shell()->web_contents(), 1); |
| 599 GURL url(embedded_test_server()->GetURL("foo.com", "/title2.html")); | 598 GURL url(embedded_test_server()->GetURL("foo.com", "/title2.html")); |
| 600 shell()->LoadURL(url); | 599 shell()->LoadURL(url); |
| 601 tab_observer.Wait(); | 600 tab_observer.Wait(); |
| 602 EXPECT_EQ(url, shell()->web_contents()->GetLastCommittedURL()); | 601 EXPECT_EQ(url, shell()->web_contents()->GetLastCommittedURL()); |
| 603 | 602 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 shell()->web_contents()->GetRenderViewHost()->WasResized(); | 681 shell()->web_contents()->GetRenderViewHost()->WasResized(); |
| 683 | 682 |
| 684 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), | 683 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), |
| 685 "document.title = " | 684 "document.title = " |
| 686 " window.matchMedia('(display-mode:" | 685 " window.matchMedia('(display-mode:" |
| 687 " fullscreen)').matches")); | 686 " fullscreen)').matches")); |
| 688 EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle()); | 687 EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle()); |
| 689 } | 688 } |
| 690 | 689 |
| 691 } // namespace content | 690 } // namespace content |
| OLD | NEW |