OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/toolbar/toolbar_model.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 ToolbarModel* toolbar_model = browser()->toolbar_model(); | 196 ToolbarModel* toolbar_model = browser()->toolbar_model(); |
197 EXPECT_EQ(expected_text, toolbar_model->GetText()); | 197 EXPECT_EQ(expected_text, toolbar_model->GetText()); |
198 EXPECT_EQ(would_perform_search_term_replacement, | 198 EXPECT_EQ(would_perform_search_term_replacement, |
199 toolbar_model->WouldPerformSearchTermReplacement(false)); | 199 toolbar_model->WouldPerformSearchTermReplacement(false)); |
200 EXPECT_EQ(should_display_url, toolbar_model->ShouldDisplayURL()); | 200 EXPECT_EQ(should_display_url, toolbar_model->ShouldDisplayURL()); |
201 | 201 |
202 // Check after commit. | 202 // Check after commit. |
203 CommitPendingLoad(controller); | 203 CommitPendingLoad(controller); |
204 // Fake a secure connection for HTTPS URLs, or the toolbar will refuse to | 204 // Fake a secure connection for HTTPS URLs, or the toolbar will refuse to |
205 // extract search terms. | 205 // extract search terms. |
206 if (url.SchemeIsSecure()) { | 206 if (url.SchemeIsCryptographic()) { |
207 controller->GetVisibleEntry()->GetSSL().security_style = | 207 controller->GetVisibleEntry()->GetSSL().security_style = |
208 content::SECURITY_STYLE_AUTHENTICATED; | 208 content::SECURITY_STYLE_AUTHENTICATED; |
209 } | 209 } |
210 EXPECT_EQ(expected_text, toolbar_model->GetText()); | 210 EXPECT_EQ(expected_text, toolbar_model->GetText()); |
211 EXPECT_EQ(would_perform_search_term_replacement, | 211 EXPECT_EQ(would_perform_search_term_replacement, |
212 toolbar_model->WouldPerformSearchTermReplacement(false)); | 212 toolbar_model->WouldPerformSearchTermReplacement(false)); |
213 EXPECT_EQ(should_display_url, toolbar_model->ShouldDisplayURL()); | 213 EXPECT_EQ(should_display_url, toolbar_model->ShouldDisplayURL()); |
214 | 214 |
215 // Now pretend the user started modifying the omnibox. | 215 // Now pretend the user started modifying the omnibox. |
216 toolbar_model->set_input_in_progress(true); | 216 toolbar_model->set_input_in_progress(true); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 // Disabling URL replacement should reset to only showing URLs. | 355 // Disabling URL replacement should reset to only showing URLs. |
356 browser()->toolbar_model()->set_url_replacement_enabled(false); | 356 browser()->toolbar_model()->set_url_replacement_enabled(false); |
357 for (size_t i = 0; i < arraysize(test_items); ++i) { | 357 for (size_t i = 0; i < arraysize(test_items); ++i) { |
358 const TestItem& test_item = test_items[i]; | 358 const TestItem& test_item = test_items[i]; |
359 NavigateAndCheckText(test_item.url, | 359 NavigateAndCheckText(test_item.url, |
360 test_item.expected_text_url_replacement_inactive, | 360 test_item.expected_text_url_replacement_inactive, |
361 false, test_item.should_display_url); | 361 false, test_item.should_display_url); |
362 } | 362 } |
363 } | 363 } |
OLD | NEW |