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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 EXPECT_EQ(expected_text, toolbar_model->GetText(can_replace)); | 247 EXPECT_EQ(expected_text, toolbar_model->GetText(can_replace)); |
248 EXPECT_EQ(would_replace, | 248 EXPECT_EQ(would_replace, |
249 toolbar_model->WouldReplaceSearchURLWithSearchTerms()); | 249 toolbar_model->WouldReplaceSearchURLWithSearchTerms()); |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 // Actual tests --------------------------------------------------------------- | 253 // Actual tests --------------------------------------------------------------- |
254 | 254 |
255 // Test that we don't replace any URLs when the query extraction is disabled. | 255 // Test that we don't replace any URLs when the query extraction is disabled. |
256 TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionDisabled) { | 256 TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionDisabled) { |
257 ASSERT_FALSE(chrome::IsQueryExtractionEnabled(profile())) | 257 ASSERT_FALSE(chrome::IsQueryExtractionEnabled()) |
258 << "This test expects query extraction to be disabled."; | 258 << "This test expects query extraction to be disabled."; |
259 ResetDefaultTemplateURL(); | 259 ResetDefaultTemplateURL(); |
260 AddTab(browser(), GURL(content::kAboutBlankURL)); | 260 AddTab(browser(), GURL(content::kAboutBlankURL)); |
261 for (size_t i = 0; i < arraysize(test_items); ++i) { | 261 for (size_t i = 0; i < arraysize(test_items); ++i) { |
262 const TestItem& test_item = test_items[i]; | 262 const TestItem& test_item = test_items[i]; |
263 NavigateAndCheckText(test_item.url, | 263 NavigateAndCheckText(test_item.url, |
264 test_item.expected_text, | 264 test_item.expected_text, |
265 test_item.expected_replace_text_inactive, | 265 test_item.expected_replace_text_inactive, |
266 false, | 266 false, |
267 test_item.should_display); | 267 test_item.should_display); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 content::SECURITY_STYLE_UNKNOWN; | 300 content::SECURITY_STYLE_UNKNOWN; |
301 EXPECT_TRUE(toolbar_model->WouldReplaceSearchURLWithSearchTerms()); | 301 EXPECT_TRUE(toolbar_model->WouldReplaceSearchURLWithSearchTerms()); |
302 | 302 |
303 // When done loading, we shouldn't extract search terms if we didn't get an | 303 // When done loading, we shouldn't extract search terms if we didn't get an |
304 // authenticated connection. | 304 // authenticated connection. |
305 CommitPendingLoad(controller); | 305 CommitPendingLoad(controller); |
306 controller->GetVisibleEntry()->GetSSL().security_style = | 306 controller->GetVisibleEntry()->GetSSL().security_style = |
307 content::SECURITY_STYLE_UNKNOWN; | 307 content::SECURITY_STYLE_UNKNOWN; |
308 EXPECT_FALSE(toolbar_model->WouldReplaceSearchURLWithSearchTerms()); | 308 EXPECT_FALSE(toolbar_model->WouldReplaceSearchURLWithSearchTerms()); |
309 } | 309 } |
OLD | NEW |