Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/install_static/install_modes.h" | 5 #include "chrome/install_static/install_modes.h" |
| 6 | 6 |
| 7 #include <windows.h> | |
| 8 | |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 11 |
| 10 using ::testing::Eq; | 12 using ::testing::Eq; |
| 11 using ::testing::Gt; | 13 using ::testing::Gt; |
| 14 using ::testing::Le; | |
| 12 using ::testing::Ne; | 15 using ::testing::Ne; |
| 13 using ::testing::StrEq; | 16 using ::testing::StrEq; |
| 14 using ::testing::StrNe; | 17 using ::testing::StrNe; |
| 15 | 18 |
| 16 namespace install_static { | 19 namespace install_static { |
| 17 | 20 |
| 18 TEST(InstallModes, VerifyModes) { | 21 TEST(InstallModes, VerifyModes) { |
| 19 ASSERT_THAT(NUM_INSTALL_MODES, Gt(0)); | 22 ASSERT_THAT(NUM_INSTALL_MODES, Gt(0)); |
| 20 for (int i = 0; i < NUM_INSTALL_MODES; ++i) { | 23 for (int i = 0; i < NUM_INSTALL_MODES; ++i) { |
| 21 const InstallConstants& mode = kInstallModes[i]; | 24 const InstallConstants& mode = kInstallModes[i]; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 40 ASSERT_THAT(mode.logo_suffix, StrEq(L"")); | 43 ASSERT_THAT(mode.logo_suffix, StrEq(L"")); |
| 41 else | 44 else |
| 42 ASSERT_THAT(mode.logo_suffix, StrNe(L"")); | 45 ASSERT_THAT(mode.logo_suffix, StrNe(L"")); |
| 43 | 46 |
| 44 // The modes must have an appguid if Google Update integration is supported. | 47 // The modes must have an appguid if Google Update integration is supported. |
| 45 if (kUseGoogleUpdateIntegration) | 48 if (kUseGoogleUpdateIntegration) |
| 46 ASSERT_THAT(mode.app_guid, StrNe(L"")); | 49 ASSERT_THAT(mode.app_guid, StrNe(L"")); |
| 47 else | 50 else |
| 48 ASSERT_THAT(mode.app_guid, StrEq(L"")); | 51 ASSERT_THAT(mode.app_guid, StrEq(L"")); |
| 49 | 52 |
| 53 // The ProgID prefix must not be empty and must be no greater than 11 | |
| 54 // characters long. | |
| 55 ASSERT_THAT(mode.prog_id_prefix, StrNe(L"")); | |
| 56 ASSERT_THAT(lstrlen(mode.prog_id_prefix), Le(11)); | |
|
huangs
2017/03/21 15:35:48
https://msdn.microsoft.com/library/windows/desktop
grt (UTC plus 2)
2017/03/22 08:03:36
tests added
| |
| 57 | |
| 58 // The ProgID description must not be empty. | |
| 59 ASSERT_THAT(mode.prog_id_description, StrNe(L"")); | |
| 60 | |
| 50 // UNSUPPORTED and kUseGoogleUpdateIntegration are mutually exclusive. | 61 // UNSUPPORTED and kUseGoogleUpdateIntegration are mutually exclusive. |
| 51 if (kUseGoogleUpdateIntegration) | 62 if (kUseGoogleUpdateIntegration) |
| 52 ASSERT_THAT(mode.channel_strategy, Ne(ChannelStrategy::UNSUPPORTED)); | 63 ASSERT_THAT(mode.channel_strategy, Ne(ChannelStrategy::UNSUPPORTED)); |
| 53 else | 64 else |
| 54 ASSERT_THAT(mode.channel_strategy, Eq(ChannelStrategy::UNSUPPORTED)); | 65 ASSERT_THAT(mode.channel_strategy, Eq(ChannelStrategy::UNSUPPORTED)); |
| 55 } | 66 } |
| 56 } | 67 } |
| 57 | 68 |
| 58 TEST(InstallModes, VerifyBrand) { | 69 TEST(InstallModes, VerifyBrand) { |
| 59 if (kUseGoogleUpdateIntegration) { | 70 if (kUseGoogleUpdateIntegration) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 GetBinariesClientStateMediumKeyPath(), | 142 GetBinariesClientStateMediumKeyPath(), |
| 132 StrEq(std::wstring(L"Software\\Google\\Update\\ClientStateMedium\\") | 143 StrEq(std::wstring(L"Software\\Google\\Update\\ClientStateMedium\\") |
| 133 .append(kBinariesAppGuid))); | 144 .append(kBinariesAppGuid))); |
| 134 } else { | 145 } else { |
| 135 ASSERT_THAT(GetBinariesClientStateMediumKeyPath(), | 146 ASSERT_THAT(GetBinariesClientStateMediumKeyPath(), |
| 136 StrEq(std::wstring(L"Software\\").append(kBinariesPathName))); | 147 StrEq(std::wstring(L"Software\\").append(kBinariesPathName))); |
| 137 } | 148 } |
| 138 } | 149 } |
| 139 | 150 |
| 140 } // namespace install_static | 151 } // namespace install_static |
| OLD | NEW |