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

Side by Side Diff: chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc

Issue 23578026: Use SNAPSHOT sync mode for LocalSync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/sync_file_system/syncable_file_system_util.h" 5 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
6 6
7 #include "base/files/scoped_temp_dir.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
9 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
10 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" 11 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
11 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" 12 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "webkit/browser/fileapi/external_mount_points.h" 14 #include "webkit/browser/fileapi/external_mount_points.h"
14 #include "webkit/common/fileapi/file_system_types.h" 15 #include "webkit/common/fileapi/file_system_types.h"
15 16
16 using fileapi::ExternalMountPoints; 17 using fileapi::ExternalMountPoints;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 EXPECT_FALSE(DeserializeSyncableFileSystemURL( 109 EXPECT_FALSE(DeserializeSyncableFileSystemURL(
109 non_syncable_url, &deserialized)); 110 non_syncable_url, &deserialized));
110 111
111 RevokeSyncableFileSystem(); 112 RevokeSyncableFileSystem();
112 } 113 }
113 114
114 TEST(SyncableFileSystemUtilTest, SerializeBeforeOpenFileSystem) { 115 TEST(SyncableFileSystemUtilTest, SerializeBeforeOpenFileSystem) {
115 ScopedEnableSyncFSDirectoryOperation enable_directory_operation_; 116 ScopedEnableSyncFSDirectoryOperation enable_directory_operation_;
116 const std::string serialized = kSyncableFileSystemRootURI + 117 const std::string serialized = kSyncableFileSystemRootURI +
117 CreateNormalizedFilePath(kPath).AsUTF8Unsafe(); 118 CreateNormalizedFilePath(kPath).AsUTF8Unsafe();
119 base::ScopedTempDir dir;
118 FileSystemURL deserialized; 120 FileSystemURL deserialized;
119 base::MessageLoop message_loop; 121 base::MessageLoop message_loop;
120 122
123 ASSERT_TRUE(dir.CreateUniqueTempDir());
124
121 // Setting up a full syncable filesystem environment. 125 // Setting up a full syncable filesystem environment.
122 CannedSyncableFileSystem file_system(GURL(kOrigin), 126 CannedSyncableFileSystem file_system(GURL(kOrigin),
123 base::MessageLoopProxy::current().get(), 127 base::MessageLoopProxy::current().get(),
124 base::MessageLoopProxy::current().get()); 128 base::MessageLoopProxy::current().get());
125 file_system.SetUp(); 129 file_system.SetUp();
126 scoped_refptr<LocalFileSyncContext> sync_context = 130 scoped_refptr<LocalFileSyncContext> sync_context =
127 new LocalFileSyncContext(base::MessageLoopProxy::current().get(), 131 new LocalFileSyncContext(dir.path(),
132 base::MessageLoopProxy::current().get(),
128 base::MessageLoopProxy::current().get()); 133 base::MessageLoopProxy::current().get());
129 134
130 // Before calling initialization we would not be able to get a valid 135 // Before calling initialization we would not be able to get a valid
131 // deserialized URL. 136 // deserialized URL.
132 EXPECT_FALSE(DeserializeSyncableFileSystemURL(serialized, &deserialized)); 137 EXPECT_FALSE(DeserializeSyncableFileSystemURL(serialized, &deserialized));
133 EXPECT_FALSE(deserialized.is_valid()); 138 EXPECT_FALSE(deserialized.is_valid());
134 139
135 ASSERT_EQ(sync_file_system::SYNC_STATUS_OK, 140 ASSERT_EQ(sync_file_system::SYNC_STATUS_OK,
136 file_system.MaybeInitializeFileSystemContext(sync_context.get())); 141 file_system.MaybeInitializeFileSystemContext(sync_context.get()));
137 142
(...skipping 30 matching lines...) Expand all
168 // False case: different origin. 173 // False case: different origin.
169 EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent( 174 EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent(
170 CreateFileSystemURL(root2 + child))); 175 CreateFileSystemURL(root2 + child)));
171 EXPECT_FALSE(CreateFileSystemURL(root2 + parent).IsParent( 176 EXPECT_FALSE(CreateFileSystemURL(root2 + parent).IsParent(
172 CreateFileSystemURL(root1 + child))); 177 CreateFileSystemURL(root1 + child)));
173 178
174 RevokeSyncableFileSystem(); 179 RevokeSyncableFileSystem();
175 } 180 }
176 181
177 } // namespace sync_file_system 182 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698