OLD | NEW |
| (Empty) |
1 // Copyright 2009-2010 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #include "omaha/base/constants.h" | |
17 #include "omaha/base/error.h" | |
18 #include "omaha/base/reg_key.h" | |
19 #include "omaha/base/vistautil.h" | |
20 #include "omaha/client/install_self_internal.h" | |
21 #include "omaha/testing/omaha_unittest.h" | |
22 #include "omaha/testing/unit_test.h" | |
23 | |
24 // Overriding HKLM causes HasXmlParser() to fail on Vista. | |
25 // These tests must be run independently because other tests may use the XML | |
26 // parser, making it available despite the HKLM overriding. | |
27 | |
28 // This test links against code that requires the following symbols but the test | |
29 // does not use them. See the TODO in the build.scons. Rather than link against | |
30 // more libs, define these symbols here. | |
31 // | |
32 // From omaha3_idl.lib. | |
33 EXTERN_C const GUID IID_IGoogleUpdate3 = GUID_NULL; | |
34 EXTERN_C const GUID IID_IAppBundle = GUID_NULL; | |
35 EXTERN_C const GUID IID_IApp = GUID_NULL; | |
36 EXTERN_C const GUID IID_IAppVersion = GUID_NULL; | |
37 EXTERN_C const GUID IID_IPackage = GUID_NULL; | |
38 EXTERN_C const GUID IID_ICurrentState = GUID_NULL; | |
39 EXTERN_C const GUID IID_IGoogleUpdate3Web = GUID_NULL; | |
40 EXTERN_C const GUID IID_IGoogleUpdate3WebSecurity = GUID_NULL; | |
41 EXTERN_C const GUID IID_IAppBundleWeb = GUID_NULL; | |
42 EXTERN_C const GUID IID_IAppWeb = GUID_NULL; | |
43 EXTERN_C const GUID IID_IAppVersionWeb = GUID_NULL; | |
44 EXTERN_C const GUID CLSID_ProcessLauncherClass = GUID_NULL; | |
45 EXTERN_C const GUID IID_IGoogleUpdate = GUID_NULL; | |
46 EXTERN_C const GUID IID_IGoogleUpdateCore = GUID_NULL; | |
47 EXTERN_C const GUID IID_IProgressWndEvents = GUID_NULL; | |
48 EXTERN_C const GUID LIBID_GoogleUpdate3Lib = GUID_NULL; | |
49 EXTERN_C const GUID IID_ICoCreateAsync = GUID_NULL; | |
50 EXTERN_C const GUID IID_ICoCreateAsyncStatus = GUID_NULL; | |
51 EXTERN_C const GUID IID_IOneClickProcessLauncher = GUID_NULL; | |
52 EXTERN_C const GUID IID_ICredentialDialog = GUID_NULL; | |
53 EXTERN_C const GUID IID_IProcessLauncher = GUID_NULL; | |
54 // From bits.lib. | |
55 EXTERN_C const GUID IID_IBackgroundCopyCallback = GUID_NULL; | |
56 // From iphlpapi.lib. | |
57 #include <iphlpapi.h> // NOLINT | |
58 DWORD WINAPI GetIfTable(PMIB_IFTABLE, PULONG, BOOL) { return 0; } | |
59 | |
60 namespace omaha { | |
61 | |
62 TEST_F(RegistryProtectedTest, InstallOmaha_XmlParserNotPresent) { | |
63 if (!vista_util::IsVistaOrLater()) { | |
64 std::wcout << _T("\tTest did not run because it requires Vista or later.") | |
65 << std::endl; | |
66 return; | |
67 } | |
68 int extra_code1 = 0; | |
69 EXPECT_EQ(GOOPDATE_E_RUNNING_INFERIOR_MSXML, | |
70 install_self::internal::DoInstallSelf(false, | |
71 false, | |
72 false, | |
73 false, | |
74 &extra_code1)); | |
75 EXPECT_EQ(0, extra_code1); | |
76 EXPECT_FALSE(RegKey::HasKey(USER_REG_GOOGLE)); | |
77 } | |
78 | |
79 // Overriding HKLM causes HasXmlParser() to fail on Vista. | |
80 TEST_F(RegistryProtectedTest, CheckSystemRequirements_XmlParserNotPresent) { | |
81 if (!vista_util::IsVistaOrLater()) { | |
82 std::wcout << _T("\tTest did not run because it requires Vista or later.") | |
83 << std::endl; | |
84 return; | |
85 } | |
86 EXPECT_EQ(GOOPDATE_E_RUNNING_INFERIOR_MSXML, | |
87 install_self::internal::CheckSystemRequirements()); | |
88 } | |
89 | |
90 // Overriding HKLM causes HasXmlParser() to fail on Vista. | |
91 TEST_F(RegistryProtectedTest, HasXmlParser_NotPresent) { | |
92 if (!vista_util::IsVistaOrLater()) { | |
93 std::wcout << _T("\tTest did not run because it requires Vista or later.") | |
94 << std::endl; | |
95 return; | |
96 } | |
97 EXPECT_FALSE(install_self::internal::HasXmlParser()); | |
98 } | |
99 | |
100 } // namespace omaha | |
OLD | NEW |