OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 namespace history { | 51 namespace history { |
52 class HistoryTest; | 52 class HistoryTest; |
53 } | 53 } |
54 | 54 |
55 // Specialize RunnableMethodTraits for HistoryTest so we can create callbacks. | 55 // Specialize RunnableMethodTraits for HistoryTest so we can create callbacks. |
56 // None of these callbacks can outlast the test, so there is not need to retain | 56 // None of these callbacks can outlast the test, so there is not need to retain |
57 // the HistoryTest object. | 57 // the HistoryTest object. |
58 template <> | 58 template <> |
59 struct RunnableMethodTraits<history::HistoryTest> { | 59 struct RunnableMethodTraits<history::HistoryTest> { |
60 static void RetainCallee(history::HistoryTest* obj) { } | 60 void RetainCallee(history::HistoryTest* obj) { } |
61 static void ReleaseCallee(history::HistoryTest* obj) { } | 61 void ReleaseCallee(history::HistoryTest* obj) { } |
62 }; | 62 }; |
63 | 63 |
64 namespace history { | 64 namespace history { |
65 | 65 |
66 namespace { | 66 namespace { |
67 | 67 |
68 // Compares the two data values. Used for comparing thumbnail data. | 68 // Compares the two data values. Used for comparing thumbnail data. |
69 bool DataEqual(const unsigned char* reference, size_t reference_len, | 69 bool DataEqual(const unsigned char* reference, size_t reference_len, |
70 const std::vector<unsigned char>& data) { | 70 const std::vector<unsigned char>& data) { |
71 if (reference_len != data.size()) | 71 if (reference_len != data.size()) |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 history_service_ = history; | 836 history_service_ = history; |
837 history->ScheduleDBTask(task.get(), &request_consumer); | 837 history->ScheduleDBTask(task.get(), &request_consumer); |
838 request_consumer.CancelAllRequests(); | 838 request_consumer.CancelAllRequests(); |
839 CleanupHistoryService(); | 839 CleanupHistoryService(); |
840 // WARNING: history has now been deleted. | 840 // WARNING: history has now been deleted. |
841 history = NULL; | 841 history = NULL; |
842 ASSERT_FALSE(task->done_invoked); | 842 ASSERT_FALSE(task->done_invoked); |
843 } | 843 } |
844 | 844 |
845 } // namespace history | 845 } // namespace history |
OLD | NEW |