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

Unified Diff: chrome/browser/sync/sessions/sync_session_unittest.cc

Issue 5939006: sync: beginnings of MessageLoop based SyncerThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 10 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/sessions/sync_session_unittest.cc
diff --git a/chrome/browser/sync/sessions/sync_session_unittest.cc b/chrome/browser/sync/sessions/sync_session_unittest.cc
index 32156bd0b83d2e7b9bd6792c7af8d0f525c84a42..24c45592723335864dccafec9fc4555ebb188d2e 100644
--- a/chrome/browser/sync/sessions/sync_session_unittest.cc
+++ b/chrome/browser/sync/sessions/sync_session_unittest.cc
@@ -30,7 +30,7 @@ class SyncSessionTest : public testing::Test,
SyncSession* MakeSession() {
return new SyncSession(context_.get(), this, SyncSourceInfo(), routes_,
std::vector<ModelSafeWorker*>());
- }
+ }
virtual void SetUp() {
context_.reset(new SyncSessionContext(NULL, NULL, this,
@@ -38,10 +38,10 @@ class SyncSessionTest : public testing::Test,
routes_.clear();
routes_[syncable::BOOKMARKS] = GROUP_UI;
routes_[syncable::AUTOFILL] = GROUP_UI;
- session_.reset(MakeSession());
+ session_ = MakeSession();
}
virtual void TearDown() {
- session_.reset();
+ session_ = NULL;
context_.reset();
}
@@ -93,7 +93,7 @@ class SyncSessionTest : public testing::Test,
}
bool controller_invocations_allowed_;
- scoped_ptr<SyncSession> session_;
+ scoped_refptr<SyncSession> session_;
scoped_ptr<SyncSessionContext> context_;
ModelSafeRoutingInfo routes_;
};
@@ -111,16 +111,16 @@ TEST_F(SyncSessionTest, ScopedContextHelpers) {
TEST_F(SyncSessionTest, SetWriteTransaction) {
TestDirectorySetterUpper db;
db.SetUp();
- session_.reset(NULL);
+ session_ = NULL;
context_.reset(new SyncSessionContext(NULL, db.manager(), this,
std::vector<SyncEngineEventListener*>()));
- session_.reset(MakeSession());
+ session_ = MakeSession();
context_->set_account_name(db.name());
syncable::ScopedDirLookup dir(context_->directory_manager(),
context_->account_name());
ASSERT_TRUE(dir.good());
- scoped_ptr<SyncSession> session(MakeSession());
+ scoped_refptr<SyncSession> session(MakeSession());
EXPECT_TRUE(NULL == session->write_transaction());
{
WriteTransaction trans(dir, syncable::UNITTEST, __FILE__, __LINE__);
@@ -228,7 +228,6 @@ TEST_F(SyncSessionTest, MoreToDownloadIfGotTimestampAndEntries) {
EXPECT_FALSE(session_->HasMoreToSync());
}
-
TEST_F(SyncSessionTest, MoreToSyncIfConflictsResolved) {
// Conflict resolution happens after get updates and commit,
// so we need to loop back and get updates / commit again now
@@ -237,6 +236,20 @@ TEST_F(SyncSessionTest, MoreToSyncIfConflictsResolved) {
EXPECT_TRUE(session_->HasMoreToSync());
}
+TEST_F(SyncSessionTest, ResetTransientState) {
+ status()->update_conflicts_resolved(true);
+ status()->increment_num_successful_commits();
+ EXPECT_TRUE(session_->HasMoreToSync());
+ session_->ResetTransientState();
+ EXPECT_FALSE(status()->conflicts_resolved());
+ EXPECT_FALSE(session_->HasMoreToSync());
+ EXPECT_FALSE(status()->TestAndClearIsDirty());
+}
+
+TEST_F(SyncSessionTest, Coalesce) {
+
+}
+
} // namespace
} // namespace sessions
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698