| OLD | NEW |
| 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 "chrome/nacl/nacl_main_platform_delegate.h" | 5 #include "chrome/nacl/nacl_main_platform_delegate.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/native_library.h" | 11 #include "base/native_library.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 40 ii != argstrings.end(); ++ii) | 40 ii != argstrings.end(); ++ii) |
| 41 DVLOG(1) << *ii; | 41 DVLOG(1) << *ii; |
| 42 | 42 |
| 43 // Be sure not to load the sandbox test DLL if the sandbox isn't on. | 43 // Be sure not to load the sandbox test DLL if the sandbox isn't on. |
| 44 // Comment-out guard and recompile if you REALLY want to test w/out the SB. | 44 // Comment-out guard and recompile if you REALLY want to test w/out the SB. |
| 45 // TODO(jvoung): allow testing without sandbox, but change expected ret vals. | 45 // TODO(jvoung): allow testing without sandbox, but change expected ret vals. |
| 46 if (!no_sandbox) { | 46 if (!no_sandbox) { |
| 47 FilePath test_dll_name = | 47 FilePath test_dll_name = |
| 48 command_line.GetSwitchValuePath(switches::kTestNaClSandbox); | 48 command_line.GetSwitchValuePath(switches::kTestNaClSandbox); |
| 49 if (!test_dll_name.empty()) { | 49 if (!test_dll_name.empty()) { |
| 50 sandbox_test_module_ = base::LoadNativeLibrary(test_dll_name); | 50 sandbox_test_module_ = base::LoadNativeLibrary(test_dll_name, NULL); |
| 51 CHECK(sandbox_test_module_); | 51 CHECK(sandbox_test_module_); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 void NaClMainPlatformDelegate::EnableSandbox() { | 56 void NaClMainPlatformDelegate::EnableSandbox() { |
| 57 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); | 57 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); |
| 58 SandboxInitWrapper sandbox_wrapper; | 58 SandboxInitWrapper sandbox_wrapper; |
| 59 bool sandbox_initialized_ok = | 59 bool sandbox_initialized_ok = |
| 60 sandbox_wrapper.InitializeSandbox(*parsed_command_line, | 60 sandbox_wrapper.InitializeSandbox(*parsed_command_line, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 76 result = (*run_security_tests)(); | 76 result = (*run_security_tests)(); |
| 77 } else { | 77 } else { |
| 78 VLOG(1) << "Failed to get NaCl sandbox test function"; | 78 VLOG(1) << "Failed to get NaCl sandbox test function"; |
| 79 result = false; | 79 result = false; |
| 80 } | 80 } |
| 81 base::UnloadNativeLibrary(sandbox_test_module_); | 81 base::UnloadNativeLibrary(sandbox_test_module_); |
| 82 sandbox_test_module_ = NULL; | 82 sandbox_test_module_ = NULL; |
| 83 } | 83 } |
| 84 return result; | 84 return result; |
| 85 } | 85 } |
| OLD | NEW |