diff options
author | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-30 00:30:02 +0000 |
---|---|---|
committer | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-30 00:30:02 +0000 |
commit | 92e669c489800bf3bf8423abceb9ac9799269f8e (patch) | |
tree | 208c2383cb17a280a58bf8f6ffde799635a55a55 /chrome/installer/gcapi | |
parent | 59a733d9060c359966c39e50b78d219a0a84fddb (diff) | |
download | chromium_src-92e669c489800bf3bf8423abceb9ac9799269f8e.zip chromium_src-92e669c489800bf3bf8423abceb9ac9799269f8e.tar.gz chromium_src-92e669c489800bf3bf8423abceb9ac9799269f8e.tar.bz2 |
Add a VariationsRegistrySyncer class, which synchronizes Google Update related Variation IDs in Chrome with the Windows registry.
5 seconds after startup, this class checks for a list of active field trials, and writes their Google Update VariationID into the registry in a format understood by Google Update.
Note that additional work needs to be done to ensure that Field Trials activated after the first five seconds are synchronized to the registry. This will be done in a small followup patch later.
Unit tests are included.
BUG=160251
TEST=Start an official build of Chrome which is managed by Omaha. After five seconds, check the registry client state key where this install of chrome would write to. Under ClientState\{APP_GUID} there should be a string value called experiment_labels. Ensure that within it, in addition to other possible labels, there are 5 labels with keys CrVar[1-5] and values between 3300000 and 3300136, plus timestamps about a year from now. Ensure that this works for both User-level and System-level installs.
Review URL: https://chromiumcodereview.appspot.com/12051002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/gcapi')
-rw-r--r-- | chrome/installer/gcapi/gcapi_omaha_experiment.cc | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment.cc b/chrome/installer/gcapi/gcapi_omaha_experiment.cc index ee4b662..0c984c6 100644 --- a/chrome/installer/gcapi/gcapi_omaha_experiment.cc +++ b/chrome/installer/gcapi/gcapi_omaha_experiment.cc @@ -7,54 +7,14 @@ #include "base/string16.h" #include "base/stringprintf.h" #include "base/time.h" -#include "base/win/registry.h" #include "chrome/installer/gcapi/gcapi.h" #include "chrome/installer/util/google_update_settings.h" using base::Time; using base::TimeDelta; -using base::win::RegKey; namespace { -const wchar_t* kDays[] = - { L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" }; - -const wchar_t* kMonths[] = {L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun", - L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec"}; - -// Constructs a date string of the following format for the current time plus -// one year: -// "DAY, DD0 MON YYYY HH0:MI0:SE0 TZ" -// DAY = 3 character day of week, -// DD0 = 2 digit day of month, -// MON = 3 character month of year, -// YYYY = 4 digit year, -// HH0 = 2 digit hour, -// MI0 = 2 digit minute, -// SE0 = 2 digit second, -// TZ = 3 character timezone) -string16 BuildOmahaExperimentDateString() { - Time then_time = Time::Now() + TimeDelta::FromDays(365); - Time::Exploded then = {}; - then_time.UTCExplode(&then); - - if (!then.HasValidValues()) - return L""; - - string16 date_string; - base::SStringPrintf(&date_string, - L"%ls, %02d %ls %d %02d:%02d:%02d GMT", - kDays[then.day_of_week], - then.day_of_month, - kMonths[then.month - 1], - then.year, - then.hour, - then.minute, - then.second); - return date_string; -} - // Returns the number of weeks since 2/3/2003. int GetCurrentRlzWeek() { Time::Exploded february_third_2003_exploded = {2003, 2, 1, 3, 0, 0, 0, 0}; @@ -80,7 +40,8 @@ bool SetReactivationExperimentLabels(const wchar_t* brand_code, L"reacbrand=%ls_%d|%ls", brand_code, week_number, - BuildOmahaExperimentDateString().c_str()); + GoogleUpdateSettings::BuildExperimentDateString() + .c_str()); return GoogleUpdateSettings::SetExperimentLabels( shell_mode == GCAPI_INVOKED_UAC_ELEVATION, |