OLD | NEW |
1 // Copyright (c) 2011 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 "sandbox/tests/common/controller.h" | 5 #include "sandbox/tests/common/controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "sandbox/src/sandbox_factory.h" | 10 #include "sandbox/src/sandbox_factory.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 full_path += L"\\SysWOW64\\"; | 48 full_path += L"\\SysWOW64\\"; |
49 full_path += name; | 49 full_path += name; |
50 return full_path; | 50 return full_path; |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 namespace sandbox { | 55 namespace sandbox { |
56 | 56 |
57 std::wstring MakePathToSys(const wchar_t* name, bool is_obj_man_path) { | 57 std::wstring MakePathToSys(const wchar_t* name, bool is_obj_man_path) { |
58 return (base::win::OSInfo::GetInstance()->wow64_status() == | 58 if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) |
59 base::win::OSInfo::WOW64_ENABLED) ? | 59 return MakePathToSysWow64(name, is_obj_man_path); |
60 MakePathToSysWow64(name, is_obj_man_path) : | 60 return MakePathToSys32(name, is_obj_man_path); |
61 MakePathToSys32(name, is_obj_man_path); | |
62 } | 61 } |
63 | 62 |
64 BrokerServices* GetBroker() { | 63 BrokerServices* GetBroker() { |
65 static BrokerServices* broker = SandboxFactory::GetBrokerServices(); | 64 static BrokerServices* broker = SandboxFactory::GetBrokerServices(); |
66 static bool is_initialized = false; | 65 static bool is_initialized = false; |
67 | 66 |
68 if (!broker) { | 67 if (!broker) { |
69 return NULL; | 68 return NULL; |
70 } | 69 } |
71 | 70 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (!is_init_) | 131 if (!is_init_) |
133 return false; | 132 return false; |
134 | 133 |
135 std::wstring win32_path = MakePathToSys32(pattern, false); | 134 std::wstring win32_path = MakePathToSys32(pattern, false); |
136 if (win32_path.empty()) | 135 if (win32_path.empty()) |
137 return false; | 136 return false; |
138 | 137 |
139 if (!AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str())) | 138 if (!AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str())) |
140 return false; | 139 return false; |
141 | 140 |
142 if (base::win::OSInfo::GetInstance()->wow64_status() != | 141 if (base::win::GetWOW64Status() != base::win::WOW64_ENABLED) |
143 base::win::OSInfo::WOW64_ENABLED) | |
144 return true; | 142 return true; |
145 | 143 |
146 win32_path = MakePathToSysWow64(pattern, false); | 144 win32_path = MakePathToSysWow64(pattern, false); |
147 if (win32_path.empty()) | 145 if (win32_path.empty()) |
148 return false; | 146 return false; |
149 | 147 |
150 return AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str()); | 148 return AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str()); |
151 } | 149 } |
152 | 150 |
153 bool TestRunner::AddFsRule(TargetPolicy::Semantics semantics, | 151 bool TestRunner::AddFsRule(TargetPolicy::Semantics semantics, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 if (BEFORE_REVERT == state) | 280 if (BEFORE_REVERT == state) |
283 return command(argc - 4, argv + 4); | 281 return command(argc - 4, argv + 4); |
284 else if (EVERY_STATE == state) | 282 else if (EVERY_STATE == state) |
285 command(argc - 4, argv + 4); | 283 command(argc - 4, argv + 4); |
286 | 284 |
287 target->LowerToken(); | 285 target->LowerToken(); |
288 return command(argc - 4, argv + 4); | 286 return command(argc - 4, argv + 4); |
289 } | 287 } |
290 | 288 |
291 } // namespace sandbox | 289 } // namespace sandbox |
OLD | NEW |