forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ios] Add Location Permissions Field Trial Experiment
This change adds setup for a client-driven experiment that buckets users on First Run into 3 groups, two experiment and one control. Bug: 1138603 Change-Id: I7c100d173ea2d64e718950047d0c2f04ff4c3fbf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2506749 Commit-Queue: Chris Lu <thegreenfrog@chromium.org> Reviewed-by: Rohit Rao <rohitrao@chromium.org> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#824647}
- Loading branch information
Chris Lu
authored and
Commit Bot
committed
Nov 5, 2020
1 parent
282b3c8
commit 702076d
Showing
27 changed files
with
311 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
ios/chrome/browser/ui/first_run/ios_first_run_field_trials.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ios/chrome/browser/ui/first_run/ios_first_run_field_trials.h" | ||
|
||
// FirstRunFieldTrialGroup | ||
FirstRunFieldTrialGroup::FirstRunFieldTrialGroup( | ||
const std::string& name, | ||
variations::VariationID variation, | ||
base::FieldTrial::Probability percentage) | ||
: name_(name), variation_(variation), percentage_(percentage) {} | ||
|
||
FirstRunFieldTrialGroup::~FirstRunFieldTrialGroup() {} | ||
|
||
// FirstRunFieldTrialConfig | ||
FirstRunFieldTrialConfig::FirstRunFieldTrialConfig( | ||
const std::string& trial_name) | ||
: trial_name_(trial_name) {} | ||
|
||
FirstRunFieldTrialConfig::~FirstRunFieldTrialConfig() {} | ||
|
||
scoped_refptr<base::FieldTrial> | ||
FirstRunFieldTrialConfig::CreateOneTimeRandomizedTrial( | ||
const std::string& disabled_group_name, | ||
const base::FieldTrial::EntropyProvider& low_entropy_provider) { | ||
scoped_refptr<base::FieldTrial> trial = | ||
base::FieldTrialList::FactoryGetFieldTrialWithRandomizationSeed( | ||
trial_name_, GetTotalProbability(), disabled_group_name, | ||
base::FieldTrial::ONE_TIME_RANDOMIZED, 0, | ||
/*default_group_number=*/nullptr, &low_entropy_provider); | ||
for (const auto& group : groups_) { | ||
variations::AssociateGoogleVariationID( | ||
variations::GOOGLE_WEB_PROPERTIES_FIRST_PARTY, trial_name_, | ||
group.name(), group.variation()); | ||
trial->AppendGroup(group.name(), group.percentage()); | ||
} | ||
return trial; | ||
} | ||
|
||
int FirstRunFieldTrialConfig::GetTotalProbability() { | ||
int sum = 0; | ||
for (const auto& group : groups_) { | ||
sum += group.percentage(); | ||
} | ||
return sum; | ||
} | ||
|
||
void FirstRunFieldTrialConfig::AddGroup( | ||
const std::string& name, | ||
variations::VariationID variation, | ||
base::FieldTrial::Probability percentage) { | ||
groups_.emplace_back(name, variation, percentage); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.