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

Side by Side Diff: sync/internal_api/sync_rollback_manager_base_unittest.cc

Issue 477813002: Revert of Let SyncBackupManager keep backup data in memory until shutdown. Only persist (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 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,
29 args->unrecoverable_error_handler.Pass(), 28 args->unrecoverable_error_handler.Pass(),
30 args->report_unrecoverable_error_function); 29 args->report_unrecoverable_error_function);
31 } 30 }
32 }; 31 };
33 32
34 class SyncRollbackManagerBaseTest : public testing::Test { 33 class SyncRollbackManagerBaseTest : public testing::Test {
35 protected: 34 protected:
36 virtual void SetUp() OVERRIDE { 35 virtual void SetUp() OVERRIDE {
37 SyncManager::InitArgs args; 36 SyncManager::InitArgs args;
38 args.database_location = base::FilePath(base::FilePath::kCurrentDirectory); 37 args.database_location = base::FilePath(base::FilePath::kCurrentDirectory);
39 args.service_url = GURL("https://example.com/"); 38 args.service_url = GURL("https://example.com/");
40 args.internal_components_factory.reset(new TestInternalComponentsFactory( 39 args.internal_components_factory.reset(new TestInternalComponentsFactory(
41 InternalComponentsFactory::Switches(), 40 InternalComponentsFactory::Switches(), STORAGE_IN_MEMORY));
42 InternalComponentsFactory::STORAGE_IN_MEMORY,
43 &storage_used_));
44 manager_.Init(&args); 41 manager_.Init(&args);
45 EXPECT_EQ(InternalComponentsFactory::STORAGE_IN_MEMORY, storage_used_);
46 } 42 }
47 43
48 SyncTestRollbackManager manager_; 44 SyncTestRollbackManager manager_;
49 base::MessageLoop loop_; // Needed for WeakHandle 45 base::MessageLoop loop_; // Needed for WeakHandle
50 InternalComponentsFactory::StorageOption storage_used_;
51 }; 46 };
52 47
53 TEST_F(SyncRollbackManagerBaseTest, InitTypeOnConfiguration) { 48 TEST_F(SyncRollbackManagerBaseTest, InitTypeOnConfiguration) {
54 EXPECT_TRUE(manager_.InitialSyncEndedTypes().Empty()); 49 EXPECT_TRUE(manager_.InitialSyncEndedTypes().Empty());
55 50
56 manager_.ConfigureSyncer( 51 manager_.ConfigureSyncer(
57 CONFIGURE_REASON_NEW_CLIENT, 52 CONFIGURE_REASON_NEW_CLIENT,
58 ModelTypeSet(PREFERENCES, BOOKMARKS), 53 ModelTypeSet(PREFERENCES, BOOKMARKS),
59 ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), ModelSafeRoutingInfo(), 54 ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), ModelSafeRoutingInfo(),
60 base::Bind(&OnConfigDone, true), 55 base::Bind(&OnConfigDone, true),
(...skipping 14 matching lines...) Expand all
75 EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD, 70 EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD,
76 bookmark_mobile.InitByTagLookupForBookmarks("synced_bookmarks")); 71 bookmark_mobile.InitByTagLookupForBookmarks("synced_bookmarks"));
77 ReadNode bookmark_other(&trans); 72 ReadNode bookmark_other(&trans);
78 EXPECT_EQ(BaseNode::INIT_OK, 73 EXPECT_EQ(BaseNode::INIT_OK,
79 bookmark_other.InitByTagLookupForBookmarks("other_bookmarks")); 74 bookmark_other.InitByTagLookupForBookmarks("other_bookmarks"));
80 } 75 }
81 76
82 } // anonymous namespace 77 } // anonymous namespace
83 78
84 } // namespace syncer 79 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_rollback_manager_base.cc ('k') | sync/internal_api/sync_rollback_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698