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 "chrome/browser/extensions/api/file_system/file_system_api.h" | 7 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
7 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 8 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
8 | 9 |
9 using extensions::FileSystemChooseFileFunction; | 10 using extensions::FileSystemChooseFileFunction; |
10 | 11 |
11 class FileSystemApiTest : public PlatformAppBrowserTest { | 12 class FileSystemApiTest : public PlatformAppBrowserTest { |
12 public: | 13 public: |
13 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 14 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
14 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 15 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
15 test_root_folder_ = test_data_dir_.AppendASCII("api_test") | 16 test_root_folder_ = test_data_dir_.AppendASCII("api_test") |
(...skipping 24 matching lines...) Expand all Loading... |
40 }; | 41 }; |
41 | 42 |
42 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { | 43 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { |
43 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); | 44 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); |
44 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 45 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
45 &test_file); | 46 &test_file); |
46 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) | 47 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) |
47 << message_; | 48 << message_; |
48 } | 49 } |
49 | 50 |
| 51 #if defined(OS_WIN) |
| 52 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { |
| 53 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(base::DIR_PROFILE, |
| 54 test_root_folder_, false)); |
| 55 |
| 56 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); |
| 57 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 58 &test_file); |
| 59 ASSERT_TRUE(RunPlatformAppTest( |
| 60 "api_test/file_system/get_display_path_prettify")) << message_; |
| 61 } |
| 62 #endif |
| 63 |
50 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { | 64 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { |
51 FilePath test_file = TempFilePath("open_existing.txt", true); | 65 FilePath test_file = TempFilePath("open_existing.txt", true); |
52 ASSERT_FALSE(test_file.empty()); | 66 ASSERT_FALSE(test_file.empty()); |
53 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 67 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
54 &test_file); | 68 &test_file); |
55 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing")) | 69 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing")) |
56 << message_; | 70 << message_; |
57 } | 71 } |
58 | 72 |
59 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, | 73 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 181 |
168 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, | 182 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, |
169 FileSystemApiGetWritableWithWriteTest) { | 183 FileSystemApiGetWritableWithWriteTest) { |
170 FilePath test_file = TempFilePath("writable.txt", true); | 184 FilePath test_file = TempFilePath("writable.txt", true); |
171 ASSERT_FALSE(test_file.empty()); | 185 ASSERT_FALSE(test_file.empty()); |
172 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 186 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
173 &test_file); | 187 &test_file); |
174 ASSERT_TRUE(RunPlatformAppTest( | 188 ASSERT_TRUE(RunPlatformAppTest( |
175 "api_test/file_system/get_writable_file_entry_with_write")) << message_; | 189 "api_test/file_system/get_writable_file_entry_with_write")) << message_; |
176 } | 190 } |
177 | |
OLD | NEW |