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

Unified Diff: ui/base/win/open_file_name_win_unittest.cc

Issue 618503002: Fix the open file dialog on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing unit tests and feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/win/open_file_name_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/open_file_name_win_unittest.cc
diff --git a/ui/base/win/open_file_name_win_unittest.cc b/ui/base/win/open_file_name_win_unittest.cc
index f69ec971d19aae4a3f5bd7afc4db1311869f6dbc..9eaee791a75f6487338deebc94c15633945b69f1 100644
--- a/ui/base/win/open_file_name_win_unittest.cc
+++ b/ui/base/win/open_file_name_win_unittest.cc
@@ -121,11 +121,24 @@ TEST(OpenFileNameTest, SetInitialSelection) {
EXPECT_EQ(base::FilePath(), base::FilePath(ofn.GetOPENFILENAME()->lpstrFile));
}
-TEST(OpenFileNameTest, GetSingleResult) {
- const base::string16 kNull(L"\0", 1);
+TEST(OpenFileNameTest, GetSingleResultFromSingleSelect) {
ui::win::OpenFileName ofn(kHwnd, kFlags);
base::FilePath result;
+ SetResult(L"C:\\dir\\file", &ofn);
+ result = ofn.GetSingleResult();
+ EXPECT_EQ(base::FilePath(L"C:\\dir\\file"), result);
+
+ SetResult(L"", &ofn);
+ result = ofn.GetSingleResult();
+ EXPECT_EQ(base::FilePath(), result);
+}
+
+TEST(OpenFileNameTest, GetSingleResultFromMultiSelect) {
+ const base::string16 kNull(L"\0", 1);
+ ui::win::OpenFileName ofn(kHwnd, kFlags | OFN_ALLOWMULTISELECT);
+ base::FilePath result;
+
SetResult(L"C:\\dir\\file" + kNull, &ofn);
result = ofn.GetSingleResult();
EXPECT_EQ(base::FilePath(L"C:\\dir\\file"), result);
@@ -146,7 +159,7 @@ TEST(OpenFileNameTest, GetSingleResult) {
TEST(OpenFileNameTest, GetResult) {
const base::string16 kNull(L"\0", 1);
- ui::win::OpenFileName ofn(kHwnd, kFlags);
+ ui::win::OpenFileName ofn(kHwnd, kFlags | OFN_ALLOWMULTISELECT);
base::FilePath directory;
std::vector<base::FilePath> filenames;
« no previous file with comments | « ui/base/win/open_file_name_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698