Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 | |
|
jln (very slow on Chromium)
2014/06/02 21:31:47
Style: no empty line here.
Mark Seaborn
2014/06/02 23:10:29
Nit: remove empty line at start
elijahtaylor1
2014/06/03 20:47:54
Done.
elijahtaylor1
2014/06/03 20:47:55
Done.
| |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 3 // Use of this source code is governed by a BSD-style license that can be | |
| 4 // found in the LICENSE file. | |
| 5 | |
| 6 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" | |
|
jln (very slow on Chromium)
2014/06/02 21:31:47
Nit: empty line after including the interface that
elijahtaylor1
2014/06/03 20:47:55
Done.
| |
| 7 #include "base/environment.h" | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/process/launch.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
|
jln (very slow on Chromium)
2014/06/02 21:31:47
Nit: add an anonymous namespace.
elijahtaylor1
2014/06/03 20:47:55
I don't know if that's possible since we need to m
jln (very slow on Chromium)
2014/06/03 22:58:13
Yeah, probably a good idea to have it in the nacl
| |
| 12 TEST(NaClForkDelegateLinuxTest, EnvPassthrough) { | |
| 13 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
| 14 const char passthrough1[] = "HELPER_PASSTHROUGH1"; | |
| 15 const char passthrough2[] = "HELPER_PASSTHROUGH2"; | |
| 16 const char passthrough3[] = "HELPER_PASSTHROUGH3"; | |
| 17 const char passthrough4[] = "HELPER_PASSTHROUGH4"; | |
| 18 const char value1[] = "passthrough_value1"; | |
| 19 const char value3[] = "passthrough_value3"; | |
| 20 const char value4[] = "passthrough_value4"; | |
| 21 std::string passthrough_value; | |
| 22 passthrough_value += passthrough1; | |
| 23 passthrough_value += " "; | |
| 24 passthrough_value += passthrough2; | |
| 25 passthrough_value += " "; | |
| 26 passthrough_value += passthrough3; | |
| 27 // Not adding passthrough4 to the passthrough variable. | |
| 28 env->SetVar("NACL_DANGEROUS_NACL_HELPER_ENV_PASSTHROUGH", | |
| 29 passthrough_value.c_str()); | |
| 30 env->SetVar(passthrough1, value1); | |
| 31 // Intentionally skip setting a value for passthrough2. | |
| 32 env->SetVar(passthrough3, value3); | |
| 33 env->SetVar(passthrough4, value4); | |
| 34 | |
| 35 base::LaunchOptions options; | |
| 36 nacl::NaClForkDelegate::AddPassthroughEnvToOptions(options); | |
| 37 EXPECT_EQ(value1, options.environ[passthrough1]); | |
| 38 EXPECT_EQ(0U, options.environ.count(passthrough2)); | |
| 39 EXPECT_EQ(value3, options.environ[passthrough3]); | |
| 40 EXPECT_EQ(0U, options.environ.count(passthrough4)); | |
| 41 } | |
| OLD | NEW |