diff options
author | jvoung@google.com <jvoung@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 23:02:52 +0000 |
---|---|---|
committer | jvoung@google.com <jvoung@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 23:02:52 +0000 |
commit | 23acfc08defd8db4cd54d91e86593baf47b461ea (patch) | |
tree | fe9e80355421a03b7fab0bf372834144adf4bd21 /chrome/nacl/nacl_main_platform_delegate.h | |
parent | 9d098779ae0342c1bf8db56d0bacbb57c3858215 (diff) | |
download | chromium_src-23acfc08defd8db4cd54d91e86593baf47b461ea.zip chromium_src-23acfc08defd8db4cd54d91e86593baf47b461ea.tar.gz chromium_src-23acfc08defd8db4cd54d91e86593baf47b461ea.tar.bz2 |
Set up tests to exercise the chrome outersandbox from the nacl loader.
It is similar to the renderer sandbox tests in that the test code is
separated into a DLL and only loaded based on commandline flags.
Currently tests file open, process creation, and connect.
This is currently not set up for Linux. To set it up for Linux,
we need to be more careful about what tests are expected to pass,
and will need to look into zygote process for how to get the test
shared lib loaded.
BUG=39409
TEST=none
Review URL: http://codereview.chromium.org/1549046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/nacl/nacl_main_platform_delegate.h')
-rw-r--r-- | chrome/nacl/nacl_main_platform_delegate.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/nacl/nacl_main_platform_delegate.h b/chrome/nacl/nacl_main_platform_delegate.h new file mode 100644 index 0000000..fe13ae3 --- /dev/null +++ b/chrome/nacl/nacl_main_platform_delegate.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ +#define CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ + +#include "chrome/common/main_function_params.h" + +typedef bool (*RunNaClLoaderTests)(void); +const char kNaClLoaderTestCall[] = "RunNaClLoaderTests"; + + +class NaClMainPlatformDelegate { + public: + explicit NaClMainPlatformDelegate(const MainFunctionParams& parameters); + ~NaClMainPlatformDelegate(); + + // Called first thing and last thing in the process' lifecycle, i.e. before + // the sandbox is enabled. + void PlatformInitialize(); + void PlatformUninitialize(); + + // Gives us an opportunity to initialize state used for tests before enabling + // the sandbox. + void InitSandboxTests(bool no_sandbox); + + // Initiate Lockdown, returns true on success. + bool EnableSandbox(); + + // Runs the sandbox tests for the NaCl Loader, if tests supplied. + // Cannot run again, after this (resources freed). + void RunSandboxTests(); + + private: + const MainFunctionParams& parameters_; +#if defined(OS_WIN) + HMODULE sandbox_test_module_; + // #elif defined(OS_POSIX) doesn't seem to work on Mac. +#elif defined(OS_LINUX) || defined(OS_MACOSX) + void* sandbox_test_module_; +#endif + + DISALLOW_COPY_AND_ASSIGN(NaClMainPlatformDelegate); +}; + +#endif // CHROME_NACL_NACL_MAIN_PLATFORM_DELEGATE_H_ |