Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Side by Side Diff: chrome/browser/omnibox/omnibox_field_trial_unittest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up test. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/omnibox/omnibox_field_trial.h" 5 #include "chrome/browser/omnibox/omnibox_field_trial.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 params["rule4:4:0"] = "rule4-4-0-value"; // OTHER 211 params["rule4:4:0"] = "rule4-4-0-value"; // OTHER
212 // Add a malformed rule to make sure it doesn't screw things up. 212 // Add a malformed rule to make sure it doesn't screw things up.
213 params["unrecognized"] = "unrecognized-value"; 213 params["unrecognized"] = "unrecognized-value";
214 ASSERT_TRUE(chrome_variations::AssociateVariationParams( 214 ASSERT_TRUE(chrome_variations::AssociateVariationParams(
215 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params)); 215 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
216 } 216 }
217 217
218 base::FieldTrialList::CreateFieldTrial( 218 base::FieldTrialList::CreateFieldTrial(
219 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A"); 219 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
220 220
221 // Tests with Instant Extended disabled. 221 // Instant Extended only works on non-mobile platforms.
222 #if defined(OS_IOS) || defined(OS_ANDROID)
222 // Tests for rule 1. 223 // Tests for rule 1.
223 ExpectRuleValue("rule1-1-0-value", 224 ExpectRuleValue("rule1-1-0-value",
224 "rule1", AutocompleteInput::NEW_TAB_PAGE); // exact match 225 "rule1", AutocompleteInput::NEW_TAB_PAGE); // exact match
225 ExpectRuleValue("rule1-1-0-value", 226 ExpectRuleValue("rule1-1-0-value",
226 "rule1", AutocompleteInput::NEW_TAB_PAGE); // exact match 227 "rule1", AutocompleteInput::NEW_TAB_PAGE); // exact match
227 ExpectRuleValue("rule1-*-*-value", 228 ExpectRuleValue("rule1-*-*-value",
228 "rule1", AutocompleteInput::BLANK); // fallback to global 229 "rule1", AutocompleteInput::BLANK); // fallback to global
229 ExpectRuleValue("rule1-3-0-value", 230 ExpectRuleValue("rule1-3-0-value",
230 "rule1", AutocompleteInput::HOME_PAGE); // exact match 231 "rule1", AutocompleteInput::HOME_PAGE); // exact match
231 ExpectRuleValue("rule1-4-*-value", 232 ExpectRuleValue("rule1-4-*-value",
(...skipping 18 matching lines...) Expand all
250 ExpectRuleValue("", 251 ExpectRuleValue("",
251 "rule4", AutocompleteInput::BLANK); // no global fallback 252 "rule4", AutocompleteInput::BLANK); // no global fallback
252 ExpectRuleValue("", 253 ExpectRuleValue("",
253 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback 254 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback
254 ExpectRuleValue("rule4-4-0-value", 255 ExpectRuleValue("rule4-4-0-value",
255 "rule4", AutocompleteInput::OTHER); // exact match 256 "rule4", AutocompleteInput::OTHER); // exact match
256 257
257 // Tests for rule 5 (a missing rule). 258 // Tests for rule 5 (a missing rule).
258 ExpectRuleValue("", 259 ExpectRuleValue("",
259 "rule5", AutocompleteInput::OTHER); // no rule at all 260 "rule5", AutocompleteInput::OTHER); // no rule at all
260 261 #else
261 // Now change the Instant Extended state and run analogous tests.
262 // Instant Extended only works on non-mobile platforms.
263 #if !defined(OS_IOS) && !defined(OS_ANDROID)
264 chrome::ResetInstantExtendedOptInStateGateForTest();
265 CommandLine::ForCurrentProcess()->AppendSwitch(
266 switches::kEnableInstantExtendedAPI);
267
268 // Tests with Instant Extended enabled. 262 // Tests with Instant Extended enabled.
269 // Tests for rule 1. 263 // Tests for rule 1.
270 ExpectRuleValue("rule1-4-1-value", 264 ExpectRuleValue("rule1-4-1-value",
271 "rule1", AutocompleteInput::OTHER); // exact match 265 "rule1", AutocompleteInput::OTHER); // exact match
272 ExpectRuleValue("rule1-*-1-value", 266 ExpectRuleValue("rule1-*-1-value",
273 "rule1", AutocompleteInput::BLANK); // partial fallback 267 "rule1", AutocompleteInput::BLANK); // partial fallback
274 ExpectRuleValue("rule1-*-1-value", 268 ExpectRuleValue("rule1-*-1-value",
275 "rule1", 269 "rule1",
276 AutocompleteInput::NEW_TAB_PAGE); // partial fallback 270 AutocompleteInput::NEW_TAB_PAGE); // partial fallback
277 271
(...skipping 12 matching lines...) Expand all
290 284
291 // Tests for rule 4. 285 // Tests for rule 4.
292 ExpectRuleValue("", 286 ExpectRuleValue("",
293 "rule4", AutocompleteInput::BLANK); // no global fallback 287 "rule4", AutocompleteInput::BLANK); // no global fallback
294 ExpectRuleValue("", 288 ExpectRuleValue("",
295 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback 289 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback
296 290
297 // Tests for rule 5 (a missing rule). 291 // Tests for rule 5 (a missing rule).
298 ExpectRuleValue("", 292 ExpectRuleValue("",
299 "rule5", AutocompleteInput::OTHER); // no rule at all 293 "rule5", AutocompleteInput::OTHER); // no rule at all
300 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) 294 #endif // defined(OS_IOS) || defined(OS_ANDROID)
301 } 295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698