| 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" | |
| 8 #include "base/metrics/histogram_samples.h" | |
| 9 #include "base/metrics/statistics_recorder.h" | 7 #include "base/metrics/statistics_recorder.h" |
| 10 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 11 #include "chrome/browser/search/instant_service.h" | 9 #include "chrome/browser/search/instant_service.h" |
| 12 #include "chrome/browser/search/instant_service_factory.h" | 10 #include "chrome/browser/search/instant_service_factory.h" |
| 13 #include "chrome/browser/search/search.h" | 11 #include "chrome/browser/search/search.h" |
| 14 #include "chrome/browser/search_engines/search_terms_data.h" | 12 #include "chrome/browser/search_engines/search_terms_data.h" |
| 15 #include "chrome/browser/search_engines/template_url_service.h" | 13 #include "chrome/browser/search_engines/template_url_service.h" |
| 16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 30 | 28 |
| 31 namespace chrome { | 29 namespace chrome { |
| 32 | 30 |
| 33 class EmbeddedSearchFieldTrialTest : public testing::Test { | 31 class EmbeddedSearchFieldTrialTest : public testing::Test { |
| 34 protected: | 32 protected: |
| 35 virtual void SetUp() { | 33 virtual void SetUp() { |
| 36 field_trial_list_.reset(new base::FieldTrialList( | 34 field_trial_list_.reset(new base::FieldTrialList( |
| 37 new metrics::SHA1EntropyProvider("42"))); | 35 new metrics::SHA1EntropyProvider("42"))); |
| 38 base::StatisticsRecorder::Initialize(); | 36 base::StatisticsRecorder::Initialize(); |
| 39 ResetInstantExtendedOptInStateGateForTest(); | |
| 40 } | 37 } |
| 41 | 38 |
| 42 private: | 39 private: |
| 43 scoped_ptr<base::FieldTrialList> field_trial_list_; | 40 scoped_ptr<base::FieldTrialList> field_trial_list_; |
| 44 }; | 41 }; |
| 45 | 42 |
| 46 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoEmptyAndValid) { | 43 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoEmptyAndValid) { |
| 47 FieldTrialFlags flags; | 44 FieldTrialFlags flags; |
| 48 uint64 group_number = 0; | |
| 49 | 45 |
| 50 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 46 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 51 EXPECT_EQ(0ul, group_number); | |
| 52 EXPECT_EQ(0ul, flags.size()); | 47 EXPECT_EQ(0ul, flags.size()); |
| 53 | 48 |
| 54 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 49 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 55 "InstantExtended", "Group77")); | 50 "InstantExtended", "Group77")); |
| 56 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 51 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 57 EXPECT_EQ(77ul, group_number); | |
| 58 EXPECT_EQ(0ul, flags.size()); | 52 EXPECT_EQ(0ul, flags.size()); |
| 59 } | 53 } |
| 60 | 54 |
| 61 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoInvalidNumber) { | 55 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoInvalidNumber) { |
| 62 FieldTrialFlags flags; | 56 FieldTrialFlags flags; |
| 63 uint64 group_number = 0; | |
| 64 | 57 |
| 65 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 58 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 66 "InstantExtended", "Group77.2")); | 59 "InstantExtended", "Group77.2")); |
| 67 EXPECT_FALSE(GetFieldTrialInfo(&flags, &group_number)); | 60 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 68 EXPECT_EQ(0ul, group_number); | |
| 69 EXPECT_EQ(0ul, flags.size()); | 61 EXPECT_EQ(0ul, flags.size()); |
| 70 } | 62 } |
| 71 | 63 |
| 72 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoInvalidName) { | 64 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoInvalidName) { |
| 73 FieldTrialFlags flags; | 65 FieldTrialFlags flags; |
| 74 uint64 group_number = 0; | |
| 75 | 66 |
| 76 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 67 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 77 "InstantExtended", "Invalid77")); | 68 "InstantExtended", "Invalid77")); |
| 78 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 69 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 79 EXPECT_EQ(0ul, group_number); | |
| 80 EXPECT_EQ(0ul, flags.size()); | 70 EXPECT_EQ(0ul, flags.size()); |
| 81 } | 71 } |
| 82 | 72 |
| 83 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoValidGroup) { | 73 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoValidGroup) { |
| 84 FieldTrialFlags flags; | 74 FieldTrialFlags flags; |
| 85 uint64 group_number = 0; | |
| 86 | 75 |
| 87 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 76 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 88 "InstantExtended", "Group77")); | 77 "InstantExtended", "Group77")); |
| 89 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 78 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 90 EXPECT_EQ(77ul, group_number); | |
| 91 EXPECT_EQ(0ul, flags.size()); | 79 EXPECT_EQ(0ul, flags.size()); |
| 92 } | 80 } |
| 93 | 81 |
| 94 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoValidFlag) { | 82 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoValidFlag) { |
| 95 FieldTrialFlags flags; | 83 FieldTrialFlags flags; |
| 96 uint64 group_number = 0; | |
| 97 | 84 |
| 98 EXPECT_EQ(9999ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); | 85 EXPECT_EQ(9999ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); |
| 99 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 86 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 100 "InstantExtended", "Group77 foo:6")); | 87 "InstantExtended", "Group77 foo:6")); |
| 101 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 88 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 102 EXPECT_EQ(77ul, group_number); | |
| 103 EXPECT_EQ(1ul, flags.size()); | 89 EXPECT_EQ(1ul, flags.size()); |
| 104 EXPECT_EQ(6ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); | 90 EXPECT_EQ(6ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); |
| 105 } | 91 } |
| 106 | 92 |
| 107 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoNewName) { | 93 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoNewName) { |
| 108 FieldTrialFlags flags; | 94 FieldTrialFlags flags; |
| 109 uint64 group_number = 0; | |
| 110 | 95 |
| 111 EXPECT_EQ(9999ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); | 96 EXPECT_EQ(9999ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); |
| 112 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 97 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 113 "EmbeddedSearch", "Group77 foo:6")); | 98 "EmbeddedSearch", "Group77 foo:6")); |
| 114 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 99 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 115 EXPECT_EQ(77ul, group_number); | |
| 116 EXPECT_EQ(1ul, flags.size()); | 100 EXPECT_EQ(1ul, flags.size()); |
| 117 EXPECT_EQ(6ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); | 101 EXPECT_EQ(6ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); |
| 118 } | 102 } |
| 119 | 103 |
| 120 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoNewNameOverridesOld) { | 104 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoNewNameOverridesOld) { |
| 121 FieldTrialFlags flags; | 105 FieldTrialFlags flags; |
| 122 uint64 group_number = 0; | |
| 123 | 106 |
| 124 EXPECT_EQ(9999ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); | 107 EXPECT_EQ(9999ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); |
| 125 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 108 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 126 "EmbeddedSearch", "Group77 foo:6")); | 109 "EmbeddedSearch", "Group77 foo:6")); |
| 127 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 110 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 128 "InstantExtended", "Group78 foo:5")); | 111 "InstantExtended", "Group78 foo:5")); |
| 129 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 112 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 130 EXPECT_EQ(77ul, group_number); | |
| 131 EXPECT_EQ(1ul, flags.size()); | 113 EXPECT_EQ(1ul, flags.size()); |
| 132 EXPECT_EQ(6ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); | 114 EXPECT_EQ(6ul, GetUInt64ValueForFlagWithDefault("foo", 9999, flags)); |
| 133 } | 115 } |
| 134 | 116 |
| 135 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoLotsOfFlags) { | 117 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoLotsOfFlags) { |
| 136 FieldTrialFlags flags; | 118 FieldTrialFlags flags; |
| 137 uint64 group_number = 0; | |
| 138 | 119 |
| 139 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 120 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 140 "InstantExtended", "Group77 bar:1 baz:7 cat:dogs")); | 121 "InstantExtended", "Group77 bar:1 baz:7 cat:dogs")); |
| 141 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 122 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 142 EXPECT_EQ(77ul, group_number); | |
| 143 EXPECT_EQ(3ul, flags.size()); | 123 EXPECT_EQ(3ul, flags.size()); |
| 144 EXPECT_EQ(true, GetBoolValueForFlagWithDefault("bar", false, flags)); | 124 EXPECT_EQ(true, GetBoolValueForFlagWithDefault("bar", false, flags)); |
| 145 EXPECT_EQ(7ul, GetUInt64ValueForFlagWithDefault("baz", 0, flags)); | 125 EXPECT_EQ(7ul, GetUInt64ValueForFlagWithDefault("baz", 0, flags)); |
| 146 EXPECT_EQ("dogs", | 126 EXPECT_EQ("dogs", |
| 147 GetStringValueForFlagWithDefault("cat", std::string(), flags)); | 127 GetStringValueForFlagWithDefault("cat", std::string(), flags)); |
| 148 EXPECT_EQ("default", | 128 EXPECT_EQ("default", |
| 149 GetStringValueForFlagWithDefault("moose", "default", flags)); | 129 GetStringValueForFlagWithDefault("moose", "default", flags)); |
| 150 } | 130 } |
| 151 | 131 |
| 152 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoDisabled) { | 132 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoDisabled) { |
| 153 FieldTrialFlags flags; | 133 FieldTrialFlags flags; |
| 154 uint64 group_number = 0; | |
| 155 | 134 |
| 156 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 135 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 157 "InstantExtended", "Group77 bar:1 baz:7 cat:dogs DISABLED")); | 136 "InstantExtended", "Group77 bar:1 baz:7 cat:dogs DISABLED")); |
| 158 EXPECT_FALSE(GetFieldTrialInfo(&flags, &group_number)); | 137 EXPECT_FALSE(GetFieldTrialInfo(&flags)); |
| 159 EXPECT_EQ(0ul, group_number); | |
| 160 EXPECT_EQ(0ul, flags.size()); | 138 EXPECT_EQ(0ul, flags.size()); |
| 161 } | 139 } |
| 162 | 140 |
| 163 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoControlFlags) { | 141 TEST_F(EmbeddedSearchFieldTrialTest, GetFieldTrialInfoControlFlags) { |
| 164 FieldTrialFlags flags; | 142 FieldTrialFlags flags; |
| 165 uint64 group_number = 0; | |
| 166 | 143 |
| 167 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 144 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 168 "InstantExtended", "Control77 bar:1 baz:7 cat:dogs")); | 145 "InstantExtended", "Control77 bar:1 baz:7 cat:dogs")); |
| 169 EXPECT_TRUE(GetFieldTrialInfo(&flags, &group_number)); | 146 EXPECT_TRUE(GetFieldTrialInfo(&flags)); |
| 170 EXPECT_EQ(0ul, group_number); | |
| 171 EXPECT_EQ(3ul, flags.size()); | 147 EXPECT_EQ(3ul, flags.size()); |
| 172 } | 148 } |
| 173 | 149 |
| 174 class InstantExtendedAPIEnabledTest : public testing::Test { | |
| 175 public: | |
| 176 InstantExtendedAPIEnabledTest() : histogram_(NULL) { | |
| 177 } | |
| 178 protected: | |
| 179 virtual void SetUp() { | |
| 180 field_trial_list_.reset(new base::FieldTrialList( | |
| 181 new metrics::SHA1EntropyProvider("42"))); | |
| 182 base::StatisticsRecorder::Initialize(); | |
| 183 ResetInstantExtendedOptInStateGateForTest(); | |
| 184 previous_metrics_count_.resize(INSTANT_EXTENDED_OPT_IN_STATE_ENUM_COUNT, 0); | |
| 185 base::HistogramBase* histogram = GetHistogram(); | |
| 186 if (histogram) { | |
| 187 scoped_ptr<base::HistogramSamples> samples(histogram->SnapshotSamples()); | |
| 188 if (samples.get()) { | |
| 189 for (int state = INSTANT_EXTENDED_NOT_SET; | |
| 190 state < INSTANT_EXTENDED_OPT_IN_STATE_ENUM_COUNT; ++state) { | |
| 191 previous_metrics_count_[state] = samples->GetCount(state); | |
| 192 } | |
| 193 } | |
| 194 } | |
| 195 } | |
| 196 | |
| 197 virtual CommandLine* GetCommandLine() const { | |
| 198 return CommandLine::ForCurrentProcess(); | |
| 199 } | |
| 200 | |
| 201 void ValidateMetrics(base::HistogramBase::Sample value) { | |
| 202 base::HistogramBase* histogram = GetHistogram(); | |
| 203 if (histogram) { | |
| 204 scoped_ptr<base::HistogramSamples> samples(histogram->SnapshotSamples()); | |
| 205 if (samples.get()) { | |
| 206 for (int state = INSTANT_EXTENDED_NOT_SET; | |
| 207 state < INSTANT_EXTENDED_OPT_IN_STATE_ENUM_COUNT; ++state) { | |
| 208 if (state == value) { | |
| 209 EXPECT_EQ(previous_metrics_count_[state] + 1, | |
| 210 samples->GetCount(state)); | |
| 211 } else { | |
| 212 EXPECT_EQ(previous_metrics_count_[state], samples->GetCount(state)); | |
| 213 } | |
| 214 } | |
| 215 } | |
| 216 } | |
| 217 } | |
| 218 | |
| 219 private: | |
| 220 base::HistogramBase* GetHistogram() { | |
| 221 if (!histogram_) { | |
| 222 histogram_ = base::StatisticsRecorder::FindHistogram( | |
| 223 "InstantExtended.OptInState"); | |
| 224 } | |
| 225 return histogram_; | |
| 226 } | |
| 227 base::HistogramBase* histogram_; | |
| 228 scoped_ptr<base::FieldTrialList> field_trial_list_; | |
| 229 std::vector<int> previous_metrics_count_; | |
| 230 }; | |
| 231 | |
| 232 TEST_F(InstantExtendedAPIEnabledTest, EnabledViaCommandLineFlag) { | |
| 233 GetCommandLine()->AppendSwitch(switches::kEnableInstantExtendedAPI); | |
| 234 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
| 235 #if defined(OS_IOS) || defined(OS_ANDROID) | |
| 236 EXPECT_EQ(1ul, EmbeddedSearchPageVersion()); | |
| 237 #else | |
| 238 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | |
| 239 #endif | |
| 240 ValidateMetrics(INSTANT_EXTENDED_OPT_IN); | |
| 241 } | |
| 242 | |
| 243 TEST_F(InstantExtendedAPIEnabledTest, EnabledViaFinchFlag) { | |
| 244 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | |
| 245 "Group1 espv:42")); | |
| 246 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
| 247 EXPECT_EQ(42ul, EmbeddedSearchPageVersion()); | |
| 248 ValidateMetrics(INSTANT_EXTENDED_NOT_SET); | |
| 249 } | |
| 250 | |
| 251 TEST_F(InstantExtendedAPIEnabledTest, DisabledViaCommandLineFlag) { | |
| 252 GetCommandLine()->AppendSwitch(switches::kDisableInstantExtendedAPI); | |
| 253 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | |
| 254 "Group1 espv:2")); | |
| 255 EXPECT_FALSE(IsInstantExtendedAPIEnabled()); | |
| 256 EXPECT_EQ(0ul, EmbeddedSearchPageVersion()); | |
| 257 ValidateMetrics(INSTANT_EXTENDED_OPT_OUT); | |
| 258 } | |
| 259 | |
| 260 typedef InstantExtendedAPIEnabledTest ShouldHideTopVerbatimTest; | |
| 261 | |
| 262 TEST_F(ShouldHideTopVerbatimTest, DoNotHideByDefault) { | |
| 263 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 264 "InstantExtended", "Control")); | |
| 265 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
| 266 } | |
| 267 | |
| 268 TEST_F(ShouldHideTopVerbatimTest, DoNotHideInInstantExtended) { | |
| 269 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 270 "InstantExtended", "Group1")); | |
| 271 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
| 272 } | |
| 273 | |
| 274 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagInInstantExtended) { | |
| 275 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 276 "InstantExtended", "Group1 hide_verbatim:1")); | |
| 277 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); | |
| 278 } | |
| 279 | |
| 280 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagOutsideInstantExtended) { | |
| 281 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 282 "InstantExtended", "Controll1 hide_verbatim:1")); | |
| 283 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); | |
| 284 } | |
| 285 | |
| 286 TEST_F(ShouldHideTopVerbatimTest, DisableByFlag) { | |
| 287 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 288 "InstantExtended", "Group1 hide_verbatim:0")); | |
| 289 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); | |
| 290 } | |
| 291 | |
| 292 typedef InstantExtendedAPIEnabledTest ShouldSuppressInstantExtendedOnSRPTest; | |
| 293 | |
| 294 TEST_F(ShouldSuppressInstantExtendedOnSRPTest, NotSet) { | |
| 295 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 296 "InstantExtended", "Group1 espv:2")); | |
| 297 EXPECT_FALSE(ShouldSuppressInstantExtendedOnSRP()); | |
| 298 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
| 299 EXPECT_TRUE(IsQueryExtractionEnabled()); | |
| 300 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | |
| 301 } | |
| 302 | |
| 303 TEST_F(ShouldSuppressInstantExtendedOnSRPTest, NotSuppressOnSRP) { | |
| 304 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 305 "InstantExtended", "Group1 espv:2 suppress_on_srp:0")); | |
| 306 EXPECT_FALSE(ShouldSuppressInstantExtendedOnSRP()); | |
| 307 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
| 308 EXPECT_TRUE(IsQueryExtractionEnabled()); | |
| 309 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | |
| 310 } | |
| 311 | |
| 312 TEST_F(ShouldSuppressInstantExtendedOnSRPTest, SuppressOnSRP) { | |
| 313 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 314 "InstantExtended", "Group1 espv:2 suppress_on_srp:1")); | |
| 315 EXPECT_TRUE(ShouldSuppressInstantExtendedOnSRP()); | |
| 316 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); | |
| 317 EXPECT_FALSE(IsQueryExtractionEnabled()); | |
| 318 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | |
| 319 } | |
| 320 | |
| 321 class SearchTest : public BrowserWithTestWindowTest { | 150 class SearchTest : public BrowserWithTestWindowTest { |
| 322 protected: | 151 protected: |
| 323 virtual void SetUp() OVERRIDE { | 152 virtual void SetUp() OVERRIDE { |
| 324 BrowserWithTestWindowTest::SetUp(); | 153 BrowserWithTestWindowTest::SetUp(); |
| 325 field_trial_list_.reset(new base::FieldTrialList( | 154 field_trial_list_.reset(new base::FieldTrialList( |
| 326 new metrics::SHA1EntropyProvider("42"))); | 155 new metrics::SHA1EntropyProvider("42"))); |
| 327 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 156 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 328 profile(), &TemplateURLServiceFactory::BuildInstanceFor); | 157 profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
| 329 TemplateURLService* template_url_service = | 158 TemplateURLService* template_url_service = |
| 330 TemplateURLServiceFactory::GetForProfile(profile()); | 159 TemplateURLServiceFactory::GetForProfile(profile()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 bool InInstantProcess(const content::WebContents* contents) { | 208 bool InInstantProcess(const content::WebContents* contents) { |
| 380 InstantService* instant_service = | 209 InstantService* instant_service = |
| 381 InstantServiceFactory::GetForProfile(profile()); | 210 InstantServiceFactory::GetForProfile(profile()); |
| 382 return instant_service->IsInstantProcess( | 211 return instant_service->IsInstantProcess( |
| 383 contents->GetRenderProcessHost()->GetID()); | 212 contents->GetRenderProcessHost()->GetID()); |
| 384 } | 213 } |
| 385 | 214 |
| 386 scoped_ptr<base::FieldTrialList> field_trial_list_; | 215 scoped_ptr<base::FieldTrialList> field_trial_list_; |
| 387 }; | 216 }; |
| 388 | 217 |
| 218 typedef SearchTest ShouldHideTopVerbatimTest; |
| 219 |
| 220 TEST_F(ShouldHideTopVerbatimTest, DoNotHideByDefault) { |
| 221 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 222 "InstantExtended", "Control")); |
| 223 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); |
| 224 } |
| 225 |
| 226 TEST_F(ShouldHideTopVerbatimTest, DoNotHideInInstantExtended) { |
| 227 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 228 "InstantExtended", "Group1")); |
| 229 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); |
| 230 } |
| 231 |
| 232 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagInInstantExtended) { |
| 233 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 234 "InstantExtended", "Group1 hide_verbatim:1")); |
| 235 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); |
| 236 } |
| 237 |
| 238 TEST_F(ShouldHideTopVerbatimTest, EnableByFlagOutsideInstantExtended) { |
| 239 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 240 "InstantExtended", "Controll1 hide_verbatim:1")); |
| 241 EXPECT_TRUE(ShouldHideTopVerbatimMatch()); |
| 242 } |
| 243 |
| 244 TEST_F(ShouldHideTopVerbatimTest, DisableByFlag) { |
| 245 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 246 "InstantExtended", "Group1 hide_verbatim:0")); |
| 247 EXPECT_FALSE(ShouldHideTopVerbatimMatch()); |
| 248 } |
| 249 |
| 250 typedef SearchTest IsQueryExtractionEnabledTest; |
| 251 |
| 252 TEST_F(IsQueryExtractionEnabledTest, NotSet) { |
| 253 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 254 "InstantExtended", "Group1 espv:2")); |
| 255 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); |
| 256 EXPECT_FALSE(IsQueryExtractionEnabled()); |
| 257 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
| 258 } |
| 259 |
| 260 TEST_F(IsQueryExtractionEnabledTest, QueryExtractionEnabledViaFinch) { |
| 261 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 262 "InstantExtended", "Group1 espv:2 query_extraction:1")); |
| 263 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); |
| 264 EXPECT_TRUE(IsQueryExtractionEnabled()); |
| 265 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
| 266 } |
| 267 |
| 268 TEST_F(IsQueryExtractionEnabledTest, QueryExtractionEnabledViaCommandLine) { |
| 269 EnableQueryExtractionForTesting(); |
| 270 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); |
| 271 EXPECT_TRUE(IsQueryExtractionEnabled()); |
| 272 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
| 273 } |
| 274 |
| 275 TEST_F(IsQueryExtractionEnabledTest, QueryExtractionDisabledViaFinch) { |
| 276 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 277 "InstantExtended", "Group1 espv:2 query_extraction:0")); |
| 278 EXPECT_TRUE(IsInstantExtendedAPIEnabled()); |
| 279 EXPECT_FALSE(IsQueryExtractionEnabled()); |
| 280 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
| 281 } |
| 282 |
| 389 struct SearchTestCase { | 283 struct SearchTestCase { |
| 390 const char* url; | 284 const char* url; |
| 391 bool expected_result; | 285 bool expected_result; |
| 392 const char* comment; | 286 const char* comment; |
| 393 }; | 287 }; |
| 394 | 288 |
| 395 TEST_F(SearchTest, ShouldAssignURLToInstantRendererExtendedDisabled) { | 289 TEST_F(SearchTest, ShouldAssignURLToInstantRendererSRPEnabled) { |
| 396 DisableInstantExtendedAPIForTesting(); | 290 EnableQueryExtractionForTesting(); |
| 397 | |
| 398 const SearchTestCase kTestCases[] = { | |
| 399 {"chrome-search://foo/bar", false, ""}, | |
| 400 {"http://foo.com/instant", false, ""}, | |
| 401 {"http://foo.com/instant?foo=bar", false, ""}, | |
| 402 {"https://foo.com/instant", false, ""}, | |
| 403 {"https://foo.com/instant#foo=bar", false, ""}, | |
| 404 {"HtTpS://fOo.CoM/instant", false, ""}, | |
| 405 {"http://foo.com:80/instant", false, ""}, | |
| 406 {"invalid URL", false, "Invalid URL"}, | |
| 407 {"unknown://scheme/path", false, "Unknown scheme"}, | |
| 408 {"ftp://foo.com/instant", false, "Non-HTTP scheme"}, | |
| 409 {"http://sub.foo.com/instant", false, "Non-exact host"}, | |
| 410 {"http://foo.com:26/instant", false, "Non-default port"}, | |
| 411 {"http://foo.com/instant/bar", false, "Non-exact path"}, | |
| 412 {"http://foo.com/Instant", false, "Case sensitive path"}, | |
| 413 {"http://foo.com/", false, "Non-exact path"}, | |
| 414 {"https://foo.com/", false, "Non-exact path"}, | |
| 415 {"https://foo.com/url?strk", false, "Non-extended mode"}, | |
| 416 {"https://foo.com/alt?strk", false, "Non-extended mode"}, | |
| 417 }; | |
| 418 | |
| 419 for (size_t i = 0; i < arraysize(kTestCases); ++i) { | |
| 420 const SearchTestCase& test = kTestCases[i]; | |
| 421 EXPECT_EQ(test.expected_result, | |
| 422 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) | |
| 423 << test.url << " " << test.comment; | |
| 424 } | |
| 425 } | |
| 426 | |
| 427 TEST_F(SearchTest, ShouldAssignURLToInstantRendererExtendedEnabled) { | |
| 428 EnableInstantExtendedAPIForTesting(); | |
| 429 | 291 |
| 430 const SearchTestCase kTestCases[] = { | 292 const SearchTestCase kTestCases[] = { |
| 431 {chrome::kChromeSearchLocalNtpUrl, true, ""}, | 293 {chrome::kChromeSearchLocalNtpUrl, true, ""}, |
| 432 {"https://foo.com/instant?strk", true, ""}, | 294 {"https://foo.com/instant?strk", true, ""}, |
| 433 {"https://foo.com/instant#strk", true, ""}, | 295 {"https://foo.com/instant#strk", true, ""}, |
| 434 {"https://foo.com/instant?strk=0", true, ""}, | 296 {"https://foo.com/instant?strk=0", true, ""}, |
| 435 {"https://foo.com/url?strk", true, ""}, | 297 {"https://foo.com/url?strk", true, ""}, |
| 436 {"https://foo.com/alt?strk", true, ""}, | 298 {"https://foo.com/alt?strk", true, ""}, |
| 437 {"http://foo.com/instant", false, "Non-HTTPS"}, | 299 {"http://foo.com/instant", false, "Non-HTTPS"}, |
| 438 {"http://foo.com/instant?strk", false, "Non-HTTPS"}, | 300 {"http://foo.com/instant?strk", false, "Non-HTTPS"}, |
| 439 {"http://foo.com/instant?strk=1", false, "Non-HTTPS"}, | 301 {"http://foo.com/instant?strk=1", false, "Non-HTTPS"}, |
| 440 {"https://foo.com/instant", false, "No search terms replacement"}, | 302 {"https://foo.com/instant", false, "No search terms replacement"}, |
| 441 {"https://foo.com/?strk", false, "Non-exact path"}, | 303 {"https://foo.com/?strk", false, "Non-exact path"}, |
| 442 }; | 304 }; |
| 443 | 305 |
| 444 for (size_t i = 0; i < arraysize(kTestCases); ++i) { | 306 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| 445 const SearchTestCase& test = kTestCases[i]; | 307 const SearchTestCase& test = kTestCases[i]; |
| 446 EXPECT_EQ(test.expected_result, | 308 EXPECT_EQ(test.expected_result, |
| 447 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) | 309 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) |
| 448 << test.url << " " << test.comment; | 310 << test.url << " " << test.comment; |
| 449 } | 311 } |
| 450 } | 312 } |
| 451 | 313 |
| 452 TEST_F(SearchTest, ShouldAssignURLToInstantRendererExtendedEnabledNotOnSRP) { | 314 TEST_F(SearchTest, ShouldAssignURLToInstantRenderer) { |
| 453 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 454 "InstantExtended", "Group1 espv:2 suppress_on_srp:1")); | |
| 455 | |
| 456 const SearchTestCase kTestCases[] = { | 315 const SearchTestCase kTestCases[] = { |
| 457 {chrome::kChromeSearchLocalNtpUrl, true, ""}, | 316 {chrome::kChromeSearchLocalNtpUrl, true, ""}, |
| 458 {"https://foo.com/instant?strk", true, ""}, | 317 {"https://foo.com/instant?strk", true, ""}, |
| 459 {"https://foo.com/instant#strk", true, ""}, | 318 {"https://foo.com/instant#strk", true, ""}, |
| 460 {"https://foo.com/instant?strk=0", true, ""}, | 319 {"https://foo.com/instant?strk=0", true, ""}, |
| 461 {"https://foo.com/url?strk", false, "Disabled on SRP"}, | 320 {"https://foo.com/url?strk", false, "Disabled on SRP"}, |
| 462 {"https://foo.com/alt?strk", false, "Disabled ON SRP"}, | 321 {"https://foo.com/alt?strk", false, "Disabled ON SRP"}, |
| 463 {"http://foo.com/instant", false, "Non-HTTPS"}, | 322 {"http://foo.com/instant", false, "Non-HTTPS"}, |
| 464 {"http://foo.com/instant?strk", false, "Non-HTTPS"}, | 323 {"http://foo.com/instant?strk", false, "Non-HTTPS"}, |
| 465 {"http://foo.com/instant?strk=1", false, "Non-HTTPS"}, | 324 {"http://foo.com/instant?strk=1", false, "Non-HTTPS"}, |
| 466 {"https://foo.com/instant", false, "No search terms replacement"}, | 325 {"https://foo.com/instant", false, "No search terms replacement"}, |
| 467 {"https://foo.com/?strk", false, "Non-exact path"}, | 326 {"https://foo.com/?strk", false, "Non-exact path"}, |
| 468 }; | 327 }; |
| 469 | 328 |
| 470 for (size_t i = 0; i < arraysize(kTestCases); ++i) { | 329 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| 471 const SearchTestCase& test = kTestCases[i]; | 330 const SearchTestCase& test = kTestCases[i]; |
| 472 EXPECT_EQ(test.expected_result, | 331 EXPECT_EQ(test.expected_result, |
| 473 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) | 332 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) |
| 474 << test.url << " " << test.comment; | 333 << test.url << " " << test.comment; |
| 475 } | 334 } |
| 476 } | 335 } |
| 477 | 336 |
| 478 TEST_F(SearchTest, ShouldUseProcessPerSiteForInstantURL) { | 337 TEST_F(SearchTest, ShouldUseProcessPerSiteForInstantURL) { |
| 479 EnableInstantExtendedAPIForTesting(); | |
| 480 | |
| 481 const SearchTestCase kTestCases[] = { | 338 const SearchTestCase kTestCases[] = { |
| 482 {"chrome-search://local-ntp", true, "Local NTP"}, | 339 {"chrome-search://local-ntp", true, "Local NTP"}, |
| 483 {"chrome-search://online-ntp", true, "Online NTP"}, | 340 {"chrome-search://online-ntp", true, "Online NTP"}, |
| 484 {"invalid-scheme://local-ntp", false, "Invalid Local NTP URL"}, | 341 {"invalid-scheme://local-ntp", false, "Invalid Local NTP URL"}, |
| 485 {"invalid-scheme://online-ntp", false, "Invalid Online NTP URL"}, | 342 {"invalid-scheme://online-ntp", false, "Invalid Online NTP URL"}, |
| 486 {"chrome-search://foo.com", false, "Search result page"}, | 343 {"chrome-search://foo.com", false, "Search result page"}, |
| 487 {"https://foo.com/instant?strk", false, ""}, | 344 {"https://foo.com/instant?strk", false, ""}, |
| 488 {"https://foo.com/instant#strk", false, ""}, | 345 {"https://foo.com/instant#strk", false, ""}, |
| 489 {"https://foo.com/instant?strk=0", false, ""}, | 346 {"https://foo.com/instant?strk=0", false, ""}, |
| 490 {"https://foo.com/url?strk", false, ""}, | 347 {"https://foo.com/url?strk", false, ""}, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 "https://foo.com/url?strk", true, true }, | 390 "https://foo.com/url?strk", true, true }, |
| 534 {"SRP -> Regular", | 391 {"SRP -> Regular", |
| 535 "https://foo.com/url?strk", true, | 392 "https://foo.com/url?strk", true, |
| 536 "https://foo.com/other", false, false }, | 393 "https://foo.com/other", false, false }, |
| 537 {"Regular -> SRP", | 394 {"Regular -> SRP", |
| 538 "https://foo.com/other", false, | 395 "https://foo.com/other", false, |
| 539 "https://foo.com/url?strk", true, false }, | 396 "https://foo.com/url?strk", true, false }, |
| 540 }; | 397 }; |
| 541 | 398 |
| 542 TEST_F(SearchTest, ProcessIsolation) { | 399 TEST_F(SearchTest, ProcessIsolation) { |
| 543 EnableInstantExtendedAPIForTesting(); | 400 EnableQueryExtractionForTesting(); |
| 544 | 401 |
| 545 for (size_t i = 0; i < arraysize(kProcessIsolationTestCases); ++i) { | 402 for (size_t i = 0; i < arraysize(kProcessIsolationTestCases); ++i) { |
| 546 const ProcessIsolationTestCase& test = kProcessIsolationTestCases[i]; | 403 const ProcessIsolationTestCase& test = kProcessIsolationTestCases[i]; |
| 547 AddTab(browser(), GURL("chrome://blank")); | 404 AddTab(browser(), GURL("chrome://blank")); |
| 548 const content::WebContents* contents = | 405 const content::WebContents* contents = |
| 549 browser()->tab_strip_model()->GetActiveWebContents(); | 406 browser()->tab_strip_model()->GetActiveWebContents(); |
| 550 | 407 |
| 551 // Navigate to start URL. | 408 // Navigate to start URL. |
| 552 NavigateAndCommitActiveTab(GURL(test.start_url)); | 409 NavigateAndCommitActiveTab(GURL(test.start_url)); |
| 553 EXPECT_EQ(test.start_in_instant_process, InInstantProcess(contents)) | 410 EXPECT_EQ(test.start_in_instant_process, InInstantProcess(contents)) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 572 EXPECT_EQ(test.same_site_instance, | 429 EXPECT_EQ(test.same_site_instance, |
| 573 start_rvh == contents->GetRenderViewHost()) | 430 start_rvh == contents->GetRenderViewHost()) |
| 574 << test.description; | 431 << test.description; |
| 575 EXPECT_EQ(test.same_site_instance, | 432 EXPECT_EQ(test.same_site_instance, |
| 576 start_rph == contents->GetRenderProcessHost()) | 433 start_rph == contents->GetRenderProcessHost()) |
| 577 << test.description; | 434 << test.description; |
| 578 } | 435 } |
| 579 } | 436 } |
| 580 | 437 |
| 581 TEST_F(SearchTest, ProcessIsolation_RendererInitiated) { | 438 TEST_F(SearchTest, ProcessIsolation_RendererInitiated) { |
| 582 EnableInstantExtendedAPIForTesting(); | 439 EnableQueryExtractionForTesting(); |
| 583 | 440 |
| 584 for (size_t i = 0; i < arraysize(kProcessIsolationTestCases); ++i) { | 441 for (size_t i = 0; i < arraysize(kProcessIsolationTestCases); ++i) { |
| 585 const ProcessIsolationTestCase& test = kProcessIsolationTestCases[i]; | 442 const ProcessIsolationTestCase& test = kProcessIsolationTestCases[i]; |
| 586 AddTab(browser(), GURL("chrome://blank")); | 443 AddTab(browser(), GURL("chrome://blank")); |
| 587 content::WebContents* contents = | 444 content::WebContents* contents = |
| 588 browser()->tab_strip_model()->GetActiveWebContents(); | 445 browser()->tab_strip_model()->GetActiveWebContents(); |
| 589 | 446 |
| 590 // Navigate to start URL. | 447 // Navigate to start URL. |
| 591 NavigateAndCommitActiveTab(GURL(test.start_url)); | 448 NavigateAndCommitActiveTab(GURL(test.start_url)); |
| 592 EXPECT_EQ(test.start_in_instant_process, InInstantProcess(contents)) | 449 EXPECT_EQ(test.start_in_instant_process, InInstantProcess(contents)) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 {"https://foo.com/url?strk&bar=abc", false, "Has query terms"}, | 494 {"https://foo.com/url?strk&bar=abc", false, "Has query terms"}, |
| 638 {"http://foo.com/instant?strk=1", false, "Insecure URL"}, | 495 {"http://foo.com/instant?strk=1", false, "Insecure URL"}, |
| 639 {"https://foo.com/instant", false, "No search term replacement"}, | 496 {"https://foo.com/instant", false, "No search term replacement"}, |
| 640 {"chrome://blank/", false, "Chrome scheme"}, | 497 {"chrome://blank/", false, "Chrome scheme"}, |
| 641 {"chrome-search://foo", false, "Chrome-search scheme"}, | 498 {"chrome-search://foo", false, "Chrome-search scheme"}, |
| 642 {chrome::kChromeSearchLocalNtpUrl, true, "Local new tab page"}, | 499 {chrome::kChromeSearchLocalNtpUrl, true, "Local new tab page"}, |
| 643 {"https://bar.com/instant?strk=1", false, "Random non-search page"}, | 500 {"https://bar.com/instant?strk=1", false, "Random non-search page"}, |
| 644 }; | 501 }; |
| 645 | 502 |
| 646 TEST_F(SearchTest, InstantNTPExtendedEnabled) { | 503 TEST_F(SearchTest, InstantNTPExtendedEnabled) { |
| 647 EnableInstantExtendedAPIForTesting(); | 504 EnableQueryExtractionForTesting(); |
| 648 AddTab(browser(), GURL("chrome://blank")); | 505 AddTab(browser(), GURL("chrome://blank")); |
| 649 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { | 506 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { |
| 650 const SearchTestCase& test = kInstantNTPTestCases[i]; | 507 const SearchTestCase& test = kInstantNTPTestCases[i]; |
| 651 NavigateAndCommitActiveTab(GURL(test.url)); | 508 NavigateAndCommitActiveTab(GURL(test.url)); |
| 652 const content::WebContents* contents = | 509 const content::WebContents* contents = |
| 653 browser()->tab_strip_model()->GetWebContentsAt(0); | 510 browser()->tab_strip_model()->GetWebContentsAt(0); |
| 654 EXPECT_EQ(test.expected_result, IsInstantNTP(contents)) | 511 EXPECT_EQ(test.expected_result, IsInstantNTP(contents)) |
| 655 << test.url << " " << test.comment; | 512 << test.url << " " << test.comment; |
| 656 } | 513 } |
| 657 } | 514 } |
| 658 | 515 |
| 659 TEST_F(SearchTest, InstantNTPExtendedDisabled) { | |
| 660 AddTab(browser(), GURL("chrome://blank")); | |
| 661 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { | |
| 662 const SearchTestCase& test = kInstantNTPTestCases[i]; | |
| 663 NavigateAndCommitActiveTab(GURL(test.url)); | |
| 664 const content::WebContents* contents = | |
| 665 browser()->tab_strip_model()->GetWebContentsAt(0); | |
| 666 EXPECT_FALSE(IsInstantNTP(contents)) << test.url << " " << test.comment; | |
| 667 } | |
| 668 } | |
| 669 | |
| 670 TEST_F(SearchTest, InstantNTPCustomNavigationEntry) { | 516 TEST_F(SearchTest, InstantNTPCustomNavigationEntry) { |
| 671 EnableInstantExtendedAPIForTesting(); | 517 EnableQueryExtractionForTesting(); |
| 672 AddTab(browser(), GURL("chrome://blank")); | 518 AddTab(browser(), GURL("chrome://blank")); |
| 673 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { | 519 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { |
| 674 const SearchTestCase& test = kInstantNTPTestCases[i]; | 520 const SearchTestCase& test = kInstantNTPTestCases[i]; |
| 675 NavigateAndCommitActiveTab(GURL(test.url)); | 521 NavigateAndCommitActiveTab(GURL(test.url)); |
| 676 content::WebContents* contents = | 522 content::WebContents* contents = |
| 677 browser()->tab_strip_model()->GetWebContentsAt(0); | 523 browser()->tab_strip_model()->GetWebContentsAt(0); |
| 678 content::NavigationController& controller = contents->GetController(); | 524 content::NavigationController& controller = contents->GetController(); |
| 679 controller.SetTransientEntry( | 525 controller.SetTransientEntry( |
| 680 controller.CreateNavigationEntry(GURL("chrome://blank"), | 526 controller.CreateNavigationEntry(GURL("chrome://blank"), |
| 681 content::Referrer(), | 527 content::Referrer(), |
| 682 content::PAGE_TRANSITION_LINK, | 528 content::PAGE_TRANSITION_LINK, |
| 683 false, | 529 false, |
| 684 std::string(), | 530 std::string(), |
| 685 contents->GetBrowserContext())); | 531 contents->GetBrowserContext())); |
| 686 // The active entry is chrome://blank and not an NTP. | 532 // The active entry is chrome://blank and not an NTP. |
| 687 EXPECT_FALSE(IsInstantNTP(contents)); | 533 EXPECT_FALSE(IsInstantNTP(contents)); |
| 688 EXPECT_EQ(test.expected_result, | 534 EXPECT_EQ(test.expected_result, |
| 689 NavEntryIsInstantNTP(contents, | 535 NavEntryIsInstantNTP(contents, |
| 690 controller.GetLastCommittedEntry())) | 536 controller.GetLastCommittedEntry())) |
| 691 << test.url << " " << test.comment; | 537 << test.url << " " << test.comment; |
| 692 } | 538 } |
| 693 } | 539 } |
| 694 | 540 |
| 695 TEST_F(SearchTest, InstantCacheableNTPNavigationEntry) { | 541 TEST_F(SearchTest, InstantCacheableNTPNavigationEntry) { |
| 696 EnableInstantExtendedAPIForTesting(); | |
| 697 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 542 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 698 "Group1 use_cacheable_ntp:1")); | 543 "Group1 use_cacheable_ntp:1")); |
| 699 | 544 |
| 700 AddTab(browser(), GURL("chrome://blank")); | 545 AddTab(browser(), GURL("chrome://blank")); |
| 701 content::WebContents* contents = | 546 content::WebContents* contents = |
| 702 browser()->tab_strip_model()->GetWebContentsAt(0); | 547 browser()->tab_strip_model()->GetWebContentsAt(0); |
| 703 content::NavigationController& controller = contents->GetController(); | 548 content::NavigationController& controller = contents->GetController(); |
| 704 // Local NTP. | 549 // Local NTP. |
| 705 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 550 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 706 EXPECT_TRUE(NavEntryIsInstantNTP(contents, | 551 EXPECT_TRUE(NavEntryIsInstantNTP(contents, |
| 707 controller.GetLastCommittedEntry())); | 552 controller.GetLastCommittedEntry())); |
| 708 // Instant page is not cacheable NTP. | 553 // Instant page is not cacheable NTP. |
| 709 NavigateAndCommitActiveTab(GetInstantURL(profile(), kDisableStartMargin)); | 554 NavigateAndCommitActiveTab(GetInstantURL(profile(), kDisableStartMargin)); |
| 710 EXPECT_FALSE(NavEntryIsInstantNTP(contents, | 555 EXPECT_FALSE(NavEntryIsInstantNTP(contents, |
| 711 controller.GetLastCommittedEntry())); | 556 controller.GetLastCommittedEntry())); |
| 712 // Test Cacheable NTP | 557 // Test Cacheable NTP |
| 713 NavigateAndCommitActiveTab(chrome::GetNewTabPageURL(profile())); | 558 NavigateAndCommitActiveTab(chrome::GetNewTabPageURL(profile())); |
| 714 EXPECT_TRUE(NavEntryIsInstantNTP(contents, | 559 EXPECT_TRUE(NavEntryIsInstantNTP(contents, |
| 715 controller.GetLastCommittedEntry())); | 560 controller.GetLastCommittedEntry())); |
| 716 } | 561 } |
| 717 | 562 |
| 718 TEST_F(SearchTest, UseLocalNTPInIncognito) { | 563 TEST_F(SearchTest, UseLocalNTPInIncognito) { |
| 719 EnableInstantExtendedAPIForTesting(); | |
| 720 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 564 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 721 "Group1 use_cacheable_ntp:1")); | 565 "Group1 use_cacheable_ntp:1")); |
| 722 EXPECT_EQ(GURL(), chrome::GetNewTabPageURL( | 566 EXPECT_EQ(GURL(), chrome::GetNewTabPageURL( |
| 723 profile()->GetOffTheRecordProfile())); | 567 profile()->GetOffTheRecordProfile())); |
| 724 } | 568 } |
| 725 | 569 |
| 726 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsInsecure) { | 570 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsInsecure) { |
| 727 EnableInstantExtendedAPIForTesting(); | |
| 728 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 571 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 729 "Group1 use_cacheable_ntp:1")); | 572 "Group1 use_cacheable_ntp:1")); |
| 730 // Set an insecure new tab page URL and verify that it's ignored. | 573 // Set an insecure new tab page URL and verify that it's ignored. |
| 731 SetSearchProvider(true, true); | 574 SetSearchProvider(true, true); |
| 732 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 575 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |
| 733 chrome::GetNewTabPageURL(profile())); | 576 chrome::GetNewTabPageURL(profile())); |
| 734 } | 577 } |
| 735 | 578 |
| 736 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsNotSet) { | 579 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsNotSet) { |
| 737 EnableInstantExtendedAPIForTesting(); | |
| 738 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 580 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 739 "Group1 use_cacheable_ntp:1")); | 581 "Group1 use_cacheable_ntp:1")); |
| 740 // Set an insecure new tab page URL and verify that it's ignored. | 582 // Set an insecure new tab page URL and verify that it's ignored. |
| 741 SetSearchProvider(false, true); | 583 SetSearchProvider(false, true); |
| 742 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 584 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |
| 743 chrome::GetNewTabPageURL(profile())); | 585 chrome::GetNewTabPageURL(profile())); |
| 744 } | 586 } |
| 745 | 587 |
| 746 TEST_F(SearchTest, GetInstantURLExtendedEnabled) { | 588 TEST_F(SearchTest, GetInstantURL) { |
| 747 // Instant is disabled, so no Instant URL. | 589 // No Instant URL because "strk" is missing. |
| 748 EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin)); | |
| 749 | |
| 750 // Enable Instant. Still no Instant URL because "strk" is missing. | |
| 751 EnableInstantExtendedAPIForTesting(); | |
| 752 SetDefaultInstantTemplateUrl(false); | 590 SetDefaultInstantTemplateUrl(false); |
| 753 EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin)); | 591 EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin)); |
| 754 | 592 |
| 755 // Set an Instant URL with a valid search terms replacement key. | 593 // Set an Instant URL with a valid search terms replacement key. |
| 756 SetDefaultInstantTemplateUrl(true); | 594 SetDefaultInstantTemplateUrl(true); |
| 757 | 595 |
| 758 // Now there should be a valid Instant URL. Note the HTTPS "upgrade". | 596 // Now there should be a valid Instant URL. Note the HTTPS "upgrade". |
| 759 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), | 597 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), |
| 760 GetInstantURL(profile(), kDisableStartMargin)); | 598 GetInstantURL(profile(), kDisableStartMargin)); |
| 761 | 599 |
| 762 // Enable suggest. No difference. | 600 // Enable suggest. No difference. |
| 763 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); | 601 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); |
| 764 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), | 602 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), |
| 765 GetInstantURL(profile(), kDisableStartMargin)); | 603 GetInstantURL(profile(), kDisableStartMargin)); |
| 766 | 604 |
| 767 // Disable suggest. No Instant URL. | 605 // Disable suggest. No Instant URL. |
| 768 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, false); | 606 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, false); |
| 769 EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin)); | 607 EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin)); |
| 770 } | 608 } |
| 771 | 609 |
| 772 TEST_F(SearchTest, StartMarginCGI) { | 610 TEST_F(SearchTest, StartMarginCGI) { |
| 773 // Instant is disabled, so no Instant URL. | 611 // No margin. |
| 774 EXPECT_EQ(GURL(), GetInstantURL(profile(), kDisableStartMargin)); | |
| 775 | |
| 776 // Enable Instant. No margin. | |
| 777 EnableInstantExtendedAPIForTesting(); | |
| 778 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); | 612 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); |
| 779 | |
| 780 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), | 613 EXPECT_EQ(GURL("https://foo.com/instant?foo=foo#foo=foo&strk"), |
| 781 GetInstantURL(profile(), kDisableStartMargin)); | 614 GetInstantURL(profile(), kDisableStartMargin)); |
| 782 | 615 |
| 783 // With start margin. | 616 // With start margin. |
| 784 EXPECT_EQ(GURL("https://foo.com/instant?es_sm=10&foo=foo#foo=foo&strk"), | 617 EXPECT_EQ(GURL("https://foo.com/instant?es_sm=10&foo=foo#foo=foo&strk"), |
| 785 GetInstantURL(profile(), 10)); | 618 GetInstantURL(profile(), 10)); |
| 786 } | 619 } |
| 787 | 620 |
| 788 TEST_F(SearchTest, CommandLineOverrides) { | 621 TEST_F(SearchTest, CommandLineOverrides) { |
| 789 EnableInstantExtendedAPIForTesting(); | 622 EnableQueryExtractionForTesting(); |
| 790 | 623 |
| 791 GURL local_instant_url(GetLocalInstantURL(profile())); | 624 GURL local_instant_url(GetLocalInstantURL(profile())); |
| 792 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), local_instant_url); | 625 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), local_instant_url); |
| 793 | 626 |
| 794 TemplateURLService* template_url_service = | 627 TemplateURLService* template_url_service = |
| 795 TemplateURLServiceFactory::GetForProfile(profile()); | 628 TemplateURLServiceFactory::GetForProfile(profile()); |
| 796 TemplateURLData data; | 629 TemplateURLData data; |
| 797 data.SetURL("{google:baseURL}search?q={searchTerms}"); | 630 data.SetURL("{google:baseURL}search?q={searchTerms}"); |
| 798 data.instant_url = "{google:baseURL}webhp?strk"; | 631 data.instant_url = "{google:baseURL}webhp?strk"; |
| 799 data.search_terms_replacement_key = "strk"; | 632 data.search_terms_replacement_key = "strk"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 827 // If we specify extra search query params, they should be inserted into the | 660 // If we specify extra search query params, they should be inserted into the |
| 828 // query portion of the instant URL. | 661 // query portion of the instant URL. |
| 829 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 662 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 830 switches::kExtraSearchQueryParams, "a=b"); | 663 switches::kExtraSearchQueryParams, "a=b"); |
| 831 instant_url = GetInstantURL(profile(), kDisableStartMargin); | 664 instant_url = GetInstantURL(profile(), kDisableStartMargin); |
| 832 ASSERT_TRUE(instant_url.is_valid()); | 665 ASSERT_TRUE(instant_url.is_valid()); |
| 833 EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec()); | 666 EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec()); |
| 834 } | 667 } |
| 835 | 668 |
| 836 TEST_F(SearchTest, ShouldShowInstantNTP_Default) { | 669 TEST_F(SearchTest, ShouldShowInstantNTP_Default) { |
| 837 EnableInstantExtendedAPIForTesting(); | |
| 838 EXPECT_TRUE(ShouldShowInstantNTP()); | 670 EXPECT_TRUE(ShouldShowInstantNTP()); |
| 839 } | 671 } |
| 840 | 672 |
| 841 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledViaFinch) { | 673 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledViaFinch) { |
| 842 EnableInstantExtendedAPIForTesting(); | |
| 843 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 674 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 844 "Group1 show_ntp:0")); | 675 "Group1 show_ntp:0")); |
| 845 EXPECT_FALSE(ShouldShowInstantNTP()); | 676 EXPECT_FALSE(ShouldShowInstantNTP()); |
| 846 } | 677 } |
| 847 | 678 |
| 848 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledByUseCacheableNTPFinchFlag) { | 679 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledByUseCacheableNTPFinchFlag) { |
| 849 EnableInstantExtendedAPIForTesting(); | |
| 850 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 680 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 851 "Group1 use_cacheable_ntp:1")); | 681 "Group1 use_cacheable_ntp:1")); |
| 852 EXPECT_FALSE(ShouldShowInstantNTP()); | 682 EXPECT_FALSE(ShouldShowInstantNTP()); |
| 853 } | 683 } |
| 854 | 684 |
| 855 TEST_F(SearchTest, ShouldUseCacheableNTP_Default) { | 685 TEST_F(SearchTest, ShouldUseCacheableNTP_Default) { |
| 856 EnableInstantExtendedAPIForTesting(); | |
| 857 EXPECT_FALSE(ShouldUseCacheableNTP()); | 686 EXPECT_FALSE(ShouldUseCacheableNTP()); |
| 858 } | 687 } |
| 859 | 688 |
| 860 TEST_F(SearchTest, ShouldUseCacheableNTP_EnabledViaFinch) { | 689 TEST_F(SearchTest, ShouldUseCacheableNTP_EnabledViaFinch) { |
| 861 EnableInstantExtendedAPIForTesting(); | |
| 862 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 690 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 863 "Group1 use_cacheable_ntp:1")); | 691 "Group1 use_cacheable_ntp:1")); |
| 864 EXPECT_TRUE(ShouldUseCacheableNTP()); | 692 EXPECT_TRUE(ShouldUseCacheableNTP()); |
| 865 } | 693 } |
| 866 | 694 |
| 867 TEST_F(SearchTest, ShouldUseCacheableNTP_EnabledViaCommandLine) { | 695 TEST_F(SearchTest, ShouldUseCacheableNTP_EnabledViaCommandLine) { |
| 868 EnableInstantExtendedAPIForTesting(); | |
| 869 CommandLine::ForCurrentProcess()-> | 696 CommandLine::ForCurrentProcess()-> |
| 870 AppendSwitch(switches::kUseCacheableNewTabPage); | 697 AppendSwitch(switches::kUseCacheableNewTabPage); |
| 871 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", | 698 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", |
| 872 "Group1 use_cacheable_ntp:0")); | 699 "Group1 use_cacheable_ntp:0")); |
| 873 EXPECT_TRUE(ShouldUseCacheableNTP()); | 700 EXPECT_TRUE(ShouldUseCacheableNTP()); |
| 874 } | 701 } |
| 875 | 702 |
| 876 TEST_F(SearchTest, IsNTPURL) { | 703 TEST_F(SearchTest, IsNTPURL) { |
| 877 GURL invalid_url; | 704 GURL invalid_url; |
| 878 GURL ntp_url(chrome::kChromeUINewTabURL); | 705 GURL ntp_url(chrome::kChromeUINewTabURL); |
| 879 GURL local_ntp_url(GetLocalInstantURL(profile())); | 706 GURL local_ntp_url(GetLocalInstantURL(profile())); |
| 880 | 707 |
| 881 EXPECT_FALSE(chrome::IsNTPURL(invalid_url, profile())); | 708 EXPECT_FALSE(chrome::IsNTPURL(invalid_url, profile())); |
| 882 EXPECT_FALSE(chrome::IsNTPURL(local_ntp_url, profile())); | |
| 883 | 709 |
| 884 EXPECT_TRUE(chrome::IsNTPURL(ntp_url, NULL)); | 710 EnableQueryExtractionForTesting(); |
| 885 EXPECT_FALSE(chrome::IsNTPURL(local_ntp_url, NULL)); | |
| 886 | |
| 887 // Enable Instant. No margin. | |
| 888 EnableInstantExtendedAPIForTesting(); | |
| 889 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); | 711 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); |
| 890 GURL remote_ntp_url(GetInstantURL(profile(), kDisableStartMargin)); | 712 GURL remote_ntp_url(GetInstantURL(profile(), kDisableStartMargin)); |
| 891 GURL search_url_with_search_terms("https://foo.com/url?strk&bar=abc"); | 713 GURL search_url_with_search_terms("https://foo.com/url?strk&bar=abc"); |
| 892 GURL search_url_without_search_terms("https://foo.com/url?strk&bar"); | 714 GURL search_url_without_search_terms("https://foo.com/url?strk&bar"); |
| 893 | 715 |
| 894 EXPECT_FALSE(chrome::IsNTPURL(ntp_url, profile())); | 716 EXPECT_FALSE(chrome::IsNTPURL(ntp_url, profile())); |
| 895 EXPECT_TRUE(chrome::IsNTPURL(local_ntp_url, profile())); | 717 EXPECT_TRUE(chrome::IsNTPURL(local_ntp_url, profile())); |
| 896 EXPECT_TRUE(chrome::IsNTPURL(remote_ntp_url, profile())); | 718 EXPECT_TRUE(chrome::IsNTPURL(remote_ntp_url, profile())); |
| 897 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, profile())); | 719 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, profile())); |
| 898 EXPECT_TRUE(chrome::IsNTPURL(search_url_without_search_terms, profile())); | 720 EXPECT_TRUE(chrome::IsNTPURL(search_url_without_search_terms, profile())); |
| 899 | 721 |
| 900 EXPECT_FALSE(chrome::IsNTPURL(ntp_url, NULL)); | 722 EXPECT_FALSE(chrome::IsNTPURL(ntp_url, NULL)); |
| 901 EXPECT_FALSE(chrome::IsNTPURL(local_ntp_url, NULL)); | 723 EXPECT_FALSE(chrome::IsNTPURL(local_ntp_url, NULL)); |
| 902 EXPECT_FALSE(chrome::IsNTPURL(remote_ntp_url, NULL)); | 724 EXPECT_FALSE(chrome::IsNTPURL(remote_ntp_url, NULL)); |
| 903 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, NULL)); | 725 EXPECT_FALSE(chrome::IsNTPURL(search_url_with_search_terms, NULL)); |
| 904 EXPECT_FALSE(chrome::IsNTPURL(search_url_without_search_terms, NULL)); | 726 EXPECT_FALSE(chrome::IsNTPURL(search_url_without_search_terms, NULL)); |
| 905 } | 727 } |
| 906 | 728 |
| 907 TEST_F(SearchTest, GetSearchURLs) { | 729 TEST_F(SearchTest, GetSearchURLs) { |
| 908 std::vector<GURL> search_urls = GetSearchURLs(profile()); | 730 std::vector<GURL> search_urls = GetSearchURLs(profile()); |
| 909 EXPECT_EQ(2U, search_urls.size()); | 731 EXPECT_EQ(2U, search_urls.size()); |
| 910 EXPECT_EQ("http://foo.com/alt#quux=", search_urls[0].spec()); | 732 EXPECT_EQ("http://foo.com/alt#quux=", search_urls[0].spec()); |
| 911 EXPECT_EQ("http://foo.com/url?bar=", search_urls[1].spec()); | 733 EXPECT_EQ("http://foo.com/url?bar=", search_urls[1].spec()); |
| 912 } | 734 } |
| 913 | 735 |
| 914 } // namespace chrome | 736 } // namespace chrome |
| OLD | NEW |