Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { | 43 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { |
| 44 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); | 44 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); |
| 45 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 45 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 46 &test_file); | 46 &test_file); |
| 47 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) | 47 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) |
| 48 << message_; | 48 << message_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { | |
| 51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
| 52 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { | 53 int override = base::DIR_PROFILE; |
| 53 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(base::DIR_PROFILE, | 54 #elif defined(OS_POSIX) |
| 55 int override = base::DIR_HOME; | |
| 56 #endif | |
|
benwells
2012/07/10 23:57:49
Again, I don't like relying on OS_POSIX == !OS_WIN
thorogood
2012/07/11 00:30:24
I've guarded this test by a define again.
| |
| 57 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(override, | |
| 54 test_root_folder_, false)); | 58 test_root_folder_, false)); |
| 55 | 59 |
| 56 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); | 60 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); |
| 57 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 61 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 58 &test_file); | 62 &test_file); |
| 59 ASSERT_TRUE(RunPlatformAppTest( | 63 ASSERT_TRUE(RunPlatformAppTest( |
| 60 "api_test/file_system/get_display_path_prettify")) << message_; | 64 "api_test/file_system/get_display_path_prettify")) << message_; |
|
Mihai Parparita -not on Chrome
2012/07/11 00:21:10
Sorry for not catching this in the other review, b
thorogood
2012/07/11 04:07:45
Thanks for the insight! I've had a play with it, b
Mihai Parparita -not on Chrome
2012/07/11 05:32:28
Fair enough.
| |
| 61 } | 65 } |
| 62 #endif | |
| 63 | 66 |
| 64 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { | 67 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { |
| 65 FilePath test_file = TempFilePath("open_existing.txt", true); | 68 FilePath test_file = TempFilePath("open_existing.txt", true); |
| 66 ASSERT_FALSE(test_file.empty()); | 69 ASSERT_FALSE(test_file.empty()); |
| 67 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 70 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 68 &test_file); | 71 &test_file); |
| 69 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing")) | 72 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing")) |
| 70 << message_; | 73 << message_; |
| 71 } | 74 } |
| 72 | 75 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 | 184 |
| 182 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, | 185 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, |
| 183 FileSystemApiGetWritableWithWriteTest) { | 186 FileSystemApiGetWritableWithWriteTest) { |
| 184 FilePath test_file = TempFilePath("writable.txt", true); | 187 FilePath test_file = TempFilePath("writable.txt", true); |
| 185 ASSERT_FALSE(test_file.empty()); | 188 ASSERT_FALSE(test_file.empty()); |
| 186 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( | 189 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 187 &test_file); | 190 &test_file); |
| 188 ASSERT_TRUE(RunPlatformAppTest( | 191 ASSERT_TRUE(RunPlatformAppTest( |
| 189 "api_test/file_system/get_writable_file_entry_with_write")) << message_; | 192 "api_test/file_system/get_writable_file_entry_with_write")) << message_; |
| 190 } | 193 } |
| OLD | NEW |