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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_version_info.h" | 6 #include "base/file_version_info.h" |
7 #include "base/file_version_info_win.h" | 7 #include "base/file_version_info_win.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 }; | 51 }; |
52 | 52 |
53 TEST_F(UtilTests, GetModuleVersionTest) { | 53 TEST_F(UtilTests, GetModuleVersionTest) { |
54 HMODULE mod = GetModuleHandle(L"kernel32.dll"); | 54 HMODULE mod = GetModuleHandle(L"kernel32.dll"); |
55 EXPECT_NE(mod, static_cast<HMODULE>(NULL)); | 55 EXPECT_NE(mod, static_cast<HMODULE>(NULL)); |
56 wchar_t path[MAX_PATH] = {0}; | 56 wchar_t path[MAX_PATH] = {0}; |
57 GetModuleFileName(mod, path, arraysize(path)); | 57 GetModuleFileName(mod, path, arraysize(path)); |
58 | 58 |
59 // Use the method that goes to disk | 59 // Use the method that goes to disk |
60 scoped_ptr<FileVersionInfo> base_info( | 60 scoped_ptr<FileVersionInfo> base_info( |
61 FileVersionInfo::CreateFileVersionInfo(path)); | 61 FileVersionInfo::CreateFileVersionInfo(FilePath(path))); |
62 EXPECT_TRUE(base_info.get() != NULL); | 62 EXPECT_TRUE(base_info.get() != NULL); |
63 | 63 |
64 // Use the method that doesn't go to disk | 64 // Use the method that doesn't go to disk |
65 uint32 low = 0, high = 0; | 65 uint32 low = 0, high = 0; |
66 EXPECT_TRUE(GetModuleVersion(mod, &high, &low)); | 66 EXPECT_TRUE(GetModuleVersion(mod, &high, &low)); |
67 EXPECT_NE(high, 0u); | 67 EXPECT_NE(high, 0u); |
68 EXPECT_NE(low, 0u); | 68 EXPECT_NE(low, 0u); |
69 | 69 |
70 // Make sure they give the same results. | 70 // Make sure they give the same results. |
71 FileVersionInfoWin* base_info_win = | 71 FileVersionInfoWin* base_info_win = |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 543 |
544 ASSERT_EQ(expect_match, | 544 ASSERT_EQ(expect_match, |
545 CheckXUaCompatibleDirective(test.header_value, | 545 CheckXUaCompatibleDirective(test.header_value, |
546 all_versions[version_index])) | 546 all_versions[version_index])) |
547 << "Expect '" << test.header_value << "' to " | 547 << "Expect '" << test.header_value << "' to " |
548 << (expect_match ? "match" : "not match") << " IE major version " | 548 << (expect_match ? "match" : "not match") << " IE major version " |
549 << all_versions[version_index]; | 549 << all_versions[version_index]; |
550 } | 550 } |
551 } | 551 } |
552 } | 552 } |
OLD | NEW |