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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_apitest.cc

Issue 10692105: Updates file type selector for fileSystem API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Now with a basic test Created 8 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
Index: chrome/browser/extensions/api/file_system/file_system_apitest.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest.cc b/chrome/browser/extensions/api/file_system/file_system_apitest.cc
index 0bc334da3a5cf8df4fe9f09d813f275b431ab32d..8f51b9a511351502b9c2f399d04ebb379e0b6b0d 100644
--- a/chrome/browser/extensions/api/file_system/file_system_apitest.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_apitest.cc
@@ -202,3 +202,27 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) {
ASSERT_TRUE(RunPlatformAppTest(
"api_test/file_system/is_writable_file_entry")) << message_;
}
+
+// TODO(thorogood): Not really a browser test, but this is the easiest way to
benwells 2012/07/26 05:40:45 This should be a unit test, not a browser test
thorogood 2012/07/26 07:39:05 Done.
+// quickly define it alongside our other tests.
+IN_PROC_BROWSER_TEST_F(FileSystemApiTest,
+ FileSystemChooseFileFunctionFileTypeInfoTest) {
+ // AcceptsAllTypes is ignored when no other extensions are available.
+ scoped_ptr<SelectFileDialog::FileTypeInfo> file_type_info(
+ new SelectFileDialog::FileTypeInfo());
+ bool acceptsAllTypes = false;
+ FileSystemChooseFileFunction::BuildFileTypeInfo(file_type_info.get(),
+ NULL, &acceptsAllTypes);
+ EXPECT_TRUE(file_type_info->include_all_files);
+ EXPECT_TRUE(file_type_info->extensions.empty());
+
+ // Test grouping of multiple types.
+ file_type_info.reset(new SelectFileDialog::FileTypeInfo());
+ std::vector<std::string> accepts;
+ accepts.push_back(".jso,application/x-chrome-extension");
+ acceptsAllTypes = false;
+ FileSystemChooseFileFunction::BuildFileTypeInfo(file_type_info.get(),
+ &accepts, &acceptsAllTypes);
+ EXPECT_FALSE(file_type_info->include_all_files);
+ EXPECT_EQ(file_type_info->extensions.size(), (size_t) 1);
+}

Powered by Google App Engine
This is Rietveld 408576698