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 "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 7 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
8 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 8 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 content::NotificationService::AllSources()); | 63 content::NotificationService::AllSources()); |
64 | 64 |
65 base::ScopedTempDir temp_directory; | 65 base::ScopedTempDir temp_directory; |
66 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 66 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
67 base::FilePath temp_file; | 67 base::FilePath temp_file; |
68 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), | 68 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), |
69 &temp_file)); | 69 &temp_file)); |
70 | 70 |
71 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 71 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
72 &temp_file); | 72 &temp_file); |
| 73 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
| 74 "temp", temp_directory.path()); |
73 | 75 |
74 ExtensionTestMessageListener file_written_listener("fileWritten", false); | 76 ExtensionTestMessageListener file_written_listener("fileWritten", false); |
75 ExtensionTestMessageListener access_ok_listener( | 77 ExtensionTestMessageListener access_ok_listener( |
76 "restartedFileAccessOK", false); | 78 "restartedFileAccessOK", false); |
77 | 79 |
78 const Extension* extension = | 80 const Extension* extension = |
79 LoadAndLaunchPlatformApp("file_access_saved_to_prefs_test"); | 81 LoadAndLaunchPlatformApp("file_access_saved_to_prefs_test"); |
80 ASSERT_TRUE(extension); | 82 ASSERT_TRUE(extension); |
81 file_written_listener.WaitUntilSatisfied(); | 83 file_written_listener.WaitUntilSatisfied(); |
82 | 84 |
(...skipping 21 matching lines...) Expand all Loading... |
104 content::NotificationService::AllSources()); | 106 content::NotificationService::AllSources()); |
105 | 107 |
106 base::ScopedTempDir temp_directory; | 108 base::ScopedTempDir temp_directory; |
107 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 109 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
108 base::FilePath temp_file; | 110 base::FilePath temp_file; |
109 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), | 111 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), |
110 &temp_file)); | 112 &temp_file)); |
111 | 113 |
112 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 114 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
113 &temp_file); | 115 &temp_file); |
| 116 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
| 117 "temp", temp_directory.path()); |
114 | 118 |
115 ExtensionTestMessageListener file_written_listener("fileWritten", false); | 119 ExtensionTestMessageListener file_written_listener("fileWritten", false); |
116 ExtensionTestMessageListener access_ok_listener( | 120 ExtensionTestMessageListener access_ok_listener( |
117 "restartedFileAccessOK", false); | 121 "restartedFileAccessOK", false); |
118 | 122 |
119 const Extension* extension = | 123 const Extension* extension = |
120 LoadAndLaunchPlatformApp("file_access_restored_test"); | 124 LoadAndLaunchPlatformApp("file_access_restored_test"); |
121 ASSERT_TRUE(extension); | 125 ASSERT_TRUE(extension); |
122 file_written_listener.WaitUntilSatisfied(); | 126 file_written_listener.WaitUntilSatisfied(); |
123 | 127 |
(...skipping 16 matching lines...) Expand all Loading... |
140 extension->id(), it->id, it->path, it->writable); | 144 extension->id(), it->id, it->path, it->writable); |
141 } | 145 } |
142 | 146 |
143 apps::AppRestoreServiceFactory::GetForProfile(browser()->profile())-> | 147 apps::AppRestoreServiceFactory::GetForProfile(browser()->profile())-> |
144 HandleStartup(true); | 148 HandleStartup(true); |
145 | 149 |
146 access_ok_listener.WaitUntilSatisfied(); | 150 access_ok_listener.WaitUntilSatisfied(); |
147 } | 151 } |
148 | 152 |
149 } // namespace apps | 153 } // namespace apps |
OLD | NEW |