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

Side by Side Diff: chrome/installer/util/channel_info_unittest.cc

Issue 811283002: [Installer] Cleaning up dead code for App Launcher / App Host installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup; add code to remove -apphost and -applauncher modifiers from ChannelInfo. Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/util/channel_info.h"
6
5 #include <utility> 7 #include <utility>
6 8
7 #include "base/basictypes.h" 9 #include "base/basictypes.h"
8 #include "chrome/installer/util/channel_info.h"
9 #include "chrome/installer/util/util_constants.h" 10 #include "chrome/installer/util/util_constants.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 using installer::ChannelInfo; 13 using installer::ChannelInfo;
13 14
14 namespace { 15 namespace {
15 16
16 const std::wstring kChannelStable(installer::kChromeChannelStable); 17 const base::string16 kChannelStable(installer::kChromeChannelStable);
17 const std::wstring kChannelBeta(installer::kChromeChannelBeta); 18 const base::string16 kChannelBeta(installer::kChromeChannelBeta);
18 const std::wstring kChannelDev(installer::kChromeChannelDev); 19 const base::string16 kChannelDev(installer::kChromeChannelDev);
19 20
20 } // namespace 21 } // namespace
21 22
22 TEST(ChannelInfoTest, Channels) { 23 TEST(ChannelInfoTest, Channels) {
23 ChannelInfo ci; 24 ChannelInfo ci;
24 std::wstring channel; 25 base::string16 channel;
25 26
26 ci.set_value(L""); 27 ci.set_value(L"");
27 EXPECT_TRUE(ci.GetChannelName(&channel)); 28 EXPECT_TRUE(ci.GetChannelName(&channel));
28 EXPECT_EQ(kChannelStable, channel); 29 EXPECT_EQ(kChannelStable, channel);
29 ci.set_value(L"-full"); 30 ci.set_value(L"-full");
30 EXPECT_TRUE(ci.GetChannelName(&channel)); 31 EXPECT_TRUE(ci.GetChannelName(&channel));
31 EXPECT_EQ(kChannelStable, channel); 32 EXPECT_EQ(kChannelStable, channel);
32 33
33 ci.set_value(L"2.0-beta"); 34 ci.set_value(L"2.0-beta");
34 EXPECT_TRUE(ci.GetChannelName(&channel)); 35 EXPECT_TRUE(ci.GetChannelName(&channel));
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ChannelInfo ci; 252 ChannelInfo ci;
252 253
253 ci.set_value(L""); 254 ci.set_value(L"");
254 EXPECT_FALSE(ci.RemoveAllModifiersAndSuffixes()); 255 EXPECT_FALSE(ci.RemoveAllModifiersAndSuffixes());
255 EXPECT_EQ(L"", ci.value()); 256 EXPECT_EQ(L"", ci.value());
256 257
257 ci.set_value(L"2.0-dev-multi-chrome-chromeframe-migrating"); 258 ci.set_value(L"2.0-dev-multi-chrome-chromeframe-migrating");
258 EXPECT_TRUE(ci.RemoveAllModifiersAndSuffixes()); 259 EXPECT_TRUE(ci.RemoveAllModifiersAndSuffixes());
259 EXPECT_EQ(L"2.0-dev", ci.value()); 260 EXPECT_EQ(L"2.0-dev", ci.value());
260 } 261 }
262
263 TEST(ChannelInfoTest, RemoveDepreciatedModifiers) {
264 struct {
265 base::string16 expected;
266 base::string16 input;
267 } test_cases[] = {
268 {L"", L""},
269 {L"-multi", L"-multi"},
270 {L"", L"-apphost"},
271 {L"-multi", L"-multi-apphost"},
272 {L"-multi", L"-apphost-multi"},
273 {L"-multi-stage:spammy", L"-multi-apphost-stage:spammy"},
274 {L"-multi-apphostlike-chrome", L"-multi-apphostlike-chrome"},
275 {L"-multi-APPLAUNCHER-chrome", L"-multi-APPLAUNCHER-chrome"},
276 {L"", L"-apphost-applauncher"},
277 {L"-multi", L"-apphost-multi-applauncher"},
278 {L"2.0-beta-multi-stage", L"2.0-beta-applauncher-multi-apphost-stage"},
279 };
280 for (int i = 0; i < arraysize(test_cases); ++i) {
281 ChannelInfo ci;
282 ci.set_value(test_cases[i].input);
283 EXPECT_EQ(test_cases[i].expected, ci.value())
284 << "test_cases[" << i << "] failed.";
285 }
286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698