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

Side by Side Diff: chrome/browser/sync/sessions/sync_session_unittest.cc

Issue 7190001: [Sync] Split DirectoryChangeListener for thread-safety (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copyright Created 9 years, 6 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 (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/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/tracked.h"
8 #include "chrome/browser/sync/engine/conflict_resolver.h" 9 #include "chrome/browser/sync/engine/conflict_resolver.h"
9 #include "chrome/browser/sync/engine/mock_model_safe_workers.h" 10 #include "chrome/browser/sync/engine/mock_model_safe_workers.h"
10 #include "chrome/browser/sync/engine/syncer_types.h" 11 #include "chrome/browser/sync/engine/syncer_types.h"
11 #include "chrome/browser/sync/engine/syncer_util.h" 12 #include "chrome/browser/sync/engine/syncer_util.h"
12 #include "chrome/browser/sync/syncable/directory_manager.h" 13 #include "chrome/browser/sync/syncable/directory_manager.h"
13 #include "chrome/browser/sync/syncable/model_type.h" 14 #include "chrome/browser/sync/syncable/model_type.h"
14 #include "chrome/browser/sync/syncable/syncable.h" 15 #include "chrome/browser/sync/syncable/syncable.h"
15 #include "chrome/test/sync/engine/test_directory_setter_upper.h" 16 #include "chrome/test/sync/engine/test_directory_setter_upper.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 std::vector<SyncEngineEventListener*>())); 117 std::vector<SyncEngineEventListener*>()));
117 session_.reset(MakeSession()); 118 session_.reset(MakeSession());
118 context_->set_account_name(db.name()); 119 context_->set_account_name(db.name());
119 syncable::ScopedDirLookup dir(context_->directory_manager(), 120 syncable::ScopedDirLookup dir(context_->directory_manager(),
120 context_->account_name()); 121 context_->account_name());
121 ASSERT_TRUE(dir.good()); 122 ASSERT_TRUE(dir.good());
122 123
123 scoped_ptr<SyncSession> session(MakeSession()); 124 scoped_ptr<SyncSession> session(MakeSession());
124 EXPECT_TRUE(NULL == session->write_transaction()); 125 EXPECT_TRUE(NULL == session->write_transaction());
125 { 126 {
126 WriteTransaction trans(dir, syncable::UNITTEST, __FILE__, __LINE__); 127 WriteTransaction trans(dir, syncable::UNITTEST, FROM_HERE);
127 sessions::ScopedSetSessionWriteTransaction set_trans(session.get(), &trans); 128 sessions::ScopedSetSessionWriteTransaction set_trans(session.get(), &trans);
128 EXPECT_TRUE(&trans == session->write_transaction()); 129 EXPECT_TRUE(&trans == session->write_transaction());
129 } 130 }
130 db.TearDown(); 131 db.TearDown();
131 } 132 }
132 133
133 TEST_F(SyncSessionTest, MoreToSyncIfUnsyncedGreaterThanCommitted) { 134 TEST_F(SyncSessionTest, MoreToSyncIfUnsyncedGreaterThanCommitted) {
134 // If any forward progress was made during the session, and the number of 135 // If any forward progress was made during the session, and the number of
135 // unsynced handles still exceeds the number of commit ids we added, there is 136 // unsynced handles still exceeds the number of commit ids we added, there is
136 // more to sync. For example, this occurs if we had more commit ids 137 // more to sync. For example, this occurs if we had more commit ids
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); 468 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]);
468 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); 469 EXPECT_EQ(payload1, original[syncable::PASSWORDS]);
469 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); 470 EXPECT_EQ(payload1, original[syncable::AUTOFILL]);
470 EXPECT_EQ(payload2, original[syncable::SESSIONS]); 471 EXPECT_EQ(payload2, original[syncable::SESSIONS]);
471 EXPECT_EQ(payload3, original[syncable::THEMES]); 472 EXPECT_EQ(payload3, original[syncable::THEMES]);
472 } 473 }
473 474
474 } // namespace 475 } // namespace
475 } // namespace sessions 476 } // namespace sessions
476 } // namespace browser_sync 477 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/browser/sync/syncable/directory_change_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698