| 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 "apps/saved_files_service.h" | 5 #include "apps/saved_files_service.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 void AddSavedEntry(const base::FilePath& path_to_save, | 52 void AddSavedEntry(const base::FilePath& path_to_save, |
| 53 bool is_directory, | 53 bool is_directory, |
| 54 apps::SavedFilesService* service, | 54 apps::SavedFilesService* service, |
| 55 const Extension* extension) { | 55 const Extension* extension) { |
| 56 service->RegisterFileEntry( | 56 service->RegisterFileEntry( |
| 57 extension->id(), "magic id", path_to_save, is_directory); | 57 extension->id(), "magic id", path_to_save, is_directory); |
| 58 } | 58 } |
| 59 | 59 |
| 60 #if defined(OS_WIN) || defined(OS_POSIX) | 60 const int kGraylistedPath = base::DIR_HOME; |
| 61 #if defined(OS_WIN) | |
| 62 const int kGraylistedPath = base::DIR_PROFILE; | |
| 63 #elif defined(OS_POSIX) | |
| 64 const int kGraylistedPath = base::DIR_HOME; | |
| 65 #endif | |
| 66 #endif | |
| 67 | 61 |
| 68 } // namespace | 62 } // namespace |
| 69 | 63 |
| 70 class FileSystemApiTest : public PlatformAppBrowserTest { | 64 class FileSystemApiTest : public PlatformAppBrowserTest { |
| 71 public: | 65 public: |
| 72 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 66 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 73 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 67 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 74 test_root_folder_ = test_data_dir_.AppendASCII("api_test") | 68 test_root_folder_ = test_data_dir_.AppendASCII("api_test") |
| 75 .AppendASCII("file_system"); | 69 .AppendASCII("file_system"); |
| 76 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 70 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { | 144 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { |
| 151 base::FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); | 145 base::FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); |
| 152 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 146 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 153 &test_file); | 147 &test_file); |
| 154 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) | 148 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) |
| 155 << message_; | 149 << message_; |
| 156 } | 150 } |
| 157 | 151 |
| 158 #if defined(OS_WIN) || defined(OS_POSIX) | 152 #if defined(OS_WIN) || defined(OS_POSIX) |
| 159 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { | 153 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { |
| 160 #if defined(OS_WIN) | 154 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(base::DIR_HOME, |
| 161 int override = base::DIR_PROFILE; | |
| 162 #elif defined(OS_POSIX) | |
| 163 int override = base::DIR_HOME; | |
| 164 #endif | |
| 165 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(override, | |
| 166 test_root_folder_, false)); | 155 test_root_folder_, false)); |
| 167 | 156 |
| 168 base::FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); | 157 base::FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); |
| 169 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 158 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 170 &test_file); | 159 &test_file); |
| 171 ASSERT_TRUE(RunPlatformAppTest( | 160 ASSERT_TRUE(RunPlatformAppTest( |
| 172 "api_test/file_system/get_display_path_prettify")) << message_; | 161 "api_test/file_system/get_display_path_prettify")) << message_; |
| 173 } | 162 } |
| 174 #endif | 163 #endif |
| 175 | 164 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 AppInstallObserver observer( | 626 AppInstallObserver observer( |
| 638 base::Bind(AddSavedEntry, | 627 base::Bind(AddSavedEntry, |
| 639 test_directory, | 628 test_directory, |
| 640 true, | 629 true, |
| 641 apps::SavedFilesService::Get(profile()))); | 630 apps::SavedFilesService::Get(profile()))); |
| 642 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/restore_directory")) | 631 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/restore_directory")) |
| 643 << message_; | 632 << message_; |
| 644 } | 633 } |
| 645 | 634 |
| 646 } // namespace extensions | 635 } // namespace extensions |
| OLD | NEW |