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 "base/threading/thread_restrictions.h" |
8 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
9 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
10 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
11 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
12 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
13 #include "extensions/browser/extension_prefs.h" | 14 #include "extensions/browser/extension_prefs.h" |
14 #include "extensions/browser/notification_types.h" | 15 #include "extensions/browser/notification_types.h" |
15 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
16 #include "extensions/test/extension_test_message_listener.h" | 17 #include "extensions/test/extension_test_message_listener.h" |
17 | 18 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ready_listener.Reset(); | 108 ready_listener.Reset(); |
108 ASSERT_TRUE(ready_listener.WaitUntilSatisfied()); | 109 ASSERT_TRUE(ready_listener.WaitUntilSatisfied()); |
109 ready_listener.Reply("exit"); | 110 ready_listener.Reply("exit"); |
110 } | 111 } |
111 | 112 |
112 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { | 113 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { |
113 content::WindowedNotificationObserver extension_suspended( | 114 content::WindowedNotificationObserver extension_suspended( |
114 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 115 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
115 content::NotificationService::AllSources()); | 116 content::NotificationService::AllSources()); |
116 | 117 |
| 118 base::ThreadRestrictions::ScopedAllowIO allow_io; |
117 base::ScopedTempDir temp_directory; | 119 base::ScopedTempDir temp_directory; |
118 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 120 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
119 base::FilePath temp_file; | 121 base::FilePath temp_file; |
120 ASSERT_TRUE( | 122 ASSERT_TRUE( |
121 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); | 123 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); |
122 | 124 |
123 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 125 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
124 &temp_file); | 126 &temp_file); |
125 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 127 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
126 "temp", temp_directory.GetPath()); | 128 "temp", temp_directory.GetPath()); |
(...skipping 20 matching lines...) Expand all Loading... |
147 #define MAYBE_FileAccessIsRestored DISABLED_FileAccessIsRestored | 149 #define MAYBE_FileAccessIsRestored DISABLED_FileAccessIsRestored |
148 #else | 150 #else |
149 #define MAYBE_FileAccessIsRestored FileAccessIsRestored | 151 #define MAYBE_FileAccessIsRestored FileAccessIsRestored |
150 #endif | 152 #endif |
151 | 153 |
152 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { | 154 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { |
153 content::WindowedNotificationObserver extension_suspended( | 155 content::WindowedNotificationObserver extension_suspended( |
154 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 156 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
155 content::NotificationService::AllSources()); | 157 content::NotificationService::AllSources()); |
156 | 158 |
| 159 base::ThreadRestrictions::ScopedAllowIO allow_io; |
157 base::ScopedTempDir temp_directory; | 160 base::ScopedTempDir temp_directory; |
158 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 161 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
159 base::FilePath temp_file; | 162 base::FilePath temp_file; |
160 ASSERT_TRUE( | 163 ASSERT_TRUE( |
161 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); | 164 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); |
162 | 165 |
163 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 166 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
164 &temp_file); | 167 &temp_file); |
165 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( | 168 FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( |
166 "temp", temp_directory.GetPath()); | 169 "temp", temp_directory.GetPath()); |
(...skipping 21 matching lines...) Expand all Loading... |
188 extension->id(), it->id, it->path, it->is_directory); | 191 extension->id(), it->id, it->path, it->is_directory); |
189 } | 192 } |
190 | 193 |
191 apps::AppRestoreServiceFactory::GetForBrowserContext(browser()->profile()) | 194 apps::AppRestoreServiceFactory::GetForBrowserContext(browser()->profile()) |
192 ->HandleStartup(true); | 195 ->HandleStartup(true); |
193 | 196 |
194 access_ok_listener.WaitUntilSatisfied(); | 197 access_ok_listener.WaitUntilSatisfied(); |
195 } | 198 } |
196 | 199 |
197 } // namespace apps | 200 } // namespace apps |
OLD | NEW |