OLD | NEW |
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 "webkit/browser/fileapi/syncable/syncable_file_system_util.h" | 5 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 TEST(SyncableFileSystemUtilTest, SerializeBeforeOpenFileSystem) { | 114 TEST(SyncableFileSystemUtilTest, SerializeBeforeOpenFileSystem) { |
115 const std::string serialized = kSyncableFileSystemRootURI + | 115 const std::string serialized = kSyncableFileSystemRootURI + |
116 CreateNormalizedFilePath(kPath).AsUTF8Unsafe(); | 116 CreateNormalizedFilePath(kPath).AsUTF8Unsafe(); |
117 FileSystemURL deserialized; | 117 FileSystemURL deserialized; |
118 base::MessageLoop message_loop; | 118 base::MessageLoop message_loop; |
119 | 119 |
120 // Setting up a full syncable filesystem environment. | 120 // Setting up a full syncable filesystem environment. |
121 CannedSyncableFileSystem file_system(GURL(kOrigin), | 121 CannedSyncableFileSystem file_system(GURL(kOrigin), |
122 base::MessageLoopProxy::current(), | 122 base::MessageLoopProxy::current().get(), |
123 base::MessageLoopProxy::current()); | 123 base::MessageLoopProxy::current().get()); |
124 file_system.SetUp(); | 124 file_system.SetUp(); |
125 scoped_refptr<LocalFileSyncContext> sync_context = | 125 scoped_refptr<LocalFileSyncContext> sync_context = |
126 new LocalFileSyncContext(base::MessageLoopProxy::current(), | 126 new LocalFileSyncContext(base::MessageLoopProxy::current().get(), |
127 base::MessageLoopProxy::current()); | 127 base::MessageLoopProxy::current().get()); |
128 | 128 |
129 // Before calling initialization we would not be able to get a valid | 129 // Before calling initialization we would not be able to get a valid |
130 // deserialized URL. | 130 // deserialized URL. |
131 EXPECT_FALSE(DeserializeSyncableFileSystemURL(serialized, &deserialized)); | 131 EXPECT_FALSE(DeserializeSyncableFileSystemURL(serialized, &deserialized)); |
132 EXPECT_FALSE(deserialized.is_valid()); | 132 EXPECT_FALSE(deserialized.is_valid()); |
133 | 133 |
134 ASSERT_EQ(sync_file_system::SYNC_STATUS_OK, | 134 ASSERT_EQ(sync_file_system::SYNC_STATUS_OK, |
135 file_system.MaybeInitializeFileSystemContext(sync_context.get())); | 135 file_system.MaybeInitializeFileSystemContext(sync_context.get())); |
136 | 136 |
137 // After initialization this should be ok (even before opening the file | 137 // After initialization this should be ok (even before opening the file |
(...skipping 29 matching lines...) Expand all Loading... |
167 // False case: different origin. | 167 // False case: different origin. |
168 EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent( | 168 EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent( |
169 CreateFileSystemURL(root2 + child))); | 169 CreateFileSystemURL(root2 + child))); |
170 EXPECT_FALSE(CreateFileSystemURL(root2 + parent).IsParent( | 170 EXPECT_FALSE(CreateFileSystemURL(root2 + parent).IsParent( |
171 CreateFileSystemURL(root1 + child))); | 171 CreateFileSystemURL(root1 + child))); |
172 | 172 |
173 RevokeSyncableFileSystem(); | 173 RevokeSyncableFileSystem(); |
174 } | 174 } |
175 | 175 |
176 } // namespace sync_file_system | 176 } // namespace sync_file_system |
OLD | NEW |