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

Unified Diff: chrome/installer/util/google_update_settings_unittest.cc

Issue 316103002: Read multi-install chrome's channel from the binaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/google_update_settings_unittest.cc
diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc
index 71c026267683e58163202f5e0f6b7cd0021db4a8..f8808922709aff52ad4ce34b9c78b2c41a8fee0e 100644
--- a/chrome/installer/util/google_update_settings_unittest.cc
+++ b/chrome/installer/util/google_update_settings_unittest.cc
@@ -54,6 +54,37 @@ class GoogleUpdateSettingsTest : public testing::Test {
ASSERT_EQ(ERROR_SUCCESS, update_key.WriteValue(L"ap", value));
}
+ // Sets the "ap" field for a multi-install product (both the product and
+ // the binaries).
+ void SetMultiApField(SystemUserInstall is_system, const wchar_t* value) {
+ // Caller must specify a multi-install ap value.
+ ASSERT_NE(std::wstring::npos, std::wstring(value).find(L"-multi"));
+ HKEY root = is_system == SYSTEM_INSTALL ?
+ HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ RegKey update_key;
+
+ // Write the ap value for both the product and the binaries.
+ BrowserDistribution* const kDists[] = {
+ BrowserDistribution::GetDistribution(),
+ BrowserDistribution::GetSpecificDistribution(
+ BrowserDistribution::CHROME_BINARIES)
+ };
+ for (size_t i = 0; i < arraysize(kDists); ++i) {
+ std::wstring path = kDists[i]->GetStateKey();
+ ASSERT_EQ(ERROR_SUCCESS, update_key.Create(root, path.c_str(),
+ KEY_WRITE));
+ ASSERT_EQ(ERROR_SUCCESS, update_key.WriteValue(L"ap", value));
+ }
+
+ // Make the product technically multi-install.
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ ASSERT_EQ(ERROR_SUCCESS,
+ update_key.Create(root, dist->GetStateKey().c_str(), KEY_WRITE));
+ ASSERT_EQ(ERROR_SUCCESS,
+ update_key.WriteValue(installer::kUninstallArgumentsField,
+ L"--multi-install"));
+ }
+
// Tests setting the ap= value to various combinations of values with
// prefixes and suffixes, while asserting on the correct channel value.
// Note that any non-empty ap= value that doesn't match ".*-{dev|beta}.*"
@@ -310,6 +341,22 @@ TEST_F(GoogleUpdateSettingsTest, CurrentChromeChannelEmptyUser) {
EXPECT_STREQ(L"", channel.c_str());
}
+// Test that the channel is pulled from the binaries for multi-install products.
+TEST_F(GoogleUpdateSettingsTest, MultiInstallChannelFromBinaries) {
+ SetMultiApField(USER_INSTALL, L"2.0-dev-multi");
+ base::string16 channel;
+
+ EXPECT_TRUE(GoogleUpdateSettings::GetChromeChannelAndModifiers(false,
+ &channel));
+ EXPECT_STREQ(L"dev-m", channel.c_str());
+
+ // See if the same happens if the product's ap is cleared.
+ SetApField(USER_INSTALL, L"");
+ EXPECT_TRUE(GoogleUpdateSettings::GetChromeChannelAndModifiers(false,
+ &channel));
+ EXPECT_STREQ(L"dev-m", channel.c_str());
robertshield 2014/06/04 21:10:14 optional: test also that a non-empty value for the
grt (UTC plus 2) 2014/06/04 21:15:36 Done.
+}
+
TEST_F(GoogleUpdateSettingsTest, CurrentChromeChannelVariousApValuesSystem) {
TestCurrentChromeChannelWithVariousApValues(SYSTEM_INSTALL);
}

Powered by Google App Engine
This is Rietveld 408576698