| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/internal_api/sync_rollback_manager_base.h" | 5 #include "sync/internal_api/sync_rollback_manager_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "sync/internal_api/public/read_node.h" | 8 #include "sync/internal_api/public/read_node.h" |
| 9 #include "sync/internal_api/public/read_transaction.h" | 9 #include "sync/internal_api/public/read_transaction.h" |
| 10 #include "sync/internal_api/public/test/test_internal_components_factory.h" | 10 #include "sync/internal_api/public/test/test_internal_components_factory.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace syncer { | 14 namespace syncer { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 void OnConfigDone(bool success) { | 18 void OnConfigDone(bool success) { |
| 19 EXPECT_TRUE(success); | 19 EXPECT_TRUE(success); |
| 20 } | 20 } |
| 21 | 21 |
| 22 class SyncTestRollbackManager : public SyncRollbackManagerBase { | 22 class SyncTestRollbackManager : public SyncRollbackManagerBase { |
| 23 public: | 23 public: |
| 24 virtual void Init(InitArgs* args) OVERRIDE { | 24 virtual void Init(InitArgs* args) override { |
| 25 SyncRollbackManagerBase::InitInternal( | 25 SyncRollbackManagerBase::InitInternal( |
| 26 args->database_location, | 26 args->database_location, |
| 27 args->internal_components_factory.get(), | 27 args->internal_components_factory.get(), |
| 28 InternalComponentsFactory::STORAGE_IN_MEMORY, | 28 InternalComponentsFactory::STORAGE_IN_MEMORY, |
| 29 args->unrecoverable_error_handler.Pass(), | 29 args->unrecoverable_error_handler.Pass(), |
| 30 args->report_unrecoverable_error_function); | 30 args->report_unrecoverable_error_function); |
| 31 } | 31 } |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class SyncRollbackManagerBaseTest : public testing::Test { | 34 class SyncRollbackManagerBaseTest : public testing::Test { |
| 35 protected: | 35 protected: |
| 36 virtual void SetUp() OVERRIDE { | 36 virtual void SetUp() override { |
| 37 SyncManager::InitArgs args; | 37 SyncManager::InitArgs args; |
| 38 args.database_location = base::FilePath(base::FilePath::kCurrentDirectory); | 38 args.database_location = base::FilePath(base::FilePath::kCurrentDirectory); |
| 39 args.service_url = GURL("https://example.com/"); | 39 args.service_url = GURL("https://example.com/"); |
| 40 args.internal_components_factory.reset(new TestInternalComponentsFactory( | 40 args.internal_components_factory.reset(new TestInternalComponentsFactory( |
| 41 InternalComponentsFactory::Switches(), | 41 InternalComponentsFactory::Switches(), |
| 42 InternalComponentsFactory::STORAGE_IN_MEMORY, | 42 InternalComponentsFactory::STORAGE_IN_MEMORY, |
| 43 &storage_used_)); | 43 &storage_used_)); |
| 44 manager_.Init(&args); | 44 manager_.Init(&args); |
| 45 EXPECT_EQ(InternalComponentsFactory::STORAGE_IN_MEMORY, storage_used_); | 45 EXPECT_EQ(InternalComponentsFactory::STORAGE_IN_MEMORY, storage_used_); |
| 46 } | 46 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 75 EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD, | 75 EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD, |
| 76 bookmark_mobile.InitByTagLookupForBookmarks("synced_bookmarks")); | 76 bookmark_mobile.InitByTagLookupForBookmarks("synced_bookmarks")); |
| 77 ReadNode bookmark_other(&trans); | 77 ReadNode bookmark_other(&trans); |
| 78 EXPECT_EQ(BaseNode::INIT_OK, | 78 EXPECT_EQ(BaseNode::INIT_OK, |
| 79 bookmark_other.InitByTagLookupForBookmarks("other_bookmarks")); | 79 bookmark_other.InitByTagLookupForBookmarks("other_bookmarks")); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // anonymous namespace | 82 } // anonymous namespace |
| 83 | 83 |
| 84 } // namespace syncer | 84 } // namespace syncer |
| OLD | NEW |