| OLD | NEW | 
|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 | 8 | 
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" | 
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" | 
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" | 
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" | 
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" | 
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" | 
| 15 #include "sql/connection.h" | 15 #include "sql/connection.h" | 
| 16 #include "sql/statement.h" | 16 #include "sql/statement.h" | 
| 17 #include "sync/base/sync_export.h" | 17 #include "sync/base/sync_export.h" | 
| 18 #include "sync/internal_api/public/base/node_ordinal.h" | 18 #include "sync/internal_api/public/base/node_ordinal.h" | 
| 19 #include "sync/protocol/bookmark_specifics.pb.h" | 19 #include "sync/protocol/bookmark_specifics.pb.h" | 
| 20 #include "sync/protocol/sync.pb.h" | 20 #include "sync/protocol/sync.pb.h" | 
|  | 21 #include "sync/syncable/directory.h" | 
| 21 #include "sync/syncable/directory_backing_store.h" | 22 #include "sync/syncable/directory_backing_store.h" | 
| 22 #include "sync/syncable/on_disk_directory_backing_store.h" | 23 #include "sync/syncable/on_disk_directory_backing_store.h" | 
| 23 #include "sync/syncable/syncable-inl.h" | 24 #include "sync/syncable/syncable-inl.h" | 
| 24 #include "sync/test/test_directory_backing_store.h" | 25 #include "sync/test/test_directory_backing_store.h" | 
| 25 #include "sync/util/time.h" | 26 #include "sync/util/time.h" | 
| 26 #include "testing/gtest/include/gtest/gtest-param-test.h" | 27 #include "testing/gtest/include/gtest/gtest-param-test.h" | 
| 27 | 28 | 
| 28 namespace syncer { | 29 namespace syncer { | 
| 29 namespace syncable { | 30 namespace syncable { | 
| 30 | 31 | 
| (...skipping 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3959 TEST_F(DirectoryBackingStoreTest, GenerateCacheGUID) { | 3960 TEST_F(DirectoryBackingStoreTest, GenerateCacheGUID) { | 
| 3960   const std::string& guid1 = TestDirectoryBackingStore::GenerateCacheGUID(); | 3961   const std::string& guid1 = TestDirectoryBackingStore::GenerateCacheGUID(); | 
| 3961   const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); | 3962   const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); | 
| 3962   EXPECT_EQ(24U, guid1.size()); | 3963   EXPECT_EQ(24U, guid1.size()); | 
| 3963   EXPECT_EQ(24U, guid2.size()); | 3964   EXPECT_EQ(24U, guid2.size()); | 
| 3964   // In theory this test can fail, but it won't before the universe | 3965   // In theory this test can fail, but it won't before the universe | 
| 3965   // dies of heat death. | 3966   // dies of heat death. | 
| 3966   EXPECT_NE(guid1, guid2); | 3967   EXPECT_NE(guid1, guid2); | 
| 3967 } | 3968 } | 
| 3968 | 3969 | 
|  | 3970 TEST_F(DirectoryBackingStoreTest, IncreaseDatabasePageSizeFrom4KTo32K) { | 
|  | 3971   sql::Connection connection; | 
|  | 3972   ASSERT_TRUE(connection.Open(GetDatabasePath())); | 
|  | 3973 | 
|  | 3974   SetUpCurrentDatabaseAndCheckVersion(&connection); | 
|  | 3975   scoped_ptr<TestDirectoryBackingStore> dbs( | 
|  | 3976       new TestDirectoryBackingStore(GetUsername(), &connection)); | 
|  | 3977   Directory::MetahandlesMap handles_map; | 
|  | 3978   JournalIndex delete_journals; | 
|  | 3979   MetahandleSet metahandles_to_purge; | 
|  | 3980   Directory::KernelLoadInfo kernel_load_info; | 
|  | 3981   STLValueDeleter<Directory::MetahandlesMap> index_deleter(&handles_map); | 
|  | 3982 | 
|  | 3983   DirOpenResult open_result = dbs->Load( | 
|  | 3984       &handles_map, &delete_journals, &metahandles_to_purge, &kernel_load_info); | 
|  | 3985   EXPECT_EQ(open_result, OPENED); | 
|  | 3986 | 
|  | 3987   // Check if update is successful. | 
|  | 3988   int pageSize = 0; | 
|  | 3989   dbs->GetDatabasePageSize(&pageSize); | 
|  | 3990   EXPECT_TRUE(32768 != pageSize); | 
|  | 3991   dbs->db_->set_page_size(32768); | 
|  | 3992   dbs->IncreasePageSizeTo32K(); | 
|  | 3993   pageSize = 0; | 
|  | 3994   dbs->GetDatabasePageSize(&pageSize); | 
|  | 3995   EXPECT_EQ(32768, pageSize); | 
|  | 3996 } | 
|  | 3997 | 
| 3969 }  // namespace syncable | 3998 }  // namespace syncable | 
| 3970 }  // namespace syncer | 3999 }  // namespace syncer | 
| OLD | NEW | 
|---|