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

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: Cleanups; handle ChannelInfo to remove '-apphost' and '-applauncher'. 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, AuditValue) {
264 #if defined(GOOGLE_CHROME_BUILD)
265 struct {
266 base::string16 expected;
267 base::string16 input;
268 } test_cases[] = {
269 {L"", L""},
270 {L"-multi", L"-multi"},
271 {L"", L"-apphost"},
272 {L"-multi", L"-multi-apphost"},
273 {L"-multi", L"-apphost-multi"},
274 {L"-multi-stage:spammy", L"-multi-apphost-stage:spammy"},
275 {L"-multi-apphostlike-chrome", L"-multi-apphostlike-chrome"},
276 {L"-multi-APPLAUNCHER-chrome", L"-multi-APPLAUNCHER-chrome"},
277 {L"", L"-apphost-applauncher"},
278 {L"-multi", L"-apphost-multi-applauncher"},
279 {L"2.0-beta-multi-stage", L"2.0-beta-applauncher-multi-apphost-stage"},
280 };
281 for (int i = 0; i < arraysize(test_cases); ++i) {
282 base::string16 value = test_cases[i].input;
283 ChannelInfo::AuditValue(&value);
284 EXPECT_EQ(test_cases[i].expected, value)
285 << "test_cases[" << i << "] failed direct call.";
286
287 ChannelInfo ci;
288 ci.set_value(test_cases[i].input);
289 EXPECT_EQ(test_cases[i].expected, ci.value())
290 << "test_cases[" << i << "] failed through CannelInfo.";
291 }
292 #endif
293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698