| 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 "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 SetUserSelectedDefaultSearchProvider("https://bar.com/"); | 135 SetUserSelectedDefaultSearchProvider("https://bar.com/"); |
| 136 | 136 |
| 137 for (size_t i = 0; i < num_tests; ++i) { | 137 for (size_t i = 0; i < num_tests; ++i) { |
| 138 FakeWebContentsObserver* observer = observers[i]; | 138 FakeWebContentsObserver* observer = observers[i]; |
| 139 const TabReloadTestCase& test = | 139 const TabReloadTestCase& test = |
| 140 kTabReloadTestCasesFinalProviderNotGoogle[i]; | 140 kTabReloadTestCasesFinalProviderNotGoogle[i]; |
| 141 | 141 |
| 142 if (test.should_reload) { | 142 if (test.should_reload) { |
| 143 // Validate final instant state. | 143 // Validate final instant state. |
| 144 EXPECT_EQ( | 144 EXPECT_EQ(test.end_in_instant_process, |
| 145 test.end_in_instant_process, | 145 search::ShouldAssignURLToInstantRenderer( |
| 146 chrome::ShouldAssignURLToInstantRenderer( | 146 observer->current_url(), profile())) |
| 147 observer->current_url(), profile())) | 147 << test.description; |
| 148 << test.description; | |
| 149 } | 148 } |
| 150 | 149 |
| 151 // Ensure only the expected tabs(contents) reloaded. | 150 // Ensure only the expected tabs(contents) reloaded. |
| 152 EXPECT_EQ(test.should_reload ? 1 : 0, observer->num_reloads()) | 151 EXPECT_EQ(test.should_reload ? 1 : 0, observer->num_reloads()) |
| 153 << test.description; | 152 << test.description; |
| 154 | 153 |
| 155 if (test.end_in_local_ntp) { | 154 if (test.end_in_local_ntp) { |
| 156 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), observer->current_url()) | 155 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), observer->current_url()) |
| 157 << test.description; | 156 << test.description; |
| 158 } | 157 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 178 observers.push_back(new FakeWebContentsObserver(contents)); | 177 observers.push_back(new FakeWebContentsObserver(contents)); |
| 179 } | 178 } |
| 180 | 179 |
| 181 NotifyGoogleBaseURLUpdate("https://www.google.es/"); | 180 NotifyGoogleBaseURLUpdate("https://www.google.es/"); |
| 182 | 181 |
| 183 for (size_t i = 0; i < num_tests; ++i) { | 182 for (size_t i = 0; i < num_tests; ++i) { |
| 184 const TabReloadTestCase& test = kTabReloadTestCasesFinalProviderGoogle[i]; | 183 const TabReloadTestCase& test = kTabReloadTestCasesFinalProviderGoogle[i]; |
| 185 FakeWebContentsObserver* observer = observers[i]; | 184 FakeWebContentsObserver* observer = observers[i]; |
| 186 | 185 |
| 187 // Validate final instant state. | 186 // Validate final instant state. |
| 188 EXPECT_EQ( | 187 EXPECT_EQ(test.end_in_instant_process, |
| 189 test.end_in_instant_process, | 188 search::ShouldAssignURLToInstantRenderer(observer->current_url(), |
| 190 chrome::ShouldAssignURLToInstantRenderer( | 189 profile())) |
| 191 observer->current_url(), profile())) | 190 << test.description; |
| 192 << test.description; | |
| 193 | 191 |
| 194 // Ensure only the expected tabs(contents) reloaded. | 192 // Ensure only the expected tabs(contents) reloaded. |
| 195 EXPECT_EQ(test.should_reload ? 1 : 0, observer->num_reloads()) | 193 EXPECT_EQ(test.should_reload ? 1 : 0, observer->num_reloads()) |
| 196 << test.description; | 194 << test.description; |
| 197 | 195 |
| 198 if (test.end_in_local_ntp) { | 196 if (test.end_in_local_ntp) { |
| 199 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), observer->current_url()) | 197 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), observer->current_url()) |
| 200 << test.description; | 198 << test.description; |
| 201 // The navigation to Local NTP should be definitive i.e. can't go back. | 199 // The navigation to Local NTP should be definitive i.e. can't go back. |
| 202 EXPECT_FALSE(observer->can_go_back()); | 200 EXPECT_FALSE(observer->can_go_back()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 216 | 214 |
| 217 browser.reset(NULL); | 215 browser.reset(NULL); |
| 218 window.reset(NULL); | 216 window.reset(NULL); |
| 219 EXPECT_FALSE(IsInstantServiceObserver(bic)) | 217 EXPECT_FALSE(IsInstantServiceObserver(bic)) |
| 220 << "New BrowserInstantController should register as InstantServiceObserver"; | 218 << "New BrowserInstantController should register as InstantServiceObserver"; |
| 221 } | 219 } |
| 222 | 220 |
| 223 } // namespace | 221 } // namespace |
| 224 | 222 |
| 225 } // namespace chrome | 223 } // namespace chrome |
| OLD | NEW |