| 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/pnacl_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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 const char non_ascii[] = "\xff\xfe"; | 50 const char non_ascii[] = "\xff\xfe"; |
| 51 EXPECT_FALSE(PnaclCanOpenFile(non_ascii, &out_path)); | 51 EXPECT_FALSE(PnaclCanOpenFile(non_ascii, &out_path)); |
| 52 | 52 |
| 53 // Check file length restriction. | 53 // Check file length restriction. |
| 54 EXPECT_FALSE(PnaclCanOpenFile("thisstringisactuallywaaaaaaaaaaaaaaaaaaaaaaaa" | 54 EXPECT_FALSE(PnaclCanOpenFile("thisstringisactuallywaaaaaaaaaaaaaaaaaaaaaaaa" |
| 55 "toolongwaytoolongwaaaaayyyyytoooooooooooooooo" | 55 "toolongwaytoolongwaaaaayyyyytoooooooooooooooo" |
| 56 "looooooooong", | 56 "looooooooong", |
| 57 &out_path)); | 57 &out_path)); |
| 58 | 58 |
| 59 // Other bad files. | 59 // Other bad files. |
| 60 EXPECT_FALSE(PnaclCanOpenFile("", &out_path)); | 60 EXPECT_FALSE(PnaclCanOpenFile(std::string(), &out_path)); |
| 61 EXPECT_FALSE(PnaclCanOpenFile(".", &out_path)); | 61 EXPECT_FALSE(PnaclCanOpenFile(".", &out_path)); |
| 62 EXPECT_FALSE(PnaclCanOpenFile("..", &out_path)); | 62 EXPECT_FALSE(PnaclCanOpenFile("..", &out_path)); |
| 63 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
| 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 |