Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/platform/minijail/minijail_unittest.cc

Issue 466049: Baseline minijail with a commandline switch driven main. (Closed)
Patch Set: fix overly long lines Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform/minijail/minijail_testrunner.cc ('k') | src/platform/minijail/options.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 // Some portions Copyright (c) 2009 The Chromium Authors.
5 //
6 // Tests for MiniJail
7 #include "env.h"
8 #include "minijail.h"
9 #include <gtest/gtest.h>
10
11 namespace chromeos {
12
13 // TODO: pull in gmock to make this non-crazy for testing.
14 class TrueEnv : public minijail::Env {
15 public:
16 TrueEnv() { }
17 ~TrueEnv() { }
18 bool DisableTracing() const { return true; }
19 bool KeepRootCapabilities() const { return true; }
20 bool DisableDefaultRootPrivileges() const { return true; }
21 bool ChangeUser(uid_t uid, gid_t gid) const { return true; }
22 bool SanitizeBoundingSet(uint64 capmask) const { return true; }
23 bool EnterNamespace(int namespaces) const { return true; }
24 bool FilterSyscallsBySource() const { return true; }
25 bool Mount() const { return true; }
26 bool SanitizeCapabilities(uint64 eff_capmask) const { return true; }
27 bool Run(const char *path,
28 char * const *argv,
29 char * const *envp) const { return true; }
30 };
31
32 class MiniJailTest : public ::testing::Test { };
33
34 TEST(MiniJailTest, TrueJail) {
35 TrueEnv *env = new TrueEnv;
36 MiniJailOptions options;
37 options.set_env(env);
38 MiniJail jail;
39 // This does basically nothing since the options default to false.
40 // Only ChangeUser is actually called.
41 EXPECT_TRUE(jail.Jail());
42 EXPECT_TRUE(jail.Run());
43 }
44
45 } // namespace chromeos
OLDNEW
« no previous file with comments | « src/platform/minijail/minijail_testrunner.cc ('k') | src/platform/minijail/options.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698