OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // History unit tests come in two flavors: | 5 // History unit tests come in two flavors: |
6 // | 6 // |
7 // 1. The more complicated style is that the unit test creates a full history | 7 // 1. The more complicated style is that the unit test creates a full history |
8 // service. This spawns a background thread for the history backend, and | 8 // service. This spawns a background thread for the history backend, and |
9 // all communication is asynchronous. This is useful for testing more | 9 // all communication is asynchronous. This is useful for testing more |
10 // complicated things or end-to-end behavior. | 10 // complicated things or end-to-end behavior. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 protected: | 62 protected: |
63 friend class BackendDelegate; | 63 friend class BackendDelegate; |
64 | 64 |
65 // testing::Test | 65 // testing::Test |
66 void SetUp() override { | 66 void SetUp() override { |
67 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 67 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
68 history_dir_ = temp_dir_.path().AppendASCII("HistoryServiceTest"); | 68 history_dir_ = temp_dir_.path().AppendASCII("HistoryServiceTest"); |
69 ASSERT_TRUE(base::CreateDirectory(history_dir_)); | 69 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
70 history_service_.reset(new history::HistoryService); | 70 history_service_.reset(new history::HistoryService); |
71 if (!history_service_->Init( | 71 if (!history_service_->Init( |
72 std::string(), TestHistoryDatabaseParamsForPath(history_dir_))) { | 72 TestHistoryDatabaseParamsForPath(history_dir_))) { |
73 history_service_.reset(); | 73 history_service_.reset(); |
74 ADD_FAILURE(); | 74 ADD_FAILURE(); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 void TearDown() override { | 78 void TearDown() override { |
79 if (history_service_) | 79 if (history_service_) |
80 CleanupHistoryService(); | 80 CleanupHistoryService(); |
81 | 81 |
82 // Make sure we don't have any event pending that could disrupt the next | 82 // Make sure we don't have any event pending that could disrupt the next |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 // Expect two sync changes for deleting processed directives. | 857 // Expect two sync changes for deleting processed directives. |
858 const syncer::SyncChangeList& sync_changes = change_processor.changes(); | 858 const syncer::SyncChangeList& sync_changes = change_processor.changes(); |
859 ASSERT_EQ(2u, sync_changes.size()); | 859 ASSERT_EQ(2u, sync_changes.size()); |
860 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[0].change_type()); | 860 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[0].change_type()); |
861 EXPECT_EQ(1, syncer::SyncDataRemote(sync_changes[0].sync_data()).GetId()); | 861 EXPECT_EQ(1, syncer::SyncDataRemote(sync_changes[0].sync_data()).GetId()); |
862 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[1].change_type()); | 862 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[1].change_type()); |
863 EXPECT_EQ(2, syncer::SyncDataRemote(sync_changes[1].sync_data()).GetId()); | 863 EXPECT_EQ(2, syncer::SyncDataRemote(sync_changes[1].sync_data()).GetId()); |
864 } | 864 } |
865 | 865 |
866 } // namespace history | 866 } // namespace history |
OLD | NEW |