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_TRUE(locale.find("utf-8") != std::string::npos || | 1224 EXPECT_TRUE(locale.find("utf-8") != std::string::npos || |
1225 locale.find("utf8") != std::string::npos) | 1225 locale.find("utf8") != std::string::npos) |
1226 << "Your locale (" << locale << ") must be set to UTF-8 " | 1226 << "Your locale (" << locale << ") must be set to UTF-8 " |
1227 << "for this test to pass!"; | 1227 << "for this test to pass!"; |
1228 #endif | 1228 #endif |
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 if (it->address[i] != 0) { | 3435 if (it->address[i] != 0) { |
3436 all_zeroes = false; | 3436 all_zeroes = false; |
3437 break; | 3437 break; |
3438 } | 3438 } |
3439 } | 3439 } |
3440 EXPECT_FALSE(all_zeroes); | 3440 EXPECT_FALSE(all_zeroes); |
3441 } | 3441 } |
3442 } | 3442 } |
3443 | 3443 |
3444 } // namespace net | 3444 } // namespace net |
OLD | NEW |