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

Side by Side Diff: Source/core/html/forms/FileInputTypeTest.cpp

Issue 882343002: Upgrade Blink to milliseconds-based last modified filetimes, part 5. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sof-fileinfo-modtime-in-ms-3
Patch Set: rebased Created 5 years, 10 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
« no previous file with comments | « Source/core/fileapi/File.cpp ('k') | Source/modules/filesystem/Metadata.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "FileInputType.h" 6 #include "FileInputType.h"
7 7
8 #include "core/clipboard/DataObject.h" 8 #include "core/clipboard/DataObject.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/fileapi/FileList.h" 10 #include "core/fileapi/FileList.h"
11 #include "core/html/HTMLInputElement.h" 11 #include "core/html/HTMLInputElement.h"
12 #include "core/page/DragData.h" 12 #include "core/page/DragData.h"
13 #include "wtf/DateMath.h" 13 #include "wtf/DateMath.h"
14 14
15 #include <gtest/gtest.h> 15 #include <gtest/gtest.h>
16 16
17 namespace blink { 17 namespace blink {
18 18
19 TEST(FileInputTypeTest, createFileList) 19 TEST(FileInputTypeTest, createFileList)
20 { 20 {
21 Vector<FileChooserFileInfo> files; 21 Vector<FileChooserFileInfo> files;
22 22
23 // Native file. 23 // Native file.
24 files.append(FileChooserFileInfo("/native/path/native-file", "display-name") ); 24 files.append(FileChooserFileInfo("/native/path/native-file", "display-name") );
25 25
26 // Non-native file. 26 // Non-native file.
27 KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/ non-native-file"); 27 KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/ non-native-file");
28 FileMetadata metadata; 28 FileMetadata metadata;
29 metadata.length = 64; 29 metadata.length = 64;
30 metadata.modificationTimeMS = 1.0 * msPerDay + 3; 30 metadata.modificationTime = 1.0 * msPerDay + 3;
31 files.append(FileChooserFileInfo(url, metadata)); 31 files.append(FileChooserFileInfo(url, metadata));
32 32
33 33
34 FileList* list = FileInputType::createFileList(files, false); 34 FileList* list = FileInputType::createFileList(files, false);
35 ASSERT_TRUE(list); 35 ASSERT_TRUE(list);
36 ASSERT_EQ(2u, list->length()); 36 ASSERT_EQ(2u, list->length());
37 37
38 EXPECT_EQ("/native/path/native-file", list->item(0)->path()); 38 EXPECT_EQ("/native/path/native-file", list->item(0)->path());
39 EXPECT_EQ("display-name", list->item(0)->name()); 39 EXPECT_EQ("display-name", list->item(0)->name());
40 EXPECT_TRUE(list->item(0)->fileSystemURL().isEmpty()); 40 EXPECT_TRUE(list->item(0)->fileSystemURL().isEmpty());
(...skipping 29 matching lines...) Expand all
70 nonNativeFileDragData.platformData()->add(File::createForFileSystemFile(url, metadata, File::IsUserVisible)); 70 nonNativeFileDragData.platformData()->add(File::createForFileSystemFile(url, metadata, File::IsUserVisible));
71 nonNativeFileDragData.platformData()->setFilesystemId("fileSystemId"); 71 nonNativeFileDragData.platformData()->setFilesystemId("fileSystemId");
72 fileInput->receiveDroppedFiles(&nonNativeFileDragData); 72 fileInput->receiveDroppedFiles(&nonNativeFileDragData);
73 // Dropping non-native files should not change the existing files. 73 // Dropping non-native files should not change the existing files.
74 EXPECT_EQ("fileSystemId", fileInput->droppedFileSystemId()); 74 EXPECT_EQ("fileSystemId", fileInput->droppedFileSystemId());
75 ASSERT_EQ(1u, fileInput->files()->length()); 75 ASSERT_EQ(1u, fileInput->files()->length());
76 EXPECT_EQ(String("/native/path"), fileInput->files()->item(0)->path()); 76 EXPECT_EQ(String("/native/path"), fileInput->files()->item(0)->path());
77 } 77 }
78 78
79 } // namespace blink 79 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/File.cpp ('k') | Source/modules/filesystem/Metadata.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698