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

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: Remove unused. Created 7 years, 1 month 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 params["rule4:4:0"] = "rule4-4-0-value"; // OTHER 239 params["rule4:4:0"] = "rule4-4-0-value"; // OTHER
240 // Add a malformed rule to make sure it doesn't screw things up. 240 // Add a malformed rule to make sure it doesn't screw things up.
241 params["unrecognized"] = "unrecognized-value"; 241 params["unrecognized"] = "unrecognized-value";
242 ASSERT_TRUE(chrome_variations::AssociateVariationParams( 242 ASSERT_TRUE(chrome_variations::AssociateVariationParams(
243 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params)); 243 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
244 } 244 }
245 245
246 base::FieldTrialList::CreateFieldTrial( 246 base::FieldTrialList::CreateFieldTrial(
247 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A"); 247 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
248 248
249 // Tests with Instant Extended disabled. 249 // Instant Extended only works on non-mobile platforms.
250 #if defined(OS_IOS) || defined(OS_ANDROID)
250 // Tests for rule 1. 251 // Tests for rule 1.
251 ExpectRuleValue("rule1-1-0-value", 252 ExpectRuleValue("rule1-1-0-value",
252 "rule1", AutocompleteInput::NTP); // exact match 253 "rule1", AutocompleteInput::NTP); // exact match
253 ExpectRuleValue("rule1-1-0-value", 254 ExpectRuleValue("rule1-1-0-value",
254 "rule1", AutocompleteInput::NTP); // exact match 255 "rule1", AutocompleteInput::NTP); // exact match
255 ExpectRuleValue("rule1-*-*-value", 256 ExpectRuleValue("rule1-*-*-value",
256 "rule1", AutocompleteInput::BLANK); // fallback to global 257 "rule1", AutocompleteInput::BLANK); // fallback to global
257 ExpectRuleValue("rule1-3-0-value", 258 ExpectRuleValue("rule1-3-0-value",
258 "rule1", AutocompleteInput::HOME_PAGE); // exact match 259 "rule1", AutocompleteInput::HOME_PAGE); // exact match
259 ExpectRuleValue("rule1-4-*-value", 260 ExpectRuleValue("rule1-4-*-value",
(...skipping 18 matching lines...) Expand all
278 ExpectRuleValue("", 279 ExpectRuleValue("",
279 "rule4", AutocompleteInput::BLANK); // no global fallback 280 "rule4", AutocompleteInput::BLANK); // no global fallback
280 ExpectRuleValue("", 281 ExpectRuleValue("",
281 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback 282 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback
282 ExpectRuleValue("rule4-4-0-value", 283 ExpectRuleValue("rule4-4-0-value",
283 "rule4", AutocompleteInput::OTHER); // exact match 284 "rule4", AutocompleteInput::OTHER); // exact match
284 285
285 // Tests for rule 5 (a missing rule). 286 // Tests for rule 5 (a missing rule).
286 ExpectRuleValue("", 287 ExpectRuleValue("",
287 "rule5", AutocompleteInput::OTHER); // no rule at all 288 "rule5", AutocompleteInput::OTHER); // no rule at all
288 289 #else
289 // Now change the Instant Extended state and run analogous tests.
290 // Instant Extended only works on non-mobile platforms.
291 #if !defined(OS_IOS) && !defined(OS_ANDROID)
292 chrome::ResetInstantExtendedOptInStateGateForTest();
293 CommandLine::ForCurrentProcess()->AppendSwitch(
294 switches::kEnableInstantExtendedAPI);
295
296 // Tests with Instant Extended enabled. 290 // Tests with Instant Extended enabled.
297 // Tests for rule 1. 291 // Tests for rule 1.
298 ExpectRuleValue("rule1-4-1-value", 292 ExpectRuleValue("rule1-4-1-value",
299 "rule1", AutocompleteInput::OTHER); // exact match 293 "rule1", AutocompleteInput::OTHER); // exact match
300 ExpectRuleValue("rule1-*-1-value", 294 ExpectRuleValue("rule1-*-1-value",
301 "rule1", AutocompleteInput::BLANK); // partial fallback 295 "rule1", AutocompleteInput::BLANK); // partial fallback
302 ExpectRuleValue("rule1-*-1-value", 296 ExpectRuleValue("rule1-*-1-value",
303 "rule1", 297 "rule1",
304 AutocompleteInput::NTP); // partial fallback 298 AutocompleteInput::NTP); // partial fallback
305 299
(...skipping 12 matching lines...) Expand all
318 312
319 // Tests for rule 4. 313 // Tests for rule 4.
320 ExpectRuleValue("", 314 ExpectRuleValue("",
321 "rule4", AutocompleteInput::BLANK); // no global fallback 315 "rule4", AutocompleteInput::BLANK); // no global fallback
322 ExpectRuleValue("", 316 ExpectRuleValue("",
323 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback 317 "rule4", AutocompleteInput::HOME_PAGE); // no global fallback
324 318
325 // Tests for rule 5 (a missing rule). 319 // Tests for rule 5 (a missing rule).
326 ExpectRuleValue("", 320 ExpectRuleValue("",
327 "rule5", AutocompleteInput::OTHER); // no rule at all 321 "rule5", AutocompleteInput::OTHER); // no rule at all
328 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) 322 #endif // defined(OS_IOS) || defined(OS_ANDROID)
329 } 323 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_page_apitest.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698