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

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

Issue 7669061: Tommi: I need an owner review for the chrome frame changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixing license issue from presubmit check Created 9 years, 4 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/policy_settings_unittest.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utils.h" 13 #include "chrome_frame/utils.h"
14 14
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 17
18 using base::win::RegKey; 18 using base::win::RegKey;
19 using chrome_frame_test::TempRegKeyOverride;
20 19
21 const wchar_t kChannelName[] = L"-dev"; 20 const wchar_t kChannelName[] = L"-dev";
22 const wchar_t kSuffix[] = L"-fix"; 21 const wchar_t kSuffix[] = L"-fix";
23 22
24 // Registry override in the UtilsTest will cause shell APIs to fail 23 // Registry override in the UtilsTest will cause shell APIs to fail
25 // So separate this test from the rest 24 // So separate this test from the rest
26 TEST(SimpleUtilTests, GetTempInternetFiles) { 25 TEST(SimpleUtilTests, GetTempInternetFiles) {
27 FilePath path = GetIETemporaryFilesFolder(); 26 FilePath path = GetIETemporaryFilesFolder();
28 EXPECT_FALSE(path.empty()); 27 EXPECT_FALSE(path.empty());
29 } 28 }
30 29
31 class UtilTests : public testing::Test { 30 class UtilTests : public testing::Test {
32 protected: 31 protected:
33 void SetUp() { 32 void SetUp() {
34 TempRegKeyOverride::DeleteAllTempKeys();
35 DeleteAllSingletons(); 33 DeleteAllSingletons();
36
37 hklm_pol_.reset(new TempRegKeyOverride(HKEY_LOCAL_MACHINE, L"hklm_fake"));
38 hkcu_pol_.reset(new TempRegKeyOverride(HKEY_CURRENT_USER, L"hkcu_fake"));
39 } 34 }
40 35
41 void TearDown() { 36 void TearDown() {
42 hkcu_pol_.reset(NULL); 37 registry_virtualization_.RemoveAllOverrides();
43 hklm_pol_.reset(NULL);
44 TempRegKeyOverride::DeleteAllTempKeys();
45 } 38 }
46 39
47 // This is used to manage life cycle of PolicySettings singleton. 40 // This is used to manage life cycle of PolicySettings singleton.
48 // base::ShadowingAtExitManager at_exit_manager_; 41 // base::ShadowingAtExitManager at_exit_manager_;
49 scoped_ptr<TempRegKeyOverride> hklm_pol_; 42 chrome_frame_test::ScopedVirtualizeHklmAndHkcu registry_virtualization_;
50 scoped_ptr<TempRegKeyOverride> hkcu_pol_;
51 }; 43 };
52 44
53 TEST_F(UtilTests, GetModuleVersionTest) { 45 TEST_F(UtilTests, GetModuleVersionTest) {
54 HMODULE mod = GetModuleHandle(L"kernel32.dll"); 46 HMODULE mod = GetModuleHandle(L"kernel32.dll");
55 EXPECT_NE(mod, static_cast<HMODULE>(NULL)); 47 EXPECT_NE(mod, static_cast<HMODULE>(NULL));
56 wchar_t path[MAX_PATH] = {0}; 48 wchar_t path[MAX_PATH] = {0};
57 GetModuleFileName(mod, path, arraysize(path)); 49 GetModuleFileName(mod, path, arraysize(path));
58 50
59 // Use the method that goes to disk 51 // Use the method that goes to disk
60 scoped_ptr<FileVersionInfo> base_info( 52 scoped_ptr<FileVersionInfo> base_info(
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 535
544 ASSERT_EQ(expect_match, 536 ASSERT_EQ(expect_match,
545 CheckXUaCompatibleDirective(test.header_value, 537 CheckXUaCompatibleDirective(test.header_value,
546 all_versions[version_index])) 538 all_versions[version_index]))
547 << "Expect '" << test.header_value << "' to " 539 << "Expect '" << test.header_value << "' to "
548 << (expect_match ? "match" : "not match") << " IE major version " 540 << (expect_match ? "match" : "not match") << " IE major version "
549 << all_versions[version_index]; 541 << all_versions[version_index];
550 } 542 }
551 } 543 }
552 } 544 }
OLDNEW
« no previous file with comments | « chrome_frame/test/policy_settings_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698