| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 // Some portions Copyright (c) 2009 The Chromium Authors. | 4 // Some portions Copyright (c) 2009 The Chromium Authors. |
| 5 // | 5 // |
| 6 // Tests for MiniJail | 6 // Tests for MiniJail |
| 7 #include "env.h" | 7 #include "env.h" |
| 8 #include "minijail.h" | 8 #include "minijail.h" |
| 9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 bool Run(const char *path, | 27 bool Run(const char *path, |
| 28 char * const *argv, | 28 char * const *argv, |
| 29 char * const *envp) const { return true; } | 29 char * const *envp) const { return true; } |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 class MiniJailTest : public ::testing::Test { }; | 32 class MiniJailTest : public ::testing::Test { }; |
| 33 | 33 |
| 34 TEST(MiniJailTest, TrueJail) { | 34 TEST(MiniJailTest, TrueJail) { |
| 35 TrueEnv *env = new TrueEnv; | 35 TrueEnv *env = new TrueEnv; |
| 36 MiniJailOptions options; | 36 MiniJailOptions options; |
| 37 options.set_env(env); | 37 options.set_env(env); // takes ownership |
| 38 options.set_executable_path("/no/where"); |
| 38 MiniJail jail; | 39 MiniJail jail; |
| 40 jail.Initialize(&options); |
| 39 // This does basically nothing since the options default to false. | 41 // This does basically nothing since the options default to false. |
| 40 // Only ChangeUser is actually called. | 42 // Only ChangeUser is actually called. |
| 41 EXPECT_TRUE(jail.Jail()); | 43 EXPECT_TRUE(jail.Jail()); |
| 42 EXPECT_TRUE(jail.Run()); | 44 EXPECT_TRUE(jail.Run()); |
| 43 } | 45 } |
| 44 | 46 |
| 45 } // namespace chromeos | 47 } // namespace chromeos |
| OLD | NEW |