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

Unified Diff: chrome/browser/views/shell_dialogs_win_unittest.cc

Issue 3069018: Win: Don't give some downloads duplicate extensions like .arj.arj... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/shell_dialogs_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/shell_dialogs_win_unittest.cc
===================================================================
--- chrome/browser/views/shell_dialogs_win_unittest.cc (revision 54609)
+++ chrome/browser/views/shell_dialogs_win_unittest.cc (working copy)
@@ -70,3 +70,27 @@
ASSERT_EQ(L"sample.unknown-mime-type", actual_filename);
}
+
+TEST(AppendExtensionIfNeeded, StripsDotsForUnknownSelectedMimeType) {
+ const std::wstring filename = L"product";
+ const std::wstring filter_selected = L"*.unknown-extension.";
+ const std::wstring suggested_ext = L"html";
+
+ const std::wstring actual_filename = AppendExtensionIfNeeded(filename,
+ filter_selected, suggested_ext);
+
+ ASSERT_EQ(L"product.html", actual_filename);
+}
+
+TEST(AppendExtensionIfNeeded, EqualToExtension_NoDoubleExtension) {
+ // Make sure we don't add a duplicate extension like .tbl.tbl for
+ // files that the system doesn't have a mime type for.
+ const std::wstring filename = L"product.tbl";
+ const std::wstring filter_selected = L"*.tbl";
+ const std::wstring suggested_ext = L"tbl";
+
+ const std::wstring actual_filename = AppendExtensionIfNeeded(filename,
+ filter_selected, suggested_ext);
+
+ ASSERT_EQ(L"product.tbl", actual_filename);
+}
« no previous file with comments | « chrome/browser/views/shell_dialogs_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698