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

Unified Diff: chrome/browser/sync/syncable/syncable_unittest.cc

Issue 7033043: [Sync] Speed up sync node browser/search in about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/syncable/syncable_unittest.cc
diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc
index c09b66bbd50f7f08b925006d43efd06f352d2b17..adb22de825c9ea008cec450f4ec8c00cc7a93252 100644
--- a/chrome/browser/sync/syncable/syncable_unittest.cc
+++ b/chrome/browser/sync/syncable/syncable_unittest.cc
@@ -47,6 +47,8 @@ namespace syncable {
class SyncableKernelTest : public testing::Test {};
+// TODO(akalin): Add unit tests for EntryKernel::ContainsString().
+
TEST_F(SyncableKernelTest, ToValue) {
EntryKernel kernel;
scoped_ptr<DictionaryValue> value(kernel.ToValue());
@@ -105,6 +107,14 @@ TEST_F(SyncableGeneralTest, General) {
Directory dir;
dir.Open(db_path_, "SimpleTest");
+ int64 root_metahandle;
+ {
+ ReadTransaction rtrans(&dir, __FILE__, __LINE__);
+ Entry e(&rtrans, GET_BY_ID, rtrans.root_id());
+ ASSERT_TRUE(e.good());
+ root_metahandle = e.Get(META_HANDLE);
+ }
+
int64 written_metahandle;
const Id id = TestIdFactory::FromNumber(99);
std::string name = "Jeff";
@@ -115,7 +125,10 @@ TEST_F(SyncableGeneralTest, General) {
ASSERT_FALSE(e.good()); // Hasn't been written yet.
Directory::ChildHandles child_handles;
- dir.GetChildHandles(&rtrans, rtrans.root_id(), &child_handles);
+ dir.GetChildHandlesById(&rtrans, rtrans.root_id(), &child_handles);
+ EXPECT_TRUE(child_handles.empty());
+
+ dir.GetChildHandlesByHandle(&rtrans, root_metahandle, &child_handles);
EXPECT_TRUE(child_handles.empty());
}
@@ -129,7 +142,7 @@ TEST_F(SyncableGeneralTest, General) {
written_metahandle = me.Get(META_HANDLE);
}
- // Test GetChildHandles after something is now in the DB.
+ // Test GetChildHandles* after something is now in the DB.
// Also check that GET_BY_ID works.
{
ReadTransaction rtrans(&dir, __FILE__, __LINE__);
@@ -137,7 +150,15 @@ TEST_F(SyncableGeneralTest, General) {
ASSERT_TRUE(e.good());
Directory::ChildHandles child_handles;
- dir.GetChildHandles(&rtrans, rtrans.root_id(), &child_handles);
+ dir.GetChildHandlesById(&rtrans, rtrans.root_id(), &child_handles);
+ EXPECT_EQ(1u, child_handles.size());
+
+ for (Directory::ChildHandles::iterator i = child_handles.begin();
+ i != child_handles.end(); ++i) {
+ EXPECT_EQ(*i, written_metahandle);
+ }
+
+ dir.GetChildHandlesByHandle(&rtrans, root_metahandle, &child_handles);
EXPECT_EQ(1u, child_handles.size());
for (Directory::ChildHandles::iterator i = child_handles.begin();

Powered by Google App Engine
This is Rietveld 408576698