| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/gtest_prod_util.h" | 7 #include "base/gtest_prod_util.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 | 75 |
| 76 class FakeWebContentsObserver : public content::WebContentsObserver { | 76 class FakeWebContentsObserver : public content::WebContentsObserver { |
| 77 public: | 77 public: |
| 78 explicit FakeWebContentsObserver(content::WebContents* contents) | 78 explicit FakeWebContentsObserver(content::WebContents* contents) |
| 79 : WebContentsObserver(contents), | 79 : WebContentsObserver(contents), |
| 80 contents_(contents), | 80 contents_(contents), |
| 81 url_(contents->GetURL()), | 81 url_(contents->GetURL()), |
| 82 num_reloads_(0) {} | 82 num_reloads_(0) {} |
| 83 | 83 |
| 84 void DidStartNavigation( | |
| 85 content::NavigationHandle* navigation_handle) override { | |
| 86 if (!content::IsBrowserSideNavigationEnabled()) | |
| 87 return; | |
| 88 if (url_ == navigation_handle->GetURL()) | |
| 89 num_reloads_++; | |
| 90 current_url_ = navigation_handle->GetURL(); | |
| 91 } | |
| 92 | |
| 93 // TODO: remove this method when PlzNavigate is turned on by default. | |
| 94 void DidStartNavigationToPendingEntry( | 84 void DidStartNavigationToPendingEntry( |
| 95 const GURL& url, | 85 const GURL& url, |
| 96 content::ReloadType reload_type) override { | 86 content::ReloadType reload_type) override { |
| 97 if (content::IsBrowserSideNavigationEnabled()) | |
| 98 return; | |
| 99 if (url_ == url) | 87 if (url_ == url) |
| 100 num_reloads_++; | 88 num_reloads_++; |
| 101 current_url_ = url; | 89 current_url_ = url; |
| 102 } | 90 } |
| 103 | 91 |
| 104 const GURL& url() const { return url_; } | 92 const GURL& url() const { return url_; } |
| 105 | 93 |
| 106 const GURL& current_url() const { return contents_->GetURL(); } | 94 const GURL& current_url() const { return contents_->GetURL(); } |
| 107 | 95 |
| 108 int num_reloads() const { | 96 int num_reloads() const { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 221 |
| 234 browser.reset(NULL); | 222 browser.reset(NULL); |
| 235 window.reset(NULL); | 223 window.reset(NULL); |
| 236 EXPECT_FALSE(IsInstantServiceObserver(bic)) | 224 EXPECT_FALSE(IsInstantServiceObserver(bic)) |
| 237 << "New BrowserInstantController should register as InstantServiceObserver"; | 225 << "New BrowserInstantController should register as InstantServiceObserver"; |
| 238 } | 226 } |
| 239 | 227 |
| 240 } // namespace | 228 } // namespace |
| 241 | 229 |
| 242 } // namespace chrome | 230 } // namespace chrome |
| OLD | NEW |