Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: apps/app_restore_service_browsertest.cc

Issue 14607023: Add support for persistent file access in apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: apps/app_restore_service_browsertest.cc
diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc
index ce800a446d4ff3c2b65333c8ef290050b6608ef8..e6e2b72e63b35a0498a2b806bd1b463664325fb0 100644
--- a/apps/app_restore_service_browsertest.cc
+++ b/apps/app_restore_service_browsertest.cc
@@ -4,7 +4,7 @@
#include "apps/app_restore_service.h"
#include "apps/app_restore_service_factory.h"
-#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
+#include "apps/saved_files_service.h"
#include "chrome/browser/extensions/api/file_system/file_system_api.h"
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
@@ -12,7 +12,6 @@
#include "chrome/common/extensions/extension.h"
#include "content/public/test/test_utils.h"
-using extensions::app_file_handler_util::SavedFileEntry;
using extensions::Extension;
using extensions::ExtensionPrefs;
using extensions::ExtensionSystem;
@@ -78,21 +77,18 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) {
ASSERT_TRUE(extension);
file_written_listener.WaitUntilSatisfied();
- ExtensionPrefs* extension_prefs =
- ExtensionPrefs::Get(browser()->profile());
+ SavedFilesService* saved_files_service = SavedFilesService::Get(profile());
// Record the file entries in prefs because when the app gets suspended it
// will have them all cleared.
koz (OOO until 15th September) 2013/05/20 05:33:51 This comment is probably doing more harm than good
Sam McNally 2013/05/20 07:13:33 Done.
- std::vector<SavedFileEntry> file_entries;
- extensions::app_file_handler_util::GetSavedFileEntries(
- extension_prefs, extension->id(), &file_entries);
+ std::vector<SavedFileEntry> file_entries =
+ saved_files_service->GetAllFileEntries(extension->id());
// One for the read-only file entry and one for the writable file entry.
ASSERT_EQ(2u, file_entries.size());
extension_suspended.Wait();
file_entries.clear();
koz (OOO until 15th September) 2013/05/20 05:33:51 No need to clear file_entries here.
Sam McNally 2013/05/20 07:13:33 Done.
- extensions::app_file_handler_util::GetSavedFileEntries(
- extension_prefs, extension->id(), &file_entries);
+ file_entries = saved_files_service->GetAllFileEntries(extension->id());
// File entries should be cleared when the extension is suspended.
ASSERT_TRUE(file_entries.empty());
}
@@ -124,12 +120,11 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsRestored) {
ExtensionPrefs* extension_prefs =
ExtensionPrefs::Get(browser()->profile());
+ SavedFilesService* saved_files_service = SavedFilesService::Get(profile());
// Record the file entries in prefs because when the app gets suspended it
// will have them all cleared.
koz (OOO until 15th September) 2013/05/20 05:33:51 Same here.
Sam McNally 2013/05/20 07:13:33 Done.
- std::vector<SavedFileEntry> file_entries;
- extensions::app_file_handler_util::GetSavedFileEntries(extension_prefs,
- extension->id(),
- &file_entries);
+ std::vector<SavedFileEntry> file_entries =
+ saved_files_service->GetAllFileEntries(extension->id());
extension_suspended.Wait();
// Simulate a restart by populating the preferences as if the browser didn't
@@ -137,8 +132,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsRestored) {
extension_prefs->SetExtensionRunning(extension->id(), true);
for (std::vector<SavedFileEntry>::const_iterator it = file_entries.begin();
it != file_entries.end(); ++it) {
- extensions::app_file_handler_util::AddSavedFileEntry(
- extension_prefs, extension->id(), it->id, it->path, it->writable);
+ saved_files_service->RetainFileEntry(
+ extension->id(), it->id, it->path, it->writable);
}
apps::AppRestoreServiceFactory::GetForProfile(browser()->profile())->

Powered by Google App Engine
This is Rietveld 408576698