| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 GoogleBaseURLUpdated); | 90 GoogleBaseURLUpdated); |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 content::WebContents* contents_; | 93 content::WebContents* contents_; |
| 94 BrowserInstantControllerTest* base_test_; | 94 BrowserInstantControllerTest* base_test_; |
| 95 const GURL& url_; | 95 const GURL& url_; |
| 96 int num_reloads_; | 96 int num_reloads_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 TEST_F(BrowserInstantControllerTest, DefaultSearchProviderChanged) { | 99 TEST_F(BrowserInstantControllerTest, DefaultSearchProviderChanged) { |
| 100 chrome::EnableQueryExtractionForTesting(); |
| 100 size_t num_tests = arraysize(kTabReloadTestCases); | 101 size_t num_tests = arraysize(kTabReloadTestCases); |
| 101 ScopedVector<FakeWebContentsObserver> observers; | 102 ScopedVector<FakeWebContentsObserver> observers; |
| 102 for (size_t i = 0; i < num_tests; ++i) { | 103 for (size_t i = 0; i < num_tests; ++i) { |
| 103 const TabReloadTestCase& test = kTabReloadTestCases[i]; | 104 const TabReloadTestCase& test = kTabReloadTestCases[i]; |
| 104 AddTab(browser(), GURL(test.start_url)); | 105 AddTab(browser(), GURL(test.start_url)); |
| 105 content::WebContents* contents = | 106 content::WebContents* contents = |
| 106 browser()->tab_strip_model()->GetActiveWebContents(); | 107 browser()->tab_strip_model()->GetActiveWebContents(); |
| 107 | 108 |
| 108 // Validate initial instant state. | 109 // Validate initial instant state. |
| 109 EXPECT_EQ(test.start_in_instant_process, | 110 EXPECT_EQ(test.start_in_instant_process, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 128 contents->GetRenderProcessHost()->GetID())) | 129 contents->GetRenderProcessHost()->GetID())) |
| 129 << test.description; | 130 << test.description; |
| 130 | 131 |
| 131 // Ensure only the expected tabs(contents) reloaded. | 132 // Ensure only the expected tabs(contents) reloaded. |
| 132 EXPECT_EQ(test.should_reload ? 1 : 0, observer->num_reloads()) | 133 EXPECT_EQ(test.should_reload ? 1 : 0, observer->num_reloads()) |
| 133 << test.description; | 134 << test.description; |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 | 137 |
| 137 TEST_F(BrowserInstantControllerTest, GoogleBaseURLUpdated) { | 138 TEST_F(BrowserInstantControllerTest, GoogleBaseURLUpdated) { |
| 139 chrome::EnableQueryExtractionForTesting(); |
| 138 const size_t num_tests = arraysize(kTabReloadTestCases); | 140 const size_t num_tests = arraysize(kTabReloadTestCases); |
| 139 ScopedVector<FakeWebContentsObserver> observers; | 141 ScopedVector<FakeWebContentsObserver> observers; |
| 140 for (size_t i = 0; i < num_tests; ++i) { | 142 for (size_t i = 0; i < num_tests; ++i) { |
| 141 const TabReloadTestCase& test = kTabReloadTestCases[i]; | 143 const TabReloadTestCase& test = kTabReloadTestCases[i]; |
| 142 AddTab(browser(), GURL(test.start_url)); | 144 AddTab(browser(), GURL(test.start_url)); |
| 143 content::WebContents* contents = | 145 content::WebContents* contents = |
| 144 browser()->tab_strip_model()->GetActiveWebContents(); | 146 browser()->tab_strip_model()->GetActiveWebContents(); |
| 145 | 147 |
| 146 // Validate initial instant state. | 148 // Validate initial instant state. |
| 147 EXPECT_EQ(test.start_in_instant_process, | 149 EXPECT_EQ(test.start_in_instant_process, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 186 |
| 185 browser.reset(NULL); | 187 browser.reset(NULL); |
| 186 window.reset(NULL); | 188 window.reset(NULL); |
| 187 EXPECT_FALSE(IsInstantServiceObserver(bic)) | 189 EXPECT_FALSE(IsInstantServiceObserver(bic)) |
| 188 << "New BrowserInstantController should register as InstantServiceObserver"; | 190 << "New BrowserInstantController should register as InstantServiceObserver"; |
| 189 } | 191 } |
| 190 | 192 |
| 191 } // namespace | 193 } // namespace |
| 192 | 194 |
| 193 } // namespace chrome | 195 } // namespace chrome |
| OLD | NEW |