OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/metrics/histogram_base.h" | 7 #include "base/metrics/histogram_base.h" |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 GetInstantURL(profile(), false)); | 467 GetInstantURL(profile(), false)); |
468 | 468 |
469 // Disable suggest. No Instant URL. | 469 // Disable suggest. No Instant URL. |
470 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, false); | 470 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, false); |
471 EXPECT_EQ(GURL(), GetInstantURL(profile(), false)); | 471 EXPECT_EQ(GURL(), GetInstantURL(profile(), false)); |
472 | 472 |
473 // Use alternate Instant search base URL. | 473 // Use alternate Instant search base URL. |
474 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); | 474 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); |
475 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 475 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
476 "EmbeddedSearch", "Group1 espv:8 use_alternate_instant_url:1")); | 476 "EmbeddedSearch", "Group1 espv:8 use_alternate_instant_url:1")); |
477 EXPECT_EQ(GURL("https://foo.com/search?foo=foo&qbp=1#foo=foo&strk"), | 477 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo&qbp=1#foo=foo&strk"), |
478 GetInstantURL(profile(), false)); | 478 GetInstantURL(profile(), false)); |
479 } | 479 } |
480 | 480 |
481 TEST_F(SearchTest, InstantSearchEnabledCGI) { | 481 TEST_F(SearchTest, InstantSearchEnabledCGI) { |
482 // Disable Instant Search. | 482 // Disable Instant Search. |
483 // Make sure {google:forceInstantResults} is not set in the Instant URL. | 483 // Make sure {google:forceInstantResults} is not set in the Instant URL. |
484 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), | 484 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), |
485 GetInstantURL(profile(), false)); | 485 GetInstantURL(profile(), false)); |
486 | 486 |
487 // Enable Instant Search. | 487 // Enable Instant Search. |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 977 } |
978 | 978 |
979 TEST_F(OriginChipTest, CommandLineOnSrp) { | 979 TEST_F(OriginChipTest, CommandLineOnSrp) { |
980 CommandLine::ForCurrentProcess()->AppendSwitch( | 980 CommandLine::ForCurrentProcess()->AppendSwitch( |
981 switches::kEnableOriginChipOnSrp); | 981 switches::kEnableOriginChipOnSrp); |
982 EXPECT_TRUE(ShouldDisplayOriginChip()); | 982 EXPECT_TRUE(ShouldDisplayOriginChip()); |
983 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); | 983 EXPECT_EQ(ORIGIN_CHIP_ON_SRP, GetOriginChipCondition()); |
984 } | 984 } |
985 | 985 |
986 } // namespace chrome | 986 } // namespace chrome |
OLD | NEW |