| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // Forces web contents to complete web page load as soon as navigation starts. | 49 // Forces web contents to complete web page load as soon as navigation starts. |
| 50 class ImmediateLoadObserver : WebContentsObserver { | 50 class ImmediateLoadObserver : WebContentsObserver { |
| 51 public: | 51 public: |
| 52 explicit ImmediateLoadObserver(TestWebContents* contents) | 52 explicit ImmediateLoadObserver(TestWebContents* contents) |
| 53 : contents_(contents) { | 53 : contents_(contents) { |
| 54 Observe(contents); | 54 Observe(contents); |
| 55 } | 55 } |
| 56 ~ImmediateLoadObserver() override {} | 56 ~ImmediateLoadObserver() override {} |
| 57 | 57 |
| 58 // TODO: remove this method when PlzNavigate is turned on by default. | |
| 59 void DidStartNavigationToPendingEntry(const GURL& url, | 58 void DidStartNavigationToPendingEntry(const GURL& url, |
| 60 ReloadType reload_type) override { | 59 ReloadType reload_type) override { |
| 61 if (!IsBrowserSideNavigationEnabled()) { | 60 // Simulate immediate web page load. |
| 62 // Simulate immediate web page load. | 61 contents_->TestSetIsLoading(false); |
| 63 contents_->TestSetIsLoading(false); | 62 Observe(nullptr); |
| 64 Observe(nullptr); | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 void DidStartNavigation(NavigationHandle* navigation_handlee) override { | |
| 69 if (IsBrowserSideNavigationEnabled()) { | |
| 70 // Simulate immediate web page load. | |
| 71 contents_->TestSetIsLoading(false); | |
| 72 Observe(nullptr); | |
| 73 } | |
| 74 } | 63 } |
| 75 | 64 |
| 76 private: | 65 private: |
| 77 TestWebContents* contents_; | 66 TestWebContents* contents_; |
| 78 | 67 |
| 79 DISALLOW_COPY_AND_ASSIGN(ImmediateLoadObserver); | 68 DISALLOW_COPY_AND_ASSIGN(ImmediateLoadObserver); |
| 80 }; | 69 }; |
| 81 | 70 |
| 82 // A subclass of TestWebContents that offers a fake content window. | 71 // A subclass of TestWebContents that offers a fake content window. |
| 83 class OverscrollTestWebContents : public TestWebContents { | 72 class OverscrollTestWebContents : public TestWebContents { |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 EXPECT_TRUE(GetOverlay()->window_.get()); | 548 EXPECT_TRUE(GetOverlay()->window_.get()); |
| 560 | 549 |
| 561 // Load the page. | 550 // Load the page. |
| 562 contents()->CommitPendingNavigation(); | 551 contents()->CommitPendingNavigation(); |
| 563 ReceivePaintUpdate(); | 552 ReceivePaintUpdate(); |
| 564 EXPECT_FALSE(GetOverlay()->window_.get()); | 553 EXPECT_FALSE(GetOverlay()->window_.get()); |
| 565 EXPECT_EQ(contents()->GetURL(), first()); | 554 EXPECT_EQ(contents()->GetURL(), first()); |
| 566 } | 555 } |
| 567 | 556 |
| 568 } // namespace content | 557 } // namespace content |
| OLD | NEW |