| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // Forces web contents to complete web page load as soon as navigation starts. | 34 // Forces web contents to complete web page load as soon as navigation starts. |
| 35 class ImmediateLoadObserver : WebContentsObserver { | 35 class ImmediateLoadObserver : WebContentsObserver { |
| 36 public: | 36 public: |
| 37 explicit ImmediateLoadObserver(TestWebContents* contents) | 37 explicit ImmediateLoadObserver(TestWebContents* contents) |
| 38 : contents_(contents) { | 38 : contents_(contents) { |
| 39 Observe(contents); | 39 Observe(contents); |
| 40 } | 40 } |
| 41 ~ImmediateLoadObserver() override {} | 41 ~ImmediateLoadObserver() override {} |
| 42 | 42 |
| 43 // TODO: remove this method when PlzNavigate is turned on by default. |
| 43 void DidStartNavigationToPendingEntry(const GURL& url, | 44 void DidStartNavigationToPendingEntry(const GURL& url, |
| 44 ReloadType reload_type) override { | 45 ReloadType reload_type) override { |
| 45 // Simulate immediate web page load. | 46 if (!IsBrowserSideNavigationEnabled()) { |
| 46 contents_->TestSetIsLoading(false); | 47 // Simulate immediate web page load. |
| 47 Observe(nullptr); | 48 contents_->TestSetIsLoading(false); |
| 49 Observe(nullptr); |
| 50 } |
| 51 } |
| 52 |
| 53 void DidStartNavigation(NavigationHandle* navigation_handlee) override { |
| 54 if (IsBrowserSideNavigationEnabled()) { |
| 55 // Simulate immediate web page load. |
| 56 contents_->TestSetIsLoading(false); |
| 57 Observe(nullptr); |
| 58 } |
| 48 } | 59 } |
| 49 | 60 |
| 50 private: | 61 private: |
| 51 TestWebContents* contents_; | 62 TestWebContents* contents_; |
| 52 | 63 |
| 53 DISALLOW_COPY_AND_ASSIGN(ImmediateLoadObserver); | 64 DISALLOW_COPY_AND_ASSIGN(ImmediateLoadObserver); |
| 54 }; | 65 }; |
| 55 | 66 |
| 56 // A subclass of TestWebContents that offers a fake content window. | 67 // A subclass of TestWebContents that offers a fake content window. |
| 57 class OverscrollTestWebContents : public TestWebContents { | 68 class OverscrollTestWebContents : public TestWebContents { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 EXPECT_TRUE(GetOverlay()->window_.get()); | 450 EXPECT_TRUE(GetOverlay()->window_.get()); |
| 440 | 451 |
| 441 // Load the page. | 452 // Load the page. |
| 442 contents()->CommitPendingNavigation(); | 453 contents()->CommitPendingNavigation(); |
| 443 ReceivePaintUpdate(); | 454 ReceivePaintUpdate(); |
| 444 EXPECT_FALSE(GetOverlay()->window_.get()); | 455 EXPECT_FALSE(GetOverlay()->window_.get()); |
| 445 EXPECT_EQ(contents()->GetURL(), first()); | 456 EXPECT_EQ(contents()->GetURL(), first()); |
| 446 } | 457 } |
| 447 | 458 |
| 448 } // namespace content | 459 } // namespace content |
| OLD | NEW |