| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/search/instant_service.h" | 10 #include "chrome/browser/search/instant_service.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class FakeWebContentsObserver : public content::WebContentsObserver { | 49 class FakeWebContentsObserver : public content::WebContentsObserver { |
| 50 public: | 50 public: |
| 51 FakeWebContentsObserver(BrowserInstantControllerTest* base_test, | 51 FakeWebContentsObserver(BrowserInstantControllerTest* base_test, |
| 52 content::WebContents* contents) | 52 content::WebContents* contents) |
| 53 : WebContentsObserver(contents), | 53 : WebContentsObserver(contents), |
| 54 contents_(contents), | 54 contents_(contents), |
| 55 base_test_(base_test), | 55 base_test_(base_test), |
| 56 url_(contents->GetURL()), | 56 url_(contents->GetURL()), |
| 57 num_reloads_(0) {} | 57 num_reloads_(0) {} |
| 58 | 58 |
| 59 virtual void NavigateToPendingEntry( | 59 virtual void DidCreatePendingEntry( |
| 60 const GURL& url, | 60 const GURL& url, |
| 61 content::NavigationController::ReloadType reload_type) OVERRIDE { | 61 content::NavigationController::ReloadType reload_type) OVERRIDE { |
| 62 // The tab reload event doesn't work with BrowserWithTestWindowTest. | 62 // The tab reload event doesn't work with BrowserWithTestWindowTest. |
| 63 // So we capture the NavigateToPendingEntry, and use the | 63 // So we capture the DidCreatePendingEntry, and use the |
| 64 // BrowserWithTestWindowTest::NavigateAndCommit to simulate the complete | 64 // BrowserWithTestWindowTest::NavigateAndCommit to simulate the complete |
| 65 // reload. Note that this will again trigger NavigateToPendingEntry, so we | 65 // reload. Note that this will again trigger DidCreatePendingEntry, so we |
| 66 // remove this as observer. | 66 // remove this as observer. |
| 67 content::NavigationController* controller = | 67 content::NavigationController* controller = |
| 68 &web_contents()->GetController(); | 68 &web_contents()->GetController(); |
| 69 Observe(NULL); | 69 Observe(NULL); |
| 70 | 70 |
| 71 if (url_ == url) | 71 if (url_ == url) |
| 72 num_reloads_++; | 72 num_reloads_++; |
| 73 | 73 |
| 74 base_test_->NavigateAndCommit(controller, url); | 74 base_test_->NavigateAndCommit(controller, url); |
| 75 } | 75 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 browser.reset(NULL); | 185 browser.reset(NULL); |
| 186 window.reset(NULL); | 186 window.reset(NULL); |
| 187 EXPECT_FALSE(IsInstantServiceObserver(bic)) | 187 EXPECT_FALSE(IsInstantServiceObserver(bic)) |
| 188 << "New BrowserInstantController should register as InstantServiceObserver"; | 188 << "New BrowserInstantController should register as InstantServiceObserver"; |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace | 191 } // namespace |
| 192 | 192 |
| 193 } // namespace chrome | 193 } // namespace chrome |
| OLD | NEW |