OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 7 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
8 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 8 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
9 | 9 |
10 using extensions::FileSystemChooseFileFunction; | 10 using extensions::FileSystemChooseFileFunction; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 } | 195 } |
196 | 196 |
197 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) { | 197 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) { |
198 FilePath test_file = TempFilePath("writable.txt", true); | 198 FilePath test_file = TempFilePath("writable.txt", true); |
199 ASSERT_FALSE(test_file.empty()); | 199 ASSERT_FALSE(test_file.empty()); |
200 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 200 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
201 &test_file); | 201 &test_file); |
202 ASSERT_TRUE(RunPlatformAppTest( | 202 ASSERT_TRUE(RunPlatformAppTest( |
203 "api_test/file_system/is_writable_file_entry")) << message_; | 203 "api_test/file_system/is_writable_file_entry")) << message_; |
204 } | 204 } |
205 | |
206 // 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.
| |
207 // quickly define it alongside our other tests. | |
208 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, | |
209 FileSystemChooseFileFunctionFileTypeInfoTest) { | |
210 // AcceptsAllTypes is ignored when no other extensions are available. | |
211 scoped_ptr<SelectFileDialog::FileTypeInfo> file_type_info( | |
212 new SelectFileDialog::FileTypeInfo()); | |
213 bool acceptsAllTypes = false; | |
214 FileSystemChooseFileFunction::BuildFileTypeInfo(file_type_info.get(), | |
215 NULL, &acceptsAllTypes); | |
216 EXPECT_TRUE(file_type_info->include_all_files); | |
217 EXPECT_TRUE(file_type_info->extensions.empty()); | |
218 | |
219 // Test grouping of multiple types. | |
220 file_type_info.reset(new SelectFileDialog::FileTypeInfo()); | |
221 std::vector<std::string> accepts; | |
222 accepts.push_back(".jso,application/x-chrome-extension"); | |
223 acceptsAllTypes = false; | |
224 FileSystemChooseFileFunction::BuildFileTypeInfo(file_type_info.get(), | |
225 &accepts, &acceptsAllTypes); | |
226 EXPECT_FALSE(file_type_info->include_all_files); | |
227 EXPECT_EQ(file_type_info->extensions.size(), (size_t) 1); | |
228 } | |
OLD | NEW |