diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 20:05:06 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 20:05:06 +0000 |
commit | e25b04c990ab6b733683643bde6f439ea94fbbbd (patch) | |
tree | 333c70b60cac28ca0b8acb819e99c0d291cf33c1 /content/common/sandbox_mac_unittest_helper.mm | |
parent | 626c0b407d288754e7f8171b176cf2d2fd856dac (diff) | |
download | chromium_src-e25b04c990ab6b733683643bde6f439ea94fbbbd.zip chromium_src-e25b04c990ab6b733683643bde6f439ea94fbbbd.tar.gz chromium_src-e25b04c990ab6b733683643bde6f439ea94fbbbd.tar.bz2 |
Move sandbox code in content to content namespace.
Review URL: https://codereview.chromium.org/11228040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/sandbox_mac_unittest_helper.mm')
-rw-r--r-- | content/common/sandbox_mac_unittest_helper.mm | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/content/common/sandbox_mac_unittest_helper.mm b/content/common/sandbox_mac_unittest_helper.mm index 5e52e2a..d71c7aa 100644 --- a/content/common/sandbox_mac_unittest_helper.mm +++ b/content/common/sandbox_mac_unittest_helper.mm @@ -17,8 +17,7 @@ extern "C" { #include "content/test/test_content_client.h" #include "testing/multiprocess_func_list.h" -using sandbox::Sandbox; - +namespace content { namespace { const char* kSandboxTypeKey = "CHROMIUM_SANDBOX_SANDBOX_TYPE"; @@ -27,8 +26,6 @@ const char* kTestDataKey = "CHROMIUM_SANDBOX_USER_DATA"; } // namespace -namespace sandboxtest { - // Support infrastructure for REGISTER_SANDBOX_TEST_CASE macro. namespace internal { @@ -55,11 +52,11 @@ bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name, const char* test_data) { // Go through all the sandbox types, and run the test case in each of them // if one fails, abort. - for(int i = static_cast<int>(content::SANDBOX_TYPE_FIRST_TYPE); - i < content::SANDBOX_TYPE_AFTER_LAST_TYPE; + for(int i = static_cast<int>(SANDBOX_TYPE_FIRST_TYPE); + i < SANDBOX_TYPE_AFTER_LAST_TYPE; ++i) { - if (!RunTestInSandbox(static_cast<content::SandboxType>(i), + if (!RunTestInSandbox(static_cast<SandboxType>(i), test_name, test_data)) { LOG(ERROR) << "Sandboxed test (" << test_name << ")" << "Failed in sandbox type " << i << @@ -70,7 +67,7 @@ bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name, return true; } -bool MacSandboxTest::RunTestInSandbox(content::SandboxType sandbox_type, +bool MacSandboxTest::RunTestInSandbox(SandboxType sandbox_type, const char* test_name, const char* test_data) { std::stringstream s; @@ -119,23 +116,18 @@ MacSandboxTestCase *SandboxTestForName(const char* name) { return it->second; } -} // namespace sandboxtest - -namespace { - // Main function for driver process that enables the sandbox and runs test // code. MULTIPROCESS_TEST_MAIN(mac_sandbox_test_runner) { TestContentClient content_client; - content::SetContentClient(&content_client); + SetContentClient(&content_client); // Extract parameters. char* sandbox_type_str = getenv(kSandboxTypeKey); if (!sandbox_type_str) { LOG(ERROR) << "Sandbox type not specified"; return -1; } - content::SandboxType sandbox_type = - static_cast<content::SandboxType>(atoi(sandbox_type_str)); + SandboxType sandbox_type = static_cast<SandboxType>(atoi(sandbox_type_str)); char* sandbox_test_name = getenv(kSandboxTestNameKey); if (!sandbox_test_name) { LOG(ERROR) << "Sandbox test name not specified"; @@ -145,8 +137,8 @@ MULTIPROCESS_TEST_MAIN(mac_sandbox_test_runner) { const char* test_data = getenv(kTestDataKey); // Find Test Function to run; - scoped_ptr<sandboxtest::MacSandboxTestCase> - test_case(sandboxtest::SandboxTestForName(sandbox_test_name)); + scoped_ptr<MacSandboxTestCase> + test_case(SandboxTestForName(sandbox_test_name)); if (!test_case.get()) { LOG(ERROR) << "Invalid sandbox test name (" << sandbox_test_name << ")"; return -1; @@ -175,4 +167,4 @@ MULTIPROCESS_TEST_MAIN(mac_sandbox_test_runner) { return 0; } -} // namespace +} // namespace content |