OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/extensions/extension_file_util.h" | 5 #include "chrome/common/extensions/extension_file_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_value_serializer.h" | 8 #include "base/json/json_value_serializer.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 ASSERT_TRUE(file_util::CreateDirectory(src_path)); | 119 ASSERT_TRUE(file_util::CreateDirectory(src_path)); |
120 | 120 |
121 std::string data = "{ \"name\": { \"message\": \"foobar\" } }"; | 121 std::string data = "{ \"name\": { \"message\": \"foobar\" } }"; |
122 ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("some_file.txt"), | 122 ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("some_file.txt"), |
123 data.c_str(), data.length())); | 123 data.c_str(), data.length())); |
124 std::string error; | 124 std::string error; |
125 EXPECT_TRUE(extension_file_util::CheckForIllegalFilenames(temp.path(), | 125 EXPECT_TRUE(extension_file_util::CheckForIllegalFilenames(temp.path(), |
126 &error)); | 126 &error)); |
127 } | 127 } |
128 | 128 |
| 129 #if defined(OS_WIN) |
| 130 // http://crbug.com/106381 |
| 131 #define CheckIllegalFilenamesOnlyReserved \ |
| 132 DISABLED_CheckIllegalFilenamesOnlyReserved |
| 133 #endif |
129 TEST(ExtensionFileUtil, CheckIllegalFilenamesOnlyReserved) { | 134 TEST(ExtensionFileUtil, CheckIllegalFilenamesOnlyReserved) { |
130 ScopedTempDir temp; | 135 ScopedTempDir temp; |
131 ASSERT_TRUE(temp.CreateUniqueTempDir()); | 136 ASSERT_TRUE(temp.CreateUniqueTempDir()); |
132 | 137 |
133 FilePath src_path = temp.path().Append(Extension::kLocaleFolder); | 138 FilePath src_path = temp.path().Append(Extension::kLocaleFolder); |
134 ASSERT_TRUE(file_util::CreateDirectory(src_path)); | 139 ASSERT_TRUE(file_util::CreateDirectory(src_path)); |
135 | 140 |
136 std::string error; | 141 std::string error; |
137 EXPECT_TRUE(extension_file_util::CheckForIllegalFilenames(temp.path(), | 142 EXPECT_TRUE(extension_file_util::CheckForIllegalFilenames(temp.path(), |
138 &error)); | 143 &error)); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 kManifest, temp.path(), Extension::LOAD, 0, &error); | 291 kManifest, temp.path(), Extension::LOAD, 0, &error); |
287 ASSERT_TRUE(extension.get()) << error; | 292 ASSERT_TRUE(extension.get()) << error; |
288 | 293 |
289 EXPECT_TRUE(extension_file_util::ValidateExtension(extension, &error)) << | 294 EXPECT_TRUE(extension_file_util::ValidateExtension(extension, &error)) << |
290 error; | 295 error; |
291 } | 296 } |
292 | 297 |
293 // TODO(aa): More tests as motivation allows. Maybe steal some from | 298 // TODO(aa): More tests as motivation allows. Maybe steal some from |
294 // ExtensionService? Many of them could probably be tested here without the | 299 // ExtensionService? Many of them could probably be tested here without the |
295 // MessageLoop shenanigans. | 300 // MessageLoop shenanigans. |
OLD | NEW |