| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/app_restore_service.h" | 5 #include "apps/app_restore_service.h" |
| 6 #include "apps/app_restore_service_factory.h" | 6 #include "apps/app_restore_service_factory.h" |
| 7 #include "apps/saved_files_service.h" | 7 #include "apps/saved_files_service.h" |
| 8 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { | 58 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { |
| 59 content::WindowedNotificationObserver extension_suspended( | 59 content::WindowedNotificationObserver extension_suspended( |
| 60 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 60 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 61 content::NotificationService::AllSources()); | 61 content::NotificationService::AllSources()); |
| 62 | 62 |
| 63 base::ScopedTempDir temp_directory; | 63 base::ScopedTempDir temp_directory; |
| 64 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 64 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
| 65 base::FilePath temp_file; | 65 base::FilePath temp_file; |
| 66 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), | 66 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), |
| 67 &temp_file)); | 67 &temp_file)); |
| 68 | 68 |
| 69 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 69 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 70 &temp_file); | 70 &temp_file); |
| 71 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 71 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
| 72 "temp", temp_directory.path()); | 72 "temp", temp_directory.path()); |
| 73 | 73 |
| 74 ExtensionTestMessageListener file_written_listener("fileWritten", false); | 74 ExtensionTestMessageListener file_written_listener("fileWritten", false); |
| 75 ExtensionTestMessageListener access_ok_listener( | 75 ExtensionTestMessageListener access_ok_listener( |
| 76 "restartedFileAccessOK", false); | 76 "restartedFileAccessOK", false); |
| 77 | 77 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { | 103 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { |
| 104 content::WindowedNotificationObserver extension_suspended( | 104 content::WindowedNotificationObserver extension_suspended( |
| 105 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 105 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 106 content::NotificationService::AllSources()); | 106 content::NotificationService::AllSources()); |
| 107 | 107 |
| 108 base::ScopedTempDir temp_directory; | 108 base::ScopedTempDir temp_directory; |
| 109 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 109 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
| 110 base::FilePath temp_file; | 110 base::FilePath temp_file; |
| 111 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), | 111 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), |
| 112 &temp_file)); | 112 &temp_file)); |
| 113 | 113 |
| 114 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 114 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 115 &temp_file); | 115 &temp_file); |
| 116 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 116 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
| 117 "temp", temp_directory.path()); | 117 "temp", temp_directory.path()); |
| 118 | 118 |
| 119 ExtensionTestMessageListener file_written_listener("fileWritten", false); | 119 ExtensionTestMessageListener file_written_listener("fileWritten", false); |
| 120 ExtensionTestMessageListener access_ok_listener( | 120 ExtensionTestMessageListener access_ok_listener( |
| 121 "restartedFileAccessOK", false); | 121 "restartedFileAccessOK", false); |
| 122 | 122 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 141 extension->id(), it->id, it->path, it->is_directory); | 141 extension->id(), it->id, it->path, it->is_directory); |
| 142 } | 142 } |
| 143 | 143 |
| 144 apps::AppRestoreServiceFactory::GetForProfile(browser()->profile())-> | 144 apps::AppRestoreServiceFactory::GetForProfile(browser()->profile())-> |
| 145 HandleStartup(true); | 145 HandleStartup(true); |
| 146 | 146 |
| 147 access_ok_listener.WaitUntilSatisfied(); | 147 access_ok_listener.WaitUntilSatisfied(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace apps | 150 } // namespace apps |
| OLD | NEW |