| 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/local_file_change_tracker.h" | 5 #include "webkit/browser/fileapi/syncable/local_file_change_tracker.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 using webkit_blob::MockBlobURLRequestContext; | 29 using webkit_blob::MockBlobURLRequestContext; |
| 30 using webkit_blob::ScopedTextBlob; | 30 using webkit_blob::ScopedTextBlob; |
| 31 | 31 |
| 32 namespace sync_file_system { | 32 namespace sync_file_system { |
| 33 | 33 |
| 34 class LocalFileChangeTrackerTest : public testing::Test { | 34 class LocalFileChangeTrackerTest : public testing::Test { |
| 35 public: | 35 public: |
| 36 LocalFileChangeTrackerTest() | 36 LocalFileChangeTrackerTest() |
| 37 : message_loop_(base::MessageLoop::TYPE_IO), | 37 : message_loop_(base::MessageLoop::TYPE_IO), |
| 38 file_system_(GURL("http://example.com"), | 38 file_system_(GURL("http://example.com"), |
| 39 "test", | |
| 40 base::MessageLoopProxy::current(), | 39 base::MessageLoopProxy::current(), |
| 41 base::MessageLoopProxy::current()) {} | 40 base::MessageLoopProxy::current()) {} |
| 42 | 41 |
| 43 virtual void SetUp() OVERRIDE { | 42 virtual void SetUp() OVERRIDE { |
| 44 file_system_.SetUp(); | 43 file_system_.SetUp(); |
| 45 | 44 |
| 46 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), | 45 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), |
| 47 base::MessageLoopProxy::current()); | 46 base::MessageLoopProxy::current()); |
| 48 ASSERT_EQ( | 47 ASSERT_EQ( |
| 49 sync_file_system::SYNC_STATUS_OK, | 48 sync_file_system::SYNC_STATUS_OK, |
| 50 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); | 49 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); |
| 51 } | 50 } |
| 52 | 51 |
| 53 virtual void TearDown() OVERRIDE { | 52 virtual void TearDown() OVERRIDE { |
| 54 if (sync_context_.get()) | 53 if (sync_context_.get()) |
| 55 sync_context_->ShutdownOnUIThread(); | 54 sync_context_->ShutdownOnUIThread(); |
| 56 sync_context_ = NULL; | 55 sync_context_ = NULL; |
| 57 | 56 |
| 58 message_loop_.RunUntilIdle(); | 57 message_loop_.RunUntilIdle(); |
| 59 file_system_.TearDown(); | 58 file_system_.TearDown(); |
| 60 // Make sure we don't leave the external filesystem. | 59 // Make sure we don't leave the external filesystem. |
| 61 // (CannedSyncableFileSystem::TearDown does not do this as there may be | 60 // (CannedSyncableFileSystem::TearDown does not do this as there may be |
| 62 // multiple syncable file systems registered for the name) | 61 // multiple syncable file systems registered for the name) |
| 63 RevokeSyncableFileSystem("test"); | 62 RevokeSyncableFileSystem(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 protected: | 65 protected: |
| 67 FileSystemURL URL(const std::string& path) { | 66 FileSystemURL URL(const std::string& path) { |
| 68 return file_system_.URL(path); | 67 return file_system_.URL(path); |
| 69 } | 68 } |
| 70 | 69 |
| 71 FileSystemContext* file_system_context() { | 70 FileSystemContext* file_system_context() { |
| 72 return file_system_.file_system_context(); | 71 return file_system_.file_system_context(); |
| 73 } | 72 } |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 ASSERT_EQ(2U, urls_to_process.size()); | 593 ASSERT_EQ(2U, urls_to_process.size()); |
| 595 | 594 |
| 596 // The exact order of recursive removal cannot be determined. | 595 // The exact order of recursive removal cannot be determined. |
| 597 EXPECT_TRUE(URL(kPath1) == urls_to_process[0] || | 596 EXPECT_TRUE(URL(kPath1) == urls_to_process[0] || |
| 598 URL(kPath2) == urls_to_process[0]); | 597 URL(kPath2) == urls_to_process[0]); |
| 599 EXPECT_TRUE(URL(kPath1) == urls_to_process[1] || | 598 EXPECT_TRUE(URL(kPath1) == urls_to_process[1] || |
| 600 URL(kPath2) == urls_to_process[1]); | 599 URL(kPath2) == urls_to_process[1]); |
| 601 } | 600 } |
| 602 | 601 |
| 603 } // namespace sync_file_system | 602 } // namespace sync_file_system |
| OLD | NEW |