| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/sessions/sync_session.h" | 5 #include "chrome/browser/sync/sessions/sync_session.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/sync/engine/conflict_resolver.h" | 10 #include "chrome/browser/sync/engine/conflict_resolver.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 GetModelSafeRoutingInfo(&routes_); | 30 GetModelSafeRoutingInfo(&routes_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 SyncSession* MakeSession() { | 33 SyncSession* MakeSession() { |
| 34 return new SyncSession(context_.get(), this, SyncSourceInfo(), routes_, | 34 return new SyncSession(context_.get(), this, SyncSourceInfo(), routes_, |
| 35 std::vector<ModelSafeWorker*>()); | 35 std::vector<ModelSafeWorker*>()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void SetUp() { | 38 virtual void SetUp() { |
| 39 context_.reset(new SyncSessionContext(NULL, NULL, this, | 39 context_.reset(new SyncSessionContext(NULL, NULL, this, |
| 40 std::vector<SyncEngineEventListener*>(), NULL)); | 40 std::vector<SyncEngineEventListener*>())); |
| 41 routes_.clear(); | 41 routes_.clear(); |
| 42 routes_[syncable::BOOKMARKS] = GROUP_UI; | 42 routes_[syncable::BOOKMARKS] = GROUP_UI; |
| 43 routes_[syncable::AUTOFILL] = GROUP_UI; | 43 routes_[syncable::AUTOFILL] = GROUP_UI; |
| 44 session_.reset(MakeSession()); | 44 session_.reset(MakeSession()); |
| 45 } | 45 } |
| 46 virtual void TearDown() { | 46 virtual void TearDown() { |
| 47 session_.reset(); | 47 session_.reset(); |
| 48 context_.reset(); | 48 context_.reset(); |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 EXPECT_EQ(&resolver, context_->resolver()); | 115 EXPECT_EQ(&resolver, context_->resolver()); |
| 116 } | 116 } |
| 117 EXPECT_FALSE(context_->resolver()); | 117 EXPECT_FALSE(context_->resolver()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 TEST_F(SyncSessionTest, SetWriteTransaction) { | 120 TEST_F(SyncSessionTest, SetWriteTransaction) { |
| 121 TestDirectorySetterUpper db; | 121 TestDirectorySetterUpper db; |
| 122 db.SetUp(); | 122 db.SetUp(); |
| 123 session_.reset(); | 123 session_.reset(); |
| 124 context_.reset(new SyncSessionContext(NULL, db.manager(), this, | 124 context_.reset(new SyncSessionContext(NULL, db.manager(), this, |
| 125 std::vector<SyncEngineEventListener*>(), NULL)); | 125 std::vector<SyncEngineEventListener*>())); |
| 126 session_.reset(MakeSession()); | 126 session_.reset(MakeSession()); |
| 127 context_->set_account_name(db.name()); | 127 context_->set_account_name(db.name()); |
| 128 syncable::ScopedDirLookup dir(context_->directory_manager(), | 128 syncable::ScopedDirLookup dir(context_->directory_manager(), |
| 129 context_->account_name()); | 129 context_->account_name()); |
| 130 ASSERT_TRUE(dir.good()); | 130 ASSERT_TRUE(dir.good()); |
| 131 | 131 |
| 132 scoped_ptr<SyncSession> session(MakeSession()); | 132 scoped_ptr<SyncSession> session(MakeSession()); |
| 133 EXPECT_TRUE(NULL == session->write_transaction()); | 133 EXPECT_TRUE(NULL == session->write_transaction()); |
| 134 { | 134 { |
| 135 WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir); | 135 WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); | 476 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); |
| 477 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); | 477 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); |
| 478 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); | 478 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); |
| 479 EXPECT_EQ(payload2, original[syncable::SESSIONS]); | 479 EXPECT_EQ(payload2, original[syncable::SESSIONS]); |
| 480 EXPECT_EQ(payload3, original[syncable::THEMES]); | 480 EXPECT_EQ(payload3, original[syncable::THEMES]); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace | 483 } // namespace |
| 484 } // namespace sessions | 484 } // namespace sessions |
| 485 } // namespace browser_sync | 485 } // namespace browser_sync |
| OLD | NEW |