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 #include "components/history/core/browser/history_backend.h" | 5 #include "components/history/core/browser/history_backend.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
20 #include "base/files/scoped_temp_dir.h" | 20 #include "base/files/scoped_temp_dir.h" |
21 #include "base/macros.h" | 21 #include "base/macros.h" |
22 #include "base/memory/ref_counted.h" | 22 #include "base/memory/ref_counted.h" |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/metrics/histogram_base.h" | 24 #include "base/metrics/histogram_base.h" |
25 #include "base/metrics/histogram_samples.h" | 25 #include "base/metrics/histogram_samples.h" |
26 #include "base/metrics/statistics_recorder.h" | 26 #include "base/metrics/statistics_recorder.h" |
27 #include "base/prefs/pref_service.h" | |
28 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
29 #include "base/strings/string16.h" | 28 #include "base/strings/string16.h" |
30 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
31 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
32 #include "base/test/histogram_tester.h" | 31 #include "base/test/histogram_tester.h" |
33 #include "base/thread_task_runner_handle.h" | 32 #include "base/thread_task_runner_handle.h" |
34 #include "build/build_config.h" | 33 #include "build/build_config.h" |
35 #include "components/favicon_base/favicon_usage_data.h" | 34 #include "components/favicon_base/favicon_usage_data.h" |
36 #include "components/history/core/browser/history_backend_client.h" | 35 #include "components/history/core/browser/history_backend_client.h" |
37 #include "components/history/core/browser/history_constants.h" | 36 #include "components/history/core/browser/history_constants.h" |
38 #include "components/history/core/browser/history_database_params.h" | 37 #include "components/history/core/browser/history_database_params.h" |
39 #include "components/history/core/browser/history_service.h" | 38 #include "components/history/core/browser/history_service.h" |
40 #include "components/history/core/browser/history_service_observer.h" | 39 #include "components/history/core/browser/history_service_observer.h" |
41 #include "components/history/core/browser/in_memory_database.h" | 40 #include "components/history/core/browser/in_memory_database.h" |
42 #include "components/history/core/browser/in_memory_history_backend.h" | 41 #include "components/history/core/browser/in_memory_history_backend.h" |
43 #include "components/history/core/browser/keyword_search_term.h" | 42 #include "components/history/core/browser/keyword_search_term.h" |
44 #include "components/history/core/browser/visit_delegate.h" | 43 #include "components/history/core/browser/visit_delegate.h" |
45 #include "components/history/core/browser/visit_filter.h" | 44 #include "components/history/core/browser/visit_filter.h" |
46 #include "components/history/core/test/database_test_utils.h" | 45 #include "components/history/core/test/database_test_utils.h" |
47 #include "components/history/core/test/history_client_fake_bookmarks.h" | 46 #include "components/history/core/test/history_client_fake_bookmarks.h" |
48 #include "components/history/core/test/test_history_database.h" | 47 #include "components/history/core/test/test_history_database.h" |
| 48 #include "components/prefs/pref_service.h" |
49 #include "testing/gmock/include/gmock/gmock.h" | 49 #include "testing/gmock/include/gmock/gmock.h" |
50 #include "testing/gtest/include/gtest/gtest.h" | 50 #include "testing/gtest/include/gtest/gtest.h" |
51 #include "third_party/skia/include/core/SkBitmap.h" | 51 #include "third_party/skia/include/core/SkBitmap.h" |
52 #include "ui/gfx/codec/png_codec.h" | 52 #include "ui/gfx/codec/png_codec.h" |
53 #include "url/gurl.h" | 53 #include "url/gurl.h" |
54 | 54 |
55 // This file only tests functionality where it is most convenient to call the | 55 // This file only tests functionality where it is most convenient to call the |
56 // backend directly. Most of the history backend functions are tested by the | 56 // backend directly. Most of the history backend functions are tested by the |
57 // history unit test. Because of the elaborate callbacks involved, this is no | 57 // history unit test. Because of the elaborate callbacks involved, this is no |
58 // harder than calling it directly for many things. | 58 // harder than calling it directly for many things. |
(...skipping 3831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3890 // Verify that the second term is no longer returned as result, and also check | 3890 // Verify that the second term is no longer returned as result, and also check |
3891 // at the low level that it is gone for good. The term corresponding to the | 3891 // at the low level that it is gone for good. The term corresponding to the |
3892 // first URLRow should not be affected. | 3892 // first URLRow should not be affected. |
3893 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3893 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
3894 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3894 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
3895 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3895 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
3896 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3896 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
3897 } | 3897 } |
3898 | 3898 |
3899 } // namespace history | 3899 } // namespace history |
OLD | NEW |