OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 | 4 |
5 #include "chrome/browser/nacl_host/pnacl_file_host.h" | 5 #include "chrome/browser/nacl_host/nacl_file_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/test/scoped_path_override.h" | 11 #include "base/test/scoped_path_override.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 | 13 |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using pnacl_file_host::PnaclCanOpenFile; | 16 using nacl_file_host::PnaclCanOpenFile; |
17 | 17 |
18 // Try to pass a few funny filenames with a dummy pnacl directory set. | 18 // Try to pass a few funny filenames with a dummy pnacl directory set. |
19 TEST(PnaclFileHostTest, TestFilenamesWithPnaclPath) { | 19 TEST(PnaclFileHostTest, TestFilenamesWithPnaclPath) { |
20 base::ScopedTempDir scoped_tmp_dir; | 20 base::ScopedTempDir scoped_tmp_dir; |
21 ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir()); | 21 ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir()); |
22 | 22 |
23 base::FilePath kDummyPnaclPath = scoped_tmp_dir.path(); | 23 base::FilePath kDummyPnaclPath = scoped_tmp_dir.path(); |
24 base::ScopedPathOverride pnach_dir_override(chrome::DIR_PNACL_COMPONENT, | 24 base::ScopedPathOverride pnach_dir_override(chrome::DIR_PNACL_COMPONENT, |
25 kDummyPnaclPath); | 25 kDummyPnaclPath); |
26 ASSERT_TRUE(PathService::Get(chrome::DIR_PNACL_COMPONENT, | 26 ASSERT_TRUE(PathService::Get(chrome::DIR_PNACL_COMPONENT, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 EXPECT_FALSE(PnaclCanOpenFile("..\\llc", &out_path)); | 64 EXPECT_FALSE(PnaclCanOpenFile("..\\llc", &out_path)); |
65 EXPECT_FALSE(PnaclCanOpenFile("%SystemRoot%", &out_path)); | 65 EXPECT_FALSE(PnaclCanOpenFile("%SystemRoot%", &out_path)); |
66 EXPECT_FALSE(PnaclCanOpenFile("%SystemRoot%\\explorer.exe", &out_path)); | 66 EXPECT_FALSE(PnaclCanOpenFile("%SystemRoot%\\explorer.exe", &out_path)); |
67 #else | 67 #else |
68 EXPECT_FALSE(PnaclCanOpenFile("../llc", &out_path)); | 68 EXPECT_FALSE(PnaclCanOpenFile("../llc", &out_path)); |
69 EXPECT_FALSE(PnaclCanOpenFile("/bin/sh", &out_path)); | 69 EXPECT_FALSE(PnaclCanOpenFile("/bin/sh", &out_path)); |
70 EXPECT_FALSE(PnaclCanOpenFile("$HOME", &out_path)); | 70 EXPECT_FALSE(PnaclCanOpenFile("$HOME", &out_path)); |
71 EXPECT_FALSE(PnaclCanOpenFile("$HOME/.bashrc", &out_path)); | 71 EXPECT_FALSE(PnaclCanOpenFile("$HOME/.bashrc", &out_path)); |
72 #endif | 72 #endif |
73 } | 73 } |
OLD | NEW |