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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 base::FilePath sub_dir = inner_dir.AppendASCII("subdir"); | 54 base::FilePath sub_dir = inner_dir.AppendASCII("subdir"); |
55 ASSERT_TRUE(file_util::CreateDirectory(sub_dir)); | 55 ASSERT_TRUE(file_util::CreateDirectory(sub_dir)); |
56 base::FilePath inner_file = inner_dir.AppendASCII("inner"); | 56 base::FilePath inner_file = inner_dir.AppendASCII("inner"); |
57 base::FilePath outer_file = temp.path().AppendASCII("outer"); | 57 base::FilePath outer_file = temp.path().AppendASCII("outer"); |
58 ASSERT_TRUE(file_util::WriteFile(outer_file, "X", 1)); | 58 ASSERT_TRUE(file_util::WriteFile(outer_file, "X", 1)); |
59 ASSERT_TRUE(file_util::WriteFile(inner_file, "X", 1)); | 59 ASSERT_TRUE(file_util::WriteFile(inner_file, "X", 1)); |
60 std::string extension_id = id_util::GenerateId("test"); | 60 std::string extension_id = id_util::GenerateId("test"); |
61 | 61 |
62 #if defined(OS_POSIX) | 62 #if defined(OS_POSIX) |
63 base::FilePath symlink_file = inner_dir.AppendASCII("symlink"); | 63 base::FilePath symlink_file = inner_dir.AppendASCII("symlink"); |
64 file_util::CreateSymbolicLink( | 64 base::CreateSymbolicLink( |
65 base::FilePath().AppendASCII("..").AppendASCII("outer"), | 65 base::FilePath().AppendASCII("..").AppendASCII("outer"), |
66 symlink_file); | 66 symlink_file); |
67 #endif | 67 #endif |
68 | 68 |
69 // A non-packing extension should be able to access the file within the | 69 // A non-packing extension should be able to access the file within the |
70 // directory. | 70 // directory. |
71 ExtensionResource r1(extension_id, inner_dir, | 71 ExtensionResource r1(extension_id, inner_dir, |
72 base::FilePath().AppendASCII("inner")); | 72 base::FilePath().AppendASCII("inner")); |
73 EXPECT_FALSE(r1.GetFilePath().empty()); | 73 EXPECT_FALSE(r1.GetFilePath().empty()); |
74 | 74 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ASSERT_FALSE(expected_path.empty()); | 155 ASSERT_FALSE(expected_path.empty()); |
156 | 156 |
157 EXPECT_EQ(ToLower(expected_path.value()), ToLower(resolved_path.value())); | 157 EXPECT_EQ(ToLower(expected_path.value()), ToLower(resolved_path.value())); |
158 EXPECT_EQ(ToLower(temp.path().value()), | 158 EXPECT_EQ(ToLower(temp.path().value()), |
159 ToLower(resource.extension_root().value())); | 159 ToLower(resource.extension_root().value())); |
160 EXPECT_EQ(ToLower(base::FilePath().AppendASCII(filename).value()), | 160 EXPECT_EQ(ToLower(base::FilePath().AppendASCII(filename).value()), |
161 ToLower(resource.relative_path().value())); | 161 ToLower(resource.relative_path().value())); |
162 } | 162 } |
163 | 163 |
164 } // namespace extensions | 164 } // namespace extensions |
OLD | NEW |