Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: base/files/file_path_unittest.cc

Issue 596103002: Fix more disabled MSVC warnings, base/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/platform_test.h" 9 #include "testing/platform_test.h"
10 10
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 { FPL("/foo.1234.tar.gz"), FPL(".tar.gz") }, 763 { FPL("/foo.1234.tar.gz"), FPL(".tar.gz") },
764 { FPL("/foo.tar.tar.gz"), FPL(".tar.gz") }, 764 { FPL("/foo.tar.tar.gz"), FPL(".tar.gz") },
765 { FPL("/foo.tar.gz.gz"), FPL(".gz.gz") }, 765 { FPL("/foo.tar.gz.gz"), FPL(".gz.gz") },
766 { FPL("/foo.1234.user.js"), FPL(".user.js") }, 766 { FPL("/foo.1234.user.js"), FPL(".user.js") },
767 { FPL("foo.user.js"), FPL(".user.js") }, 767 { FPL("foo.user.js"), FPL(".user.js") },
768 }; 768 };
769 for (unsigned int i = 0; i < arraysize(cases); ++i) { 769 for (unsigned int i = 0; i < arraysize(cases); ++i) {
770 FilePath path(cases[i].input); 770 FilePath path(cases[i].input);
771 FilePath::StringType extension = path.Extension(); 771 FilePath::StringType extension = path.Extension();
772 FilePath::StringType final_extension = path.FinalExtension(); 772 FilePath::StringType final_extension = path.FinalExtension();
773 EXPECT_STREQ(cases[i].expected, extension.c_str()) << "i: " << i << 773 EXPECT_STREQ(cases[i].expected, extension.c_str())
774 ", path: " << path.value(); 774 << "i: " << i << ", path: " << path.value();
775 EXPECT_STREQ(cases[i].expected, final_extension.c_str()) << "i: " << i << 775 EXPECT_STREQ(cases[i].expected, final_extension.c_str())
776 ", path: " << path.value(); 776 << "i: " << i << ", path: " << path.value();
777 } 777 }
778 for (unsigned int i = 0; i < arraysize(double_extension_cases); ++i) { 778 for (unsigned int i = 0; i < arraysize(double_extension_cases); ++i) {
779 FilePath path(cases[i].input); 779 FilePath path(double_extension_cases[i].input);
Peter Kasting 2014/09/23 23:07:34 This was caught by "warn on unused locals"; turns
780 FilePath::StringType extension = path.Extension(); 780 FilePath::StringType extension = path.Extension();
781 EXPECT_STREQ(cases[i].expected, extension.c_str()) << "i: " << i << 781 EXPECT_STREQ(double_extension_cases[i].expected, extension.c_str())
782 ", path: " << path.value(); 782 << "i: " << i << ", path: " << path.value();
783 } 783 }
784 } 784 }
785 785
786 TEST_F(FilePathTest, InsertBeforeExtension) { 786 TEST_F(FilePathTest, InsertBeforeExtension) {
787 const struct BinaryTestData cases[] = { 787 const struct BinaryTestData cases[] = {
788 { { FPL(""), FPL("") }, FPL("") }, 788 { { FPL(""), FPL("") }, FPL("") },
789 { { FPL(""), FPL("txt") }, FPL("") }, 789 { { FPL(""), FPL("txt") }, FPL("") },
790 { { FPL("."), FPL("txt") }, FPL("") }, 790 { { FPL("."), FPL("txt") }, FPL("") },
791 { { FPL(".."), FPL("txt") }, FPL("") }, 791 { { FPL(".."), FPL("txt") }, FPL("") },
792 { { FPL("foo.dll"), FPL("txt") }, FPL("footxt.dll") }, 792 { { FPL("foo.dll"), FPL("txt") }, FPL("footxt.dll") },
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 for (size_t i = 0; i < arraysize(cases); ++i) { 1274 for (size_t i = 0; i < arraysize(cases); ++i) {
1275 FilePath input(cases[i].input); 1275 FilePath input(cases[i].input);
1276 bool observed = input.IsContentUri(); 1276 bool observed = input.IsContentUri();
1277 EXPECT_EQ(cases[i].expected, observed) << 1277 EXPECT_EQ(cases[i].expected, observed) <<
1278 "i: " << i << ", input: " << input.value(); 1278 "i: " << i << ", input: " << input.value();
1279 } 1279 }
1280 } 1280 }
1281 #endif 1281 #endif
1282 1282
1283 } // namespace base 1283 } // namespace base
OLDNEW
« no previous file with comments | « base/file_version_info_win.cc ('k') | base/files/file_util.cc » ('j') | base/logging.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698