| 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 "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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 } | 1660 } |
| 1661 std::string bad_data("BAD DATA"); | 1661 std::string bad_data("BAD DATA"); |
| 1662 EXPECT_TRUE(file_util::WriteFile(GetDatabasePath(), bad_data.data(), | 1662 EXPECT_TRUE(file_util::WriteFile(GetDatabasePath(), bad_data.data(), |
| 1663 bad_data.size())); | 1663 bad_data.size())); |
| 1664 { | 1664 { |
| 1665 scoped_ptr<DirectoryBackingStore> dbs( | 1665 scoped_ptr<DirectoryBackingStore> dbs( |
| 1666 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 1666 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
| 1667 | 1667 |
| 1668 // In release mode, we expect the sync database to nuke itself and start | 1668 // In release mode, we expect the sync database to nuke itself and start |
| 1669 // over if it detects invalid/corrupted data. | 1669 // over if it detects invalid/corrupted data. |
| 1670 #if defined(NDEBUG) | 1670 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
| 1671 EXPECT_TRUE(dbs->BeginLoad()); | 1671 EXPECT_TRUE(dbs->BeginLoad()); |
| 1672 #elif defined(NDEBUG) && defined(DCHECK_ALWAYS_ON) |
| 1673 EXPECT_DEATH(dbs->BeginLoad(), "stmt_"); |
| 1672 #else | 1674 #else |
| 1673 EXPECT_DEATH(dbs->BeginLoad(), "sqlite error"); | 1675 EXPECT_DEATH(dbs->BeginLoad(), "sqlite error"); |
| 1674 #endif | 1676 #endif |
| 1675 } | 1677 } |
| 1676 } | 1678 } |
| 1677 | 1679 |
| 1678 TEST_F(DirectoryBackingStoreTest, DeleteEntries) { | 1680 TEST_F(DirectoryBackingStoreTest, DeleteEntries) { |
| 1679 SetUpCurrentDatabaseAndCheckVersion(); | 1681 SetUpCurrentDatabaseAndCheckVersion(); |
| 1680 scoped_ptr<DirectoryBackingStore> dbs( | 1682 scoped_ptr<DirectoryBackingStore> dbs( |
| 1681 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 1683 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 | 1716 |
| 1715 STLDeleteElements(&index); | 1717 STLDeleteElements(&index); |
| 1716 dbs->LoadEntries(&index); | 1718 dbs->LoadEntries(&index); |
| 1717 EXPECT_EQ(0U, index.size()); | 1719 EXPECT_EQ(0U, index.size()); |
| 1718 | 1720 |
| 1719 dbs->EndLoad(); | 1721 dbs->EndLoad(); |
| 1720 dbs->EndSave(); | 1722 dbs->EndSave(); |
| 1721 } | 1723 } |
| 1722 | 1724 |
| 1723 } // namespace syncable | 1725 } // namespace syncable |
| OLD | NEW |