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

Unified Diff: Source/core/html/forms/FileInputTypeTest.cpp

Issue 640723006: Pass the selected non-native file information from the browser to FileInputType. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed. Created 6 years, 2 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 | « Source/core/html/forms/FileInputType.cpp ('k') | Source/platform/FileChooser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/FileInputTypeTest.cpp
diff --git a/Source/core/html/forms/FileInputTypeTest.cpp b/Source/core/html/forms/FileInputTypeTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..68da534f7c627d7d89da12d9c6fe0e883d7ec499
--- /dev/null
+++ b/Source/core/html/forms/FileInputTypeTest.cpp
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "FileInputType.h"
+
+#include "core/fileapi/FileList.h"
+#include <gtest/gtest.h>
+
+namespace blink {
+
+TEST(FileInputTypeTest, createFileList)
+{
+ Vector<FileChooserFileInfo> files;
+
+ // Natvie file.
+ files.append(FileChooserFileInfo(
+ "/native/path/native-file",
+ "display-name"));
+
+ // Non-native file.
+ KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/non-native-file");
+ FileMetadata metadata;
+ metadata.length = 64;
+ metadata.modificationTime = 24 * 60 * 60 /* sec */;
+ files.append(FileChooserFileInfo(url, metadata));
+
+
+ FileList* list = FileInputType::createFileList(files, false);
+ ASSERT_TRUE(list);
+ ASSERT_EQ(2u, list->length());
+
+ EXPECT_EQ("/native/path/native-file", list->item(0)->path());
+ EXPECT_EQ("display-name", list->item(0)->name());
+ EXPECT_TRUE(list->item(0)->fileSystemURL().isEmpty());
+
+ EXPECT_TRUE(list->item(1)->path().isEmpty());
+ EXPECT_EQ("non-native-file", list->item(1)->name());
+ EXPECT_EQ(url, list->item(1)->fileSystemURL());
+ EXPECT_EQ(64u, list->item(1)->size());
+ EXPECT_EQ(24 * 60 * 60 * 1000 /* ms */, list->item(1)->lastModified());
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/html/forms/FileInputType.cpp ('k') | Source/platform/FileChooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698