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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 | 1208 |
1209 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(safe_tests); ++i) { | 1209 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(safe_tests); ++i) { |
1210 FilePath file_path(safe_tests[i].filename); | 1210 FilePath file_path(safe_tests[i].filename); |
1211 GenerateSafeFileName(safe_tests[i].mime_type, false, &file_path); | 1211 GenerateSafeFileName(safe_tests[i].mime_type, false, &file_path); |
1212 EXPECT_EQ(safe_tests[i].expected_filename, file_path.value()) | 1212 EXPECT_EQ(safe_tests[i].expected_filename, file_path.value()) |
1213 << "Iteration " << i; | 1213 << "Iteration " << i; |
1214 } | 1214 } |
1215 } | 1215 } |
1216 | 1216 |
1217 TEST(NetUtilTest, GenerateFileName) { | 1217 TEST(NetUtilTest, GenerateFileName) { |
1218 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 1218 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
1219 // This test doesn't run when the locale is not UTF-8 because some of the | 1219 // This test doesn't run when the locale is not UTF-8 because some of the |
1220 // string conversions fail. This is OK (we have the default value) but they | 1220 // string conversions fail. This is OK (we have the default value) but they |
1221 // don't match our expectations. | 1221 // don't match our expectations. |
1222 std::string locale = setlocale(LC_CTYPE, NULL); | 1222 std::string locale = setlocale(LC_CTYPE, NULL); |
1223 StringToLowerASCII(&locale); | 1223 StringToLowerASCII(&locale); |
1224 EXPECT_NE(std::string::npos, locale.find("utf-8")) | 1224 EXPECT_NE(std::string::npos, locale.find("utf-8")) |
1225 << "Your locale (" << locale << ") must be set to UTF-8 " | 1225 << "Your locale (" << locale << ") must be set to UTF-8 " |
1226 << "for this test to pass!"; | 1226 << "for this test to pass!"; |
1227 #endif | 1227 #endif |
1228 | 1228 |
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3434 if (it->address[i] != 0) { | 3434 if (it->address[i] != 0) { |
3435 all_zeroes = false; | 3435 all_zeroes = false; |
3436 break; | 3436 break; |
3437 } | 3437 } |
3438 } | 3438 } |
3439 EXPECT_FALSE(all_zeroes); | 3439 EXPECT_FALSE(all_zeroes); |
3440 } | 3440 } |
3441 } | 3441 } |
3442 | 3442 |
3443 } // namespace net | 3443 } // namespace net |
OLD | NEW |