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

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

Issue 2476573004: Use InstallDetails in installer_util. (Closed)
Patch Set: sync to position 451835 Created 3 years, 10 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
« no previous file with comments | « chrome/installer/util/channel_info.cc ('k') | chrome/installer/util/google_update_settings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/channel_info_unittest.cc
diff --git a/chrome/installer/util/channel_info_unittest.cc b/chrome/installer/util/channel_info_unittest.cc
index e25163d5e780fd3f3b4ace30a9bff0cb7179c6ad..f041cf20dd8445644bcbb6bab99f3f04e87139a7 100644
--- a/chrome/installer/util/channel_info_unittest.cc
+++ b/chrome/installer/util/channel_info_unittest.cc
@@ -11,95 +11,6 @@
using installer::ChannelInfo;
-namespace {
-
-const base::string16 kChannelStable(installer::kChromeChannelStable);
-const base::string16 kChannelBeta(installer::kChromeChannelBeta);
-const base::string16 kChannelDev(installer::kChromeChannelDev);
-
-} // namespace
-
-TEST(ChannelInfoTest, Channels) {
- ChannelInfo ci;
- base::string16 channel;
-
- ci.set_value(L"");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelStable, channel);
- ci.set_value(L"-full");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelStable, channel);
-
- ci.set_value(L"1.1-beta");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelBeta, channel);
- ci.set_value(L"1.1-beta-foo");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelBeta, channel);
- ci.set_value(L"1.1-bar");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelBeta, channel);
- ci.set_value(L"1n1-foobar");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelBeta, channel);
- ci.set_value(L"foo-1.1-beta");
- EXPECT_FALSE(ci.GetChannelName(&channel));
- ci.set_value(L"2.0-beta");
- EXPECT_FALSE(ci.GetChannelName(&channel));
-
- ci.set_value(L"2.0-dev");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"2.0-DEV");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"2.0-dev-eloper");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"2.0-doom");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"250-doom");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"bar-2.0-dev");
- EXPECT_FALSE(ci.GetChannelName(&channel));
- ci.set_value(L"1.0-dev");
- EXPECT_FALSE(ci.GetChannelName(&channel));
-
- ci.set_value(L"x64-dev");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"foo-x64-dev");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelDev, channel);
- ci.set_value(L"x64-Dev");
- EXPECT_FALSE(ci.GetChannelName(&channel));
-
- ci.set_value(L"x64-beta");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelBeta, channel);
- ci.set_value(L"bar-x64-beta");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelBeta, channel);
- ci.set_value(L"x64-Beta");
- EXPECT_FALSE(ci.GetChannelName(&channel));
-
- ci.set_value(L"x64-stable");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelStable, channel);
- ci.set_value(L"baz-x64-stable");
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(kChannelStable, channel);
- ci.set_value(L"x64-Stable");
- EXPECT_FALSE(ci.GetChannelName(&channel));
-
- ci.set_value(L"fuzzy");
- EXPECT_FALSE(ci.GetChannelName(&channel));
- ci.set_value(L"foo");
- EXPECT_FALSE(ci.GetChannelName(&channel));
-}
-
TEST(ChannelInfoTest, FullInstall) {
ChannelInfo ci;
@@ -235,23 +146,12 @@ TEST(ChannelInfoTest, ClearStage) {
}
TEST(ChannelInfoTest, GetStatsDefault) {
- struct {
- const base::string16 base_value;
- const base::string16& expected_channel;
- } test_cases[] = {
- {L"", kChannelStable},
- {L"x64-stable", kChannelStable},
- {L"1.1-beta", kChannelBeta},
- {L"x64-beta", kChannelBeta},
- {L"2.0-dev", kChannelDev},
- {L"x64-dev", kChannelDev},
+ const base::string16 base_values[] = {
+ L"", L"x64-stable", L"1.1-beta", L"x64-beta", L"2.0-dev", L"x64-dev",
};
const base::string16 suffixes[] = {L"", L"-multi", L"-multi-chrome"};
- for (const auto& test_case : test_cases) {
- const base::string16& base_value = test_case.base_value;
- const base::string16& expected_channel = test_case.expected_channel;
-
+ for (const auto& base_value : base_values) {
for (const auto& suffix : suffixes) {
ChannelInfo ci;
base::string16 channel;
@@ -264,12 +164,8 @@ TEST(ChannelInfoTest, GetStatsDefault) {
EXPECT_EQ(L"", ci.GetStatsDefault());
ci.set_value(base_value + L"-statsdef_0" + suffix);
EXPECT_EQ(L"0", ci.GetStatsDefault());
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(expected_channel, channel);
ci.set_value(base_value + L"-statsdef_1" + suffix);
EXPECT_EQ(L"1", ci.GetStatsDefault());
- EXPECT_TRUE(ci.GetChannelName(&channel));
- EXPECT_EQ(expected_channel, channel);
}
}
}
« no previous file with comments | « chrome/installer/util/channel_info.cc ('k') | chrome/installer/util/google_update_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698