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

Side by Side Diff: chrome_elf/chrome_elf_util_unittest.cc

Issue 2760853002: Remove use of PRODUCT_STRING_PATH in chrome_elf. (Closed)
Patch Set: now Created 3 years, 9 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
« no previous file with comments | « chrome_elf/chrome_elf_security.cc ('k') | chrome_elf/run_all_unittests.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <tuple> 5 #include <tuple>
6 #include <windows.h> 6 #include <windows.h>
7 #include <versionhelpers.h> // windows.h must be before. 7 #include <versionhelpers.h> // windows.h must be before.
8 8
9 #include "base/test/test_reg_util_win.h" 9 #include "base/test/test_reg_util_win.h"
10 #include "base/win/registry.h" 10 #include "base/win/registry.h"
11 #include "chrome/install_static/install_util.h"
11 #include "chrome_elf/chrome_elf_constants.h" 12 #include "chrome_elf/chrome_elf_constants.h"
12 #include "chrome_elf/chrome_elf_security.h" 13 #include "chrome_elf/chrome_elf_security.h"
13 #include "chrome_elf/nt_registry/nt_registry.h" 14 #include "chrome_elf/nt_registry/nt_registry.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace { 17 namespace {
17 18
18 bool SetSecurityFinchFlag(bool creation) { 19 bool SetSecurityFinchFlag(bool creation) {
19 bool success = true; 20 bool success = true;
21 const base::string16 finch_path(install_static::GetRegistryPath().append(
22 elf_sec::kRegSecurityFinchKeyName));
20 base::win::RegKey security_key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); 23 base::win::RegKey security_key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS);
21 24
22 if (creation) { 25 if (creation) {
23 if (ERROR_SUCCESS != 26 if (ERROR_SUCCESS !=
24 security_key.CreateKey(elf_sec::kRegSecurityFinchPath, KEY_QUERY_VALUE)) 27 security_key.CreateKey(finch_path.c_str(), KEY_QUERY_VALUE))
25 success = false; 28 success = false;
26 } else { 29 } else {
27 if (ERROR_SUCCESS != security_key.DeleteKey(elf_sec::kRegSecurityFinchPath)) 30 if (ERROR_SUCCESS != security_key.DeleteKey(finch_path.c_str()))
28 success = false; 31 success = false;
29 } 32 }
30 33
31 security_key.Close(); 34 security_key.Close();
32 return success; 35 return success;
33 } 36 }
34 37
35 bool IsSecuritySet() { 38 bool IsSecuritySet() {
36 typedef decltype(GetProcessMitigationPolicy)* GetProcessMitigationPolicyFunc; 39 typedef decltype(GetProcessMitigationPolicy)* GetProcessMitigationPolicyFunc;
37 40
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 EXPECT_TRUE(SetSecurityFinchFlag(false)); 97 EXPECT_TRUE(SetSecurityFinchFlag(false));
95 98
96 // Second, test that the process mitigation is set when no finch signal. 99 // Second, test that the process mitigation is set when no finch signal.
97 elf_security::EarlyBrowserSecurity(); 100 elf_security::EarlyBrowserSecurity();
98 EXPECT_TRUE(IsSecuritySet()); 101 EXPECT_TRUE(IsSecuritySet());
99 102
100 ASSERT_NO_FATAL_FAILURE(CancelRegRedirect(nt::HKCU)); 103 ASSERT_NO_FATAL_FAILURE(CancelRegRedirect(nt::HKCU));
101 } 104 }
102 105
103 } // namespace 106 } // namespace
OLDNEW
« no previous file with comments | « chrome_elf/chrome_elf_security.cc ('k') | chrome_elf/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698