| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 using base::ExpectDictBooleanValue; | 44 using base::ExpectDictBooleanValue; |
| 45 using base::ExpectDictStringValue; | 45 using base::ExpectDictStringValue; |
| 46 | 46 |
| 47 // An OnDiskDirectoryBackingStore that can be set to always fail SaveChanges. | 47 // An OnDiskDirectoryBackingStore that can be set to always fail SaveChanges. |
| 48 class TestBackingStore : public OnDiskDirectoryBackingStore { | 48 class TestBackingStore : public OnDiskDirectoryBackingStore { |
| 49 public: | 49 public: |
| 50 TestBackingStore(const std::string& dir_name, | 50 TestBackingStore(const std::string& dir_name, |
| 51 const base::FilePath& backing_filepath); | 51 const base::FilePath& backing_filepath); |
| 52 | 52 |
| 53 virtual ~TestBackingStore(); | 53 ~TestBackingStore() override; |
| 54 | 54 |
| 55 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot) | 55 bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot) override; |
| 56 override; | |
| 57 | 56 |
| 58 void StartFailingSaveChanges() { | 57 void StartFailingSaveChanges() { |
| 59 fail_save_changes_ = true; | 58 fail_save_changes_ = true; |
| 60 } | 59 } |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 bool fail_save_changes_; | 62 bool fail_save_changes_; |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 TestBackingStore::TestBackingStore(const std::string& dir_name, | 65 TestBackingStore::TestBackingStore(const std::string& dir_name, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 83 // A directory whose Save() function can be set to always fail. | 82 // A directory whose Save() function can be set to always fail. |
| 84 class TestDirectory : public Directory { | 83 class TestDirectory : public Directory { |
| 85 public: | 84 public: |
| 86 // A factory function used to work around some initialization order issues. | 85 // A factory function used to work around some initialization order issues. |
| 87 static TestDirectory* Create( | 86 static TestDirectory* Create( |
| 88 Encryptor *encryptor, | 87 Encryptor *encryptor, |
| 89 UnrecoverableErrorHandler *handler, | 88 UnrecoverableErrorHandler *handler, |
| 90 const std::string& dir_name, | 89 const std::string& dir_name, |
| 91 const base::FilePath& backing_filepath); | 90 const base::FilePath& backing_filepath); |
| 92 | 91 |
| 93 virtual ~TestDirectory(); | 92 ~TestDirectory() override; |
| 94 | 93 |
| 95 void StartFailingSaveChanges() { | 94 void StartFailingSaveChanges() { |
| 96 backing_store_->StartFailingSaveChanges(); | 95 backing_store_->StartFailingSaveChanges(); |
| 97 } | 96 } |
| 98 | 97 |
| 99 private: | 98 private: |
| 100 TestDirectory(Encryptor* encryptor, | 99 TestDirectory(Encryptor* encryptor, |
| 101 UnrecoverableErrorHandler* handler, | 100 UnrecoverableErrorHandler* handler, |
| 102 TestBackingStore* backing_store); | 101 TestBackingStore* backing_store); |
| 103 | 102 |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { | 667 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { |
| 669 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 668 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 670 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 669 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 671 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); | 670 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); |
| 672 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); | 671 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); |
| 673 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); | 672 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); |
| 674 } | 673 } |
| 675 | 674 |
| 676 } // namespace syncable | 675 } // namespace syncable |
| 677 } // namespace syncer | 676 } // namespace syncer |
| OLD | NEW |