| Index: sandbox/mac/sandbox_mac_compiler_unittest.mm
|
| diff --git a/sandbox/mac/sandbox_mac_compiler_unittest.mm b/sandbox/mac/sandbox_mac_compiler_unittest.mm
|
| index c04d89f97efea2f77a1336ff6c013ad3a42355f6..eea5959ed15b9d2f6e96ac3fdb41a644968e0e67 100644
|
| --- a/sandbox/mac/sandbox_mac_compiler_unittest.mm
|
| +++ b/sandbox/mac/sandbox_mac_compiler_unittest.mm
|
| @@ -11,6 +11,7 @@
|
| #include "base/test/multiprocess_test.h"
|
| #include "base/test/test_timeouts.h"
|
| #include "sandbox/mac/sandbox_compiler.h"
|
| +#include "sandbox/mac/seatbelt.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "testing/multiprocess_func_list.h"
|
|
|
| @@ -162,4 +163,27 @@ TEST_F(SandboxMacCompilerTest, ProfileFunctionalityTestError) {
|
| EXPECT_EQ(exit_code, 0);
|
| }
|
|
|
| +MULTIPROCESS_TEST_MAIN(SandboxCheckTestProcess) {
|
| + CHECK(!Seatbelt::IsSandboxed());
|
| + std::string profile =
|
| + "(version 1)"
|
| + "(deny default (with no-log))";
|
| +
|
| + SandboxCompiler compiler(profile);
|
| + std::string error;
|
| + CHECK(compiler.CompileAndApplyProfile(&error));
|
| + CHECK(Seatbelt::IsSandboxed());
|
| +
|
| + return 0;
|
| +}
|
| +
|
| +TEST_F(SandboxMacCompilerTest, SandboxCheckTest) {
|
| + base::SpawnChildResult spawn_child = SpawnChild("SandboxCheckTestProcess");
|
| + ASSERT_TRUE(spawn_child.process.IsValid());
|
| + int exit_code = 42;
|
| + EXPECT_TRUE(spawn_child.process.WaitForExitWithTimeout(
|
| + TestTimeouts::action_max_timeout(), &exit_code));
|
| + EXPECT_EQ(exit_code, 0);
|
| +}
|
| +
|
| } // namespace sandbox
|
|
|