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

Unified Diff: chrome/browser/sync_file_system/syncable_file_system_util.cc

Issue 130913013: [SyncFS] Add ScopedEnableSyncFSV2 for testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 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
« no previous file with comments | « chrome/browser/sync_file_system/syncable_file_system_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/syncable_file_system_util.cc
diff --git a/chrome/browser/sync_file_system/syncable_file_system_util.cc b/chrome/browser/sync_file_system/syncable_file_system_util.cc
index 71872e7bb930a9a469f455874e04435f2046098b..16965200b29f8deb39e19e8968b5b7a0bda4cfc5 100644
--- a/chrome/browser/sync_file_system/syncable_file_system_util.cc
+++ b/chrome/browser/sync_file_system/syncable_file_system_util.cc
@@ -43,7 +43,9 @@ const base::FilePath::CharType kSyncFileSystemDir[] =
const base::FilePath::CharType kSyncFileSystemDirDev[] =
FILE_PATH_LITERAL("Sync FileSystem Dev");
-bool is_directory_operation_enabled = false;
+// Flags to enable features for testing.
+bool g_is_directory_operation_enabled = false;
+bool g_is_syncfs_v2_enabled = false;
} // namespace
@@ -119,7 +121,7 @@ bool DeserializeSyncableFileSystemURL(
}
void SetEnableSyncFSDirectoryOperation(bool flag) {
- is_directory_operation_enabled = flag;
+ g_is_directory_operation_enabled = flag;
}
bool IsSyncFSDirectoryOperationEnabled() {
@@ -127,14 +129,15 @@ bool IsSyncFSDirectoryOperationEnabled() {
}
bool IsSyncFSDirectoryOperationEnabled(const GURL& origin) {
- return is_directory_operation_enabled ||
+ return g_is_directory_operation_enabled ||
CommandLine::ForCurrentProcess()->HasSwitch(
kEnableSyncFSDirectoryOperation) ||
IsV2EnabledForOrigin(origin);
}
bool IsV2Enabled() {
- return CommandLine::ForCurrentProcess()->HasSwitch(kEnableSyncFileSystemV2);
+ return g_is_syncfs_v2_enabled ||
+ CommandLine::ForCurrentProcess()->HasSwitch(kEnableSyncFileSystemV2);
}
bool IsV2EnabledForOrigin(const GURL& origin) {
@@ -183,6 +186,16 @@ ScopedEnableSyncFSDirectoryOperation::~ScopedEnableSyncFSDirectoryOperation() {
SetEnableSyncFSDirectoryOperation(was_enabled_);
}
+ScopedEnableSyncFSV2::ScopedEnableSyncFSV2() {
+ was_enabled_ = IsV2Enabled();
+ g_is_syncfs_v2_enabled = true;
+}
+
+ScopedEnableSyncFSV2::~ScopedEnableSyncFSV2() {
+ DCHECK(IsV2Enabled());
+ g_is_syncfs_v2_enabled = was_enabled_;
+}
+
void RunSoon(const tracked_objects::Location& from_here,
const base::Closure& callback) {
base::MessageLoop::current()->PostTask(from_here, callback);
« no previous file with comments | « chrome/browser/sync_file_system/syncable_file_system_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698