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

Side by Side 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, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/shell_dialogs_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/shell_dialogs.h" 5 #include "chrome/browser/shell_dialogs.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 TEST(AppendExtensionIfNeeded, EndingInPeriod_ExtensionAppended) { 8 TEST(AppendExtensionIfNeeded, EndingInPeriod_ExtensionAppended) {
9 const std::wstring filename = L"sample.txt."; 9 const std::wstring filename = L"sample.txt.";
10 const std::wstring filter_selected = L"*.txt"; 10 const std::wstring filter_selected = L"*.txt";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 TEST(AppendExtensionIfNeeded, AllFilesFilter_NoExtensionAppended) { 63 TEST(AppendExtensionIfNeeded, AllFilesFilter_NoExtensionAppended) {
64 const std::wstring filename = L"sample.unknown-mime-type"; 64 const std::wstring filename = L"sample.unknown-mime-type";
65 const std::wstring filter_selected = L"*.*"; 65 const std::wstring filter_selected = L"*.*";
66 const std::wstring suggested_ext; 66 const std::wstring suggested_ext;
67 67
68 const std::wstring actual_filename = AppendExtensionIfNeeded(filename, 68 const std::wstring actual_filename = AppendExtensionIfNeeded(filename,
69 filter_selected, suggested_ext); 69 filter_selected, suggested_ext);
70 70
71 ASSERT_EQ(L"sample.unknown-mime-type", actual_filename); 71 ASSERT_EQ(L"sample.unknown-mime-type", actual_filename);
72 } 72 }
73
74 TEST(AppendExtensionIfNeeded, StripsDotsForUnknownSelectedMimeType) {
75 const std::wstring filename = L"product";
76 const std::wstring filter_selected = L"*.unknown-extension.";
77 const std::wstring suggested_ext = L"html";
78
79 const std::wstring actual_filename = AppendExtensionIfNeeded(filename,
80 filter_selected, suggested_ext);
81
82 ASSERT_EQ(L"product.html", actual_filename);
83 }
84
85 TEST(AppendExtensionIfNeeded, EqualToExtension_NoDoubleExtension) {
86 // Make sure we don't add a duplicate extension like .tbl.tbl for
87 // files that the system doesn't have a mime type for.
88 const std::wstring filename = L"product.tbl";
89 const std::wstring filter_selected = L"*.tbl";
90 const std::wstring suggested_ext = L"tbl";
91
92 const std::wstring actual_filename = AppendExtensionIfNeeded(filename,
93 filter_selected, suggested_ext);
94
95 ASSERT_EQ(L"product.tbl", actual_filename);
96 }
OLDNEW
« 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