| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 contents->GetController().GetVisibleEntry()->GetSSL().security_style = | 231 contents->GetController().GetVisibleEntry()->GetSSL().security_style = |
| 232 content::SECURITY_STYLE_AUTHENTICATED; | 232 content::SECURITY_STYLE_AUTHENTICATED; |
| 233 EXPECT_EQ(should_display, toolbar_model->ShouldDisplayURL()); | 233 EXPECT_EQ(should_display, toolbar_model->ShouldDisplayURL()); |
| 234 EXPECT_EQ(expected_text, toolbar_model->GetText(can_replace)); | 234 EXPECT_EQ(expected_text, toolbar_model->GetText(can_replace)); |
| 235 EXPECT_EQ(search_terms_type, toolbar_model->GetSearchTermsType()); | 235 EXPECT_EQ(search_terms_type, toolbar_model->GetSearchTermsType()); |
| 236 } | 236 } |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 // Test that we don't replace any URLs when the query extraction is disabled. | 239 // Test that we don't replace any URLs when the query extraction is disabled. |
| 240 TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionDisabled) { | 240 TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionDisabled) { |
| 241 ASSERT_FALSE(chrome::IsQueryExtractionEnabled()) | 241 ASSERT_FALSE(chrome::IsQueryExtractionEnabled(profile())) |
| 242 << "This test expects query extraction to be disabled."; | 242 << "This test expects query extraction to be disabled."; |
| 243 | 243 |
| 244 ResetDefaultTemplateURL(); | 244 ResetDefaultTemplateURL(); |
| 245 AddTab(browser(), GURL(chrome::kAboutBlankURL)); | 245 AddTab(browser(), GURL(chrome::kAboutBlankURL)); |
| 246 for (size_t i = 0; i < arraysize(test_items); ++i) { | 246 for (size_t i = 0; i < arraysize(test_items); ++i) { |
| 247 const TestItem& test_item = test_items[i]; | 247 const TestItem& test_item = test_items[i]; |
| 248 NavigateAndCheckText(test_item.url, | 248 NavigateAndCheckText(test_item.url, |
| 249 test_item.expected_text, | 249 test_item.expected_text, |
| 250 test_item.expected_replace_text_inactive, | 250 test_item.expected_replace_text_inactive, |
| 251 ToolbarModel::NO_SEARCH_TERMS, | 251 ToolbarModel::NO_SEARCH_TERMS, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 toolbar_model->GetSearchTermsType()); | 347 toolbar_model->GetSearchTermsType()); |
| 348 | 348 |
| 349 CommitPendingLoad(&contents->GetController()); | 349 CommitPendingLoad(&contents->GetController()); |
| 350 | 350 |
| 351 // When done loading search term type should not be normal. | 351 // When done loading search term type should not be normal. |
| 352 contents->GetController().GetVisibleEntry()->GetSSL().security_style = | 352 contents->GetController().GetVisibleEntry()->GetSSL().security_style = |
| 353 content::SECURITY_STYLE_UNKNOWN; | 353 content::SECURITY_STYLE_UNKNOWN; |
| 354 EXPECT_EQ(ToolbarModel::URL_LIKE_SEARCH_TERMS, | 354 EXPECT_EQ(ToolbarModel::URL_LIKE_SEARCH_TERMS, |
| 355 toolbar_model->GetSearchTermsType()); | 355 toolbar_model->GetSearchTermsType()); |
| 356 } | 356 } |
| OLD | NEW |