| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 // HTTP, we should not extract search terms. | 357 // HTTP, we should not extract search terms. |
| 358 UIThreadSearchTermsData::SetGoogleBaseURL("http://www.foo.com/"); | 358 UIThreadSearchTermsData::SetGoogleBaseURL("http://www.foo.com/"); |
| 359 NavigateAndCheckText( | 359 NavigateAndCheckText( |
| 360 GURL("http://www.foo.com/search?q=tractor+supply&espv=1"), | 360 GURL("http://www.foo.com/search?q=tractor+supply&espv=1"), |
| 361 base::ASCIIToUTF16("www.foo.com/search?q=tractor+supply&espv=1"), false, | 361 base::ASCIIToUTF16("www.foo.com/search?q=tractor+supply&espv=1"), false, |
| 362 true); | 362 true); |
| 363 | 363 |
| 364 // The same URL, when specified on the command line, should allow search term | 364 // The same URL, when specified on the command line, should allow search term |
| 365 // extraction. | 365 // extraction. |
| 366 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); | 366 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); |
| 367 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, | 367 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 368 "http://www.foo.com/"); | 368 switches::kGoogleBaseURL, "http://www.foo.com/"); |
| 369 NavigateAndCheckText( | 369 NavigateAndCheckText( |
| 370 GURL("http://www.foo.com/search?q=tractor+supply&espv=1"), | 370 GURL("http://www.foo.com/search?q=tractor+supply&espv=1"), |
| 371 base::ASCIIToUTF16("tractor supply"), true, true); | 371 base::ASCIIToUTF16("tractor supply"), true, true); |
| 372 } | 372 } |
| 373 | 373 |
| 374 // Popup windows don't have an origin chip, so test that URL display in a popup | 374 // Popup windows don't have an origin chip, so test that URL display in a popup |
| 375 // ignores whether the origin chip is enabled and only respects the query | 375 // ignores whether the origin chip is enabled and only respects the query |
| 376 // extraction flag. | 376 // extraction flag. |
| 377 TEST_F(PopupToolbarModelTest, ShouldDisplayURL) { | 377 TEST_F(PopupToolbarModelTest, ShouldDisplayURL) { |
| 378 AddTab(browser(), GURL(url::kAboutBlankURL)); | 378 AddTab(browser(), GURL(url::kAboutBlankURL)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // Disabling URL replacement should reset to only showing URLs. | 414 // Disabling URL replacement should reset to only showing URLs. |
| 415 browser()->toolbar_model()->set_url_replacement_enabled(false); | 415 browser()->toolbar_model()->set_url_replacement_enabled(false); |
| 416 for (size_t i = 0; i < arraysize(test_items); ++i) { | 416 for (size_t i = 0; i < arraysize(test_items); ++i) { |
| 417 const TestItem& test_item = test_items[i]; | 417 const TestItem& test_item = test_items[i]; |
| 418 NavigateAndCheckText(test_item.url, | 418 NavigateAndCheckText(test_item.url, |
| 419 test_item.expected_text_url_replacement_inactive, | 419 test_item.expected_text_url_replacement_inactive, |
| 420 false, test_item.should_display_url); | 420 false, test_item.should_display_url); |
| 421 } | 421 } |
| 422 } | 422 } |
| OLD | NEW |