| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |