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

Side by Side Diff: chrome_frame/test/util_unittests.cc

Issue 12211108: Rename FilePath -> base::FilePath in various toplevel directories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | chrome_frame/test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "chrome_frame/navigation_constraints.h" 11 #include "chrome_frame/navigation_constraints.h"
12 #include "chrome_frame/test/chrome_frame_test_utils.h" 12 #include "chrome_frame/test/chrome_frame_test_utils.h"
13 #include "chrome_frame/registry_list_preferences_holder.h" 13 #include "chrome_frame/registry_list_preferences_holder.h"
14 #include "chrome_frame/utils.h" 14 #include "chrome_frame/utils.h"
15 15
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 18
19 using base::win::RegKey; 19 using base::win::RegKey;
20 20
21 const wchar_t kChannelName[] = L"-dev"; 21 const wchar_t kChannelName[] = L"-dev";
22 const wchar_t kSuffix[] = L"-fix"; 22 const wchar_t kSuffix[] = L"-fix";
23 23
24 // Registry override in the UtilsTest will cause shell APIs to fail 24 // Registry override in the UtilsTest will cause shell APIs to fail
25 // So separate this test from the rest 25 // So separate this test from the rest
26 TEST(SimpleUtilTests, GetTempInternetFiles) { 26 TEST(SimpleUtilTests, GetTempInternetFiles) {
27 FilePath path = GetIETemporaryFilesFolder(); 27 base::FilePath path = GetIETemporaryFilesFolder();
28 EXPECT_FALSE(path.empty()); 28 EXPECT_FALSE(path.empty());
29 } 29 }
30 30
31 class UtilTests : public testing::Test { 31 class UtilTests : public testing::Test {
32 protected: 32 protected:
33 void SetUp() { 33 void SetUp() {
34 DeleteAllSingletons(); 34 DeleteAllSingletons();
35 } 35 }
36 36
37 void TearDown() { 37 void TearDown() {
38 registry_virtualization_.RemoveAllOverrides(); 38 registry_virtualization_.RemoveAllOverrides();
39 } 39 }
40 40
41 // This is used to manage life cycle of PolicySettings singleton. 41 // This is used to manage life cycle of PolicySettings singleton.
42 // base::ShadowingAtExitManager at_exit_manager_; 42 // base::ShadowingAtExitManager at_exit_manager_;
43 chrome_frame_test::ScopedVirtualizeHklmAndHkcu registry_virtualization_; 43 chrome_frame_test::ScopedVirtualizeHklmAndHkcu registry_virtualization_;
44 }; 44 };
45 45
46 TEST_F(UtilTests, GetModuleVersionTest) { 46 TEST_F(UtilTests, GetModuleVersionTest) {
47 HMODULE mod = GetModuleHandle(L"kernel32.dll"); 47 HMODULE mod = GetModuleHandle(L"kernel32.dll");
48 EXPECT_NE(mod, static_cast<HMODULE>(NULL)); 48 EXPECT_NE(mod, static_cast<HMODULE>(NULL));
49 wchar_t path[MAX_PATH] = {0}; 49 wchar_t path[MAX_PATH] = {0};
50 GetModuleFileName(mod, path, arraysize(path)); 50 GetModuleFileName(mod, path, arraysize(path));
51 51
52 // Use the method that goes to disk 52 // Use the method that goes to disk
53 scoped_ptr<FileVersionInfo> base_info( 53 scoped_ptr<FileVersionInfo> base_info(
54 FileVersionInfo::CreateFileVersionInfo(FilePath(path))); 54 FileVersionInfo::CreateFileVersionInfo(base::FilePath(path)));
55 EXPECT_TRUE(base_info.get() != NULL); 55 EXPECT_TRUE(base_info.get() != NULL);
56 56
57 // Use the method that doesn't go to disk 57 // Use the method that doesn't go to disk
58 uint32 low = 0, high = 0; 58 uint32 low = 0, high = 0;
59 EXPECT_TRUE(GetModuleVersion(mod, &high, &low)); 59 EXPECT_TRUE(GetModuleVersion(mod, &high, &low));
60 EXPECT_NE(high, 0u); 60 EXPECT_NE(high, 0u);
61 EXPECT_NE(low, 0u); 61 EXPECT_NE(low, 0u);
62 62
63 // Make sure they give the same results. 63 // Make sure they give the same results.
64 FileVersionInfoWin* base_info_win = 64 FileVersionInfoWin* base_info_win =
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 ASSERT_EQ(expect_match, 547 ASSERT_EQ(expect_match,
548 CheckXUaCompatibleDirective(test.header_value, 548 CheckXUaCompatibleDirective(test.header_value,
549 all_versions[version_index])) 549 all_versions[version_index]))
550 << "Expect '" << test.header_value << "' to " 550 << "Expect '" << test.header_value << "' to "
551 << (expect_match ? "match" : "not match") << " IE major version " 551 << (expect_match ? "match" : "not match") << " IE major version "
552 << all_versions[version_index]; 552 << all_versions[version_index];
553 } 553 }
554 } 554 }
555 } 555 }
OLDNEW
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | chrome_frame/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698