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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/strings/string_split.h" | 6 #include "base/strings/string_split.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "net/base/mime_util.h" | 8 #include "net/base/mime_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); | 287 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); |
288 ASSERT_EQ(2u, codecs_out.size()); | 288 ASSERT_EQ(2u, codecs_out.size()); |
289 EXPECT_EQ("avc1.42E01E", codecs_out[0]); | 289 EXPECT_EQ("avc1.42E01E", codecs_out[0]); |
290 EXPECT_EQ("mp4a.40.2", codecs_out[1]); | 290 EXPECT_EQ("mp4a.40.2", codecs_out[1]); |
291 } | 291 } |
292 | 292 |
293 TEST(MimeUtilTest, TestParseMimeTypeWithoutParameter) { | 293 TEST(MimeUtilTest, TestParseMimeTypeWithoutParameter) { |
294 std::string nonAscii("application/nonutf8"); | 294 std::string nonAscii("application/nonutf8"); |
295 EXPECT_TRUE(ParseMimeTypeWithoutParameter(nonAscii, NULL, NULL)); | 295 EXPECT_TRUE(ParseMimeTypeWithoutParameter(nonAscii, NULL, NULL)); |
296 #if defined(OS_WIN) | 296 #if defined(OS_WIN) |
297 nonAscii.append(base::WideToUTF8(std::wstring(L"\u2603"))); | 297 nonAscii.append(base::WideToUTF8(L"\u2603")); |
298 #else | 298 #else |
299 nonAscii.append("\u2603"); // unicode snowman | 299 nonAscii.append("\u2603"); // unicode snowman |
300 #endif | 300 #endif |
301 EXPECT_FALSE(ParseMimeTypeWithoutParameter(nonAscii, NULL, NULL)); | 301 EXPECT_FALSE(ParseMimeTypeWithoutParameter(nonAscii, NULL, NULL)); |
302 | 302 |
303 std::string top_level_type; | 303 std::string top_level_type; |
304 std::string subtype; | 304 std::string subtype; |
305 EXPECT_TRUE(ParseMimeTypeWithoutParameter( | 305 EXPECT_TRUE(ParseMimeTypeWithoutParameter( |
306 "application/mime", &top_level_type, &subtype)); | 306 "application/mime", &top_level_type, &subtype)); |
307 EXPECT_EQ("application", top_level_type); | 307 EXPECT_EQ("application", top_level_type); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 std::string post_data; | 453 std::string post_data; |
454 AddMultipartValueForUpload("value name", "value", "boundary", | 454 AddMultipartValueForUpload("value name", "value", "boundary", |
455 "content type", &post_data); | 455 "content type", &post_data); |
456 AddMultipartValueForUpload("value name", "value", "boundary", | 456 AddMultipartValueForUpload("value name", "value", "boundary", |
457 "", &post_data); | 457 "", &post_data); |
458 AddMultipartFinalDelimiterForUpload("boundary", &post_data); | 458 AddMultipartFinalDelimiterForUpload("boundary", &post_data); |
459 EXPECT_STREQ(ref_output, post_data.c_str()); | 459 EXPECT_STREQ(ref_output, post_data.c_str()); |
460 } | 460 } |
461 | 461 |
462 } // namespace net | 462 } // namespace net |
OLD | NEW |