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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 } | 490 } |
491 | 491 |
492 // WebContentsDelegate: | 492 // WebContentsDelegate: |
493 void LoadProgressChanged(WebContents* source, double progress) override { | 493 void LoadProgressChanged(WebContents* source, double progress) override { |
494 EXPECT_TRUE(did_start_loading); | 494 EXPECT_TRUE(did_start_loading); |
495 EXPECT_FALSE(did_stop_loading); | 495 EXPECT_FALSE(did_stop_loading); |
496 progresses.push_back(progress); | 496 progresses.push_back(progress); |
497 } | 497 } |
498 | 498 |
499 // WebContentsObserver: | 499 // WebContentsObserver: |
500 void DidStartLoading() override { | 500 void DidStartLoading() override { |
Fabrice (no longer in Chrome)
2015/04/14 16:54:12
This is one of the places where tests assume DidSt
nasko
2015/04/14 19:54:41
Why would this be different after this change? Thi
Fabrice (no longer in Chrome)
2015/04/15 15:15:03
I agree this patch will not change things. This wa
| |
501 EXPECT_FALSE(did_start_loading); | 501 EXPECT_FALSE(did_start_loading); |
502 EXPECT_EQ(0U, progresses.size()); | 502 EXPECT_EQ(0U, progresses.size()); |
503 EXPECT_FALSE(did_stop_loading); | 503 EXPECT_FALSE(did_stop_loading); |
504 did_start_loading = true; | 504 did_start_loading = true; |
505 } | 505 } |
506 | 506 |
507 void DidStopLoading() override { | 507 void DidStopLoading() override { |
Fabrice (no longer in Chrome)
2015/04/14 16:54:12
Same as above.
Fabrice (no longer in Chrome)
2015/04/15 15:15:03
Acknowledged.
| |
508 EXPECT_TRUE(did_start_loading); | 508 EXPECT_TRUE(did_start_loading); |
509 EXPECT_GE(progresses.size(), 1U); | 509 EXPECT_GE(progresses.size(), 1U); |
510 EXPECT_FALSE(did_stop_loading); | 510 EXPECT_FALSE(did_stop_loading); |
511 did_stop_loading = true; | 511 did_stop_loading = true; |
512 } | 512 } |
513 | 513 |
514 bool did_start_loading; | 514 bool did_start_loading; |
515 std::vector<double> progresses; | 515 std::vector<double> progresses; |
516 bool did_stop_loading; | 516 bool did_stop_loading; |
517 }; | 517 }; |
(...skipping 51 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 |