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

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

Issue 6288009: More installer refactoring in the interest of fixing some bugs and cleaning t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <utility>
6
7 #include "base/basictypes.h"
5 #include "chrome/installer/util/channel_info.h" 8 #include "chrome/installer/util/channel_info.h"
6 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
7 10
8 namespace { 11 namespace {
9 12
10 const std::wstring kChannelStable; 13 const std::wstring kChannelStable;
11 const std::wstring kChannelBeta(L"beta"); 14 const std::wstring kChannelBeta(L"beta");
12 const std::wstring kChannelDev(L"dev"); 15 const std::wstring kChannelDev(L"dev");
13 16
14 } // namespace 17 } // namespace
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 154 }
152 155
153 TEST(ChannelInfoTest, Combinations) { 156 TEST(ChannelInfoTest, Combinations) {
154 installer::ChannelInfo ci; 157 installer::ChannelInfo ci;
155 158
156 ci.set_value(L"2.0-beta-chromeframe"); 159 ci.set_value(L"2.0-beta-chromeframe");
157 EXPECT_FALSE(ci.IsChrome()); 160 EXPECT_FALSE(ci.IsChrome());
158 ci.set_value(L"2.0-beta-chromeframe-chrome"); 161 ci.set_value(L"2.0-beta-chromeframe-chrome");
159 EXPECT_TRUE(ci.IsChrome()); 162 EXPECT_TRUE(ci.IsChrome());
160 } 163 }
164
165 TEST(ChannelInfoTest, EqualsBaseOf) {
166 installer::ChannelInfo ci1;
167 installer::ChannelInfo ci2;
168
169 std::pair<std::wstring, std::wstring> trues[] = {
170 std::make_pair(std::wstring(L""), std::wstring(L"")),
171 std::make_pair(std::wstring(L"2.0-beta"), std::wstring(L"2.0-beta")),
172 std::make_pair(std::wstring(L"-full"), std::wstring(L"-full")),
173 std::make_pair(std::wstring(L""), std::wstring(L"-multi"))
174 };
175 for (int i = 0; i < arraysize(trues); ++i) {
176 std::pair<std::wstring, std::wstring>& the_pair = trues[i];
177 ci1.set_value(the_pair.first);
178 ci2.set_value(the_pair.second);
179 EXPECT_TRUE(ci1.EqualsBaseOf(ci2)) << the_pair.first << " "
180 << the_pair.second;
181 }
182
183 std::pair<std::wstring, std::wstring> falses[] = {
184 std::make_pair(std::wstring(L""), std::wstring(L"2.0-beta")),
185 std::make_pair(std::wstring(L"2.0-gamma"), std::wstring(L"2.0-beta")),
186 std::make_pair(std::wstring(L"spam-full"), std::wstring(L"-full")),
187 std::make_pair(std::wstring(L"multi"), std::wstring(L"-multi"))
188 };
189 for (int i = 0; i < arraysize(falses); ++i) {
190 std::pair<std::wstring, std::wstring>& the_pair = falses[i];
191 ci1.set_value(the_pair.first);
192 ci2.set_value(the_pair.second);
193 EXPECT_FALSE(ci1.EqualsBaseOf(ci2)) << the_pair.first << " "
194 << the_pair.second;
195 }
196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698