diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 21:50:46 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 21:50:46 +0000 |
commit | 525371a14a8e8d647738d9450d221eb11e508182 (patch) | |
tree | 01908b85c4901322a7b09c9e772c0ce60c60dc1c | |
parent | f4abbdf7a9dedc781ca78ec933125b48949fb6ff (diff) | |
download | chromium_src-525371a14a8e8d647738d9450d221eb11e508182.zip chromium_src-525371a14a8e8d647738d9450d221eb11e508182.tar.gz chromium_src-525371a14a8e8d647738d9450d221eb11e508182.tar.bz2 |
Second part of the multi-toast experiment
There are 4 flavors of the toast, if the user qualfies
use coin toss to show one of them.
- Accordingly we have now four experiment sets:
TAxx, TBxx, TCxx, TDxx.
BUG=b/1484308
TEST= see bug for instructions
Review URL: http://codereview.chromium.org/200092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26025 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 9 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.cc | 2 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 48 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.h | 5 |
5 files changed, 40 insertions, 26 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 266992f..e9894e1 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -71,7 +71,7 @@ DWORD UnPackArchive(const std::wstring& archive, bool system_install, if (!installed_version) { LOG(ERROR) << "Can not use differential update when Chrome is not " << "installed on the system."; - return installer_util::InstallStatus::CHROME_NOT_INSTALLED; + return installer_util::CHROME_NOT_INSTALLED; } std::wstring existing_archive = installer::GetChromeInstallPath(system_install); @@ -445,8 +445,11 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, exit_code = tmp; return true; } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { - // Launch the inactive user toast experiment. - dist->InactiveUserToastExperiment(); + // Launch the inactive user toast experiment. If there is no value + // associated with the switch the function uses 0 as the flavor. + std::wstring flavor = + cmd_line.GetSwitchValue(installer_util::switches::kInactiveUserToast); + dist->InactiveUserToastExperiment(StringToInt(flavor)); return true; } return false; diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 19b5937..d4b2849 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -98,5 +98,5 @@ void BrowserDistribution::LaunchUserExperiment( } -void BrowserDistribution::InactiveUserToastExperiment() { +void BrowserDistribution::InactiveUserToastExperiment(int flavor) { }
\ No newline at end of file diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index 452b8a2..16d04ac 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -62,7 +62,7 @@ class BrowserDistribution { // The user has qualified for the inactive user toast experiment and this // function just performs it. - virtual void InactiveUserToastExperiment(); + virtual void InactiveUserToastExperiment(int flavor); protected: BrowserDistribution() {} diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 1e56456..a4d382d 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -35,12 +35,20 @@ namespace { // The following strings are the possible outcomes of the toast experiment // as recorded in the |client| field. Previously the groups used "TSxx" but // the data captured is not valid. -const wchar_t kToastExpQualifyGroup[] = L"TT01"; -const wchar_t kToastExpCancelGroup[] = L"TT02"; -const wchar_t kToastExpUninstallGroup[] = L"TT04"; -const wchar_t kToastExpTriesOkGroup[] = L"TT18"; -const wchar_t kToastExpTriesErrorGroup[] = L"TT28"; -const wchar_t kToastExpBaseGroup[] = L"TT80"; +const wchar_t kToastExpQualifyGroup[] = L"T%c01"; +const wchar_t kToastExpCancelGroup[] = L"T%c02"; +const wchar_t kToastExpUninstallGroup[] = L"T%c04"; +const wchar_t kToastExpTriesOkGroup[] = L"T%c18"; +const wchar_t kToastExpTriesErrorGroup[] = L"T%c28"; +const wchar_t kToastExpBaseGroup[] = L"T%c80"; + +// Generates the actual group that gets written in the registry. +// |group| is a printf style string with a single %c replacement and |value| +// is a number between 0 and 19. +std::wstring GetExperimentGroup(const wchar_t* group, int flavor) { + wchar_t c = flavor < 20 ? L'A' + flavor : L'X'; + return StringPrintf(group, c); +} // Substitute the locale parameter in uninstall URL with whatever // Google Update tells us is the locale. In case we fail to find @@ -94,11 +102,11 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) { return (now_time - dir_time); } -// Launches again this same process with a single switch --|flag|. Does not -// wait for the process to terminate. -bool RelaunchSetup(const std::wstring& flag) { +// Launches again this same process with a single switch --|flag|=|value|. +// Does not wait for the process to terminate. +bool RelaunchSetup(const std::wstring& flag, int value) { CommandLine cmd_line(CommandLine::ForCurrentProcess()->program()); - cmd_line.AppendSwitch(flag); + cmd_line.AppendSwitchWithValue(flag, IntToWString(value)); return base::LaunchApp(cmd_line, false, false, NULL); } @@ -418,6 +426,8 @@ void GoogleChromeDistribution::LaunchUserExperiment( return; std::wstring brand; + int flavor = base::RandInt(0, 3); + if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) { // The user automatically qualifies for the experiment. LOG(INFO) << "Experiment qualification bypass"; @@ -426,10 +436,8 @@ void GoogleChromeDistribution::LaunchUserExperiment( std::wstring client_info; if (GoogleUpdateSettings::GetClient(&client_info)) { // The user might be participating on another experiment. The only - // users eligible for this experiment are that have no client info - // or the client info is "TT80". - if (client_info != kToastExpBaseGroup) - return; + // users eligible for this experiment are that have no client info. + return; } // User must be in the Great Britain as defined by googe_update language. std::wstring lang; @@ -447,20 +455,22 @@ void GoogleChromeDistribution::LaunchUserExperiment( // tag a control group, which is at random 50% of the population. if (base::RandDouble() > 0.5) { // We tag the user, but it wont participate in the experiment. - GoogleUpdateSettings::SetClient(kToastExpQualifyGroup); + GoogleUpdateSettings::SetClient( + GetExperimentGroup(kToastExpQualifyGroup, flavor)); LOG(INFO) << "User is toast experiment control group"; return; } } LOG(INFO) << "User drafted for toast experiment"; - if (!GoogleUpdateSettings::SetClient(kToastExpBaseGroup)) + if (!GoogleUpdateSettings::SetClient( + GetExperimentGroup(kToastExpBaseGroup, flavor))) return; // The experiment needs to be performed in a different process because // google_update expects the upgrade process to be quick and nimble. - RelaunchSetup(installer_util::switches::kInactiveUserToast); + RelaunchSetup(installer_util::switches::kInactiveUserToast, flavor); } -void GoogleChromeDistribution::InactiveUserToastExperiment() { +void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor) { // User qualifies for the experiment. Launch chrome with --try-chrome. Before // that we need to change the client so we can track the progress. int32 exit_code = 0; @@ -482,7 +492,7 @@ void GoogleChromeDistribution::InactiveUserToastExperiment() { default: outcome = kToastExpTriesErrorGroup; }; - GoogleUpdateSettings::SetClient(outcome); + GoogleUpdateSettings::SetClient(GetExperimentGroup(outcome, flavor)); if (outcome != kToastExpUninstallGroup) return; // The user wants to uninstall. This is a best effort operation. Note that diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index aa2c99f..c572f38 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -84,8 +84,9 @@ class GoogleChromeDistribution : public BrowserDistribution { // Assuming that the user qualifies, this function performs the inactive user // toast experiment. It will use chrome to show the UI and it will record the - // outcome in the registry. - virtual void InactiveUserToastExperiment(); + // outcome in the registry. |flavor| is an extra parameter that controls the + // specific wording on the experiment. + virtual void InactiveUserToastExperiment(int flavor); private: friend class BrowserDistribution; |