From 7ebc2c47bb7683224f8978f21f83fba4e1851ab0 Mon Sep 17 00:00:00 2001 From: wfh Date: Mon, 25 Aug 2014 16:48:08 -0700 Subject: [PATCH] Make 64-bit Chrome stable report as CHANNEL_STABLE BUG=407204 TEST=installer_util_unittests TEST=install x64 stable. Check chrome://chrome shows 'm' and not 'unknown-m'. Review URL: https://codereview.chromium.org/467303004 Cr-Commit-Position: refs/heads/master@{#291791} --- chrome/installer/util/channel_info.cc | 9 +++++++-- chrome/installer/util/channel_info_unittest.cc | 10 ++++++++++ chrome/installer/util/util_constants.cc | 1 + chrome/installer/util/util_constants.h | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/chrome/installer/util/channel_info.cc b/chrome/installer/util/channel_info.cc index 48a4e32127263..cdf264bad0e11 100644 --- a/chrome/installer/util/channel_info.cc +++ b/chrome/installer/util/channel_info.cc @@ -27,7 +27,8 @@ const wchar_t kSfxMultiFail[] = L"-multifail"; const wchar_t* const kChannels[] = { installer::kChromeChannelBeta, - installer::kChromeChannelDev + installer::kChromeChannelDev, + installer::kChromeChannelStableExplicit }; const wchar_t* const kModifiers[] = { @@ -168,7 +169,11 @@ bool ChannelInfo::GetChannelName(std::wstring* channel_name) const { *const* end = &kChannels[arraysize(kChannels)]; scan != end; ++scan) { if (value_.find(*scan) != std::wstring::npos) { - channel_name->assign(*scan); + // Report channels with "stable" in them as stable (empty string). + if (*scan == installer::kChromeChannelStableExplicit) + channel_name->erase(); + else + channel_name->assign(*scan); return true; } } diff --git a/chrome/installer/util/channel_info_unittest.cc b/chrome/installer/util/channel_info_unittest.cc index d08f2c31049de..71d908b6e2123 100644 --- a/chrome/installer/util/channel_info_unittest.cc +++ b/chrome/installer/util/channel_info_unittest.cc @@ -50,6 +50,16 @@ TEST(ChannelInfoTest, Channels) { EXPECT_TRUE(ci.GetChannelName(&channel)); EXPECT_EQ(kChannelDev, channel); + ci.set_value(L"x64-dev"); + EXPECT_TRUE(ci.GetChannelName(&channel)); + EXPECT_EQ(kChannelDev, channel); + ci.set_value(L"x64-beta"); + EXPECT_TRUE(ci.GetChannelName(&channel)); + EXPECT_EQ(kChannelBeta, channel); + ci.set_value(L"x64-stable"); + EXPECT_TRUE(ci.GetChannelName(&channel)); + EXPECT_EQ(kChannelStable, channel); + ci.set_value(L"fuzzy"); EXPECT_FALSE(ci.GetChannelName(&channel)); } diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 67df18e4c4a02..82404b5a87ca7 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -263,6 +263,7 @@ const wchar_t kChromeChannelCanary[] = L"canary"; const wchar_t kChromeChannelDev[] = L"dev"; const wchar_t kChromeChannelBeta[] = L"beta"; const wchar_t kChromeChannelStable[] = L""; +const wchar_t kChromeChannelStableExplicit[] = L"stable"; const size_t kMaxAppModelIdLength = 64U; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index da54a38c4393e..2bc9f3e7290af 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -256,6 +256,7 @@ extern const wchar_t kChromeChannelCanary[]; extern const wchar_t kChromeChannelDev[]; extern const wchar_t kChromeChannelBeta[]; extern const wchar_t kChromeChannelStable[]; +extern const wchar_t kChromeChannelStableExplicit[]; extern const size_t kMaxAppModelIdLength;