| 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 // 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 25 matching lines...) Expand all Loading... |
| 36 #include "base/utf_string_conversions.h" | 36 #include "base/utf_string_conversions.h" |
| 37 #include "chrome/browser/history/history.h" | 37 #include "chrome/browser/history/history.h" |
| 38 #include "chrome/browser/history/history_backend.h" | 38 #include "chrome/browser/history/history_backend.h" |
| 39 #include "chrome/browser/history/history_database.h" | 39 #include "chrome/browser/history/history_database.h" |
| 40 #include "chrome/browser/history/history_notifications.h" | 40 #include "chrome/browser/history/history_notifications.h" |
| 41 #include "chrome/browser/history/in_memory_database.h" | 41 #include "chrome/browser/history/in_memory_database.h" |
| 42 #include "chrome/browser/history/in_memory_history_backend.h" | 42 #include "chrome/browser/history/in_memory_history_backend.h" |
| 43 #include "chrome/browser/history/page_usage_data.h" | 43 #include "chrome/browser/history/page_usage_data.h" |
| 44 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
| 45 #include "chrome/common/thumbnail_score.h" | 45 #include "chrome/common/thumbnail_score.h" |
| 46 #include "chrome/test/base/testing_browser_process_test.h" | |
| 47 #include "chrome/tools/profiles/thumbnail-inl.h" | 46 #include "chrome/tools/profiles/thumbnail-inl.h" |
| 48 #include "content/browser/download/download_item.h" | 47 #include "content/browser/download/download_item.h" |
| 49 #include "content/browser/download/download_persistent_store_info.h" | 48 #include "content/browser/download/download_persistent_store_info.h" |
| 50 #include "content/common/notification_details.h" | 49 #include "content/common/notification_details.h" |
| 51 #include "content/common/notification_source.h" | 50 #include "content/common/notification_source.h" |
| 52 #include "sql/connection.h" | 51 #include "sql/connection.h" |
| 53 #include "sql/statement.h" | 52 #include "sql/statement.h" |
| 54 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
| 55 #include "third_party/skia/include/core/SkBitmap.h" | 54 #include "third_party/skia/include/core/SkBitmap.h" |
| 56 #include "ui/gfx/codec/jpeg_codec.h" | 55 #include "ui/gfx/codec/jpeg_codec.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 virtual void BroadcastNotifications(int type, | 93 virtual void BroadcastNotifications(int type, |
| 95 HistoryDetails* details) OVERRIDE; | 94 HistoryDetails* details) OVERRIDE; |
| 96 virtual void DBLoaded() OVERRIDE {} | 95 virtual void DBLoaded() OVERRIDE {} |
| 97 virtual void StartTopSitesMigration() OVERRIDE {} | 96 virtual void StartTopSitesMigration() OVERRIDE {} |
| 98 private: | 97 private: |
| 99 HistoryTest* history_test_; | 98 HistoryTest* history_test_; |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 // This must be outside the anonymous namespace for the friend statement in | 101 // This must be outside the anonymous namespace for the friend statement in |
| 103 // HistoryBackend to work. | 102 // HistoryBackend to work. |
| 104 class HistoryTest : public TestingBrowserProcessTest { | 103 class HistoryTest : public testing::Test { |
| 105 public: | 104 public: |
| 106 HistoryTest() | 105 HistoryTest() |
| 107 : history_service_(NULL), | 106 : history_service_(NULL), |
| 108 got_thumbnail_callback_(false), | 107 got_thumbnail_callback_(false), |
| 109 redirect_query_success_(false), | 108 redirect_query_success_(false), |
| 110 query_url_success_(false), | 109 query_url_success_(false), |
| 111 db_(NULL) { | 110 db_(NULL) { |
| 112 } | 111 } |
| 113 ~HistoryTest() { | 112 ~HistoryTest() { |
| 114 } | 113 } |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 history_service_ = history; | 856 history_service_ = history; |
| 858 history->ScheduleDBTask(task.get(), &request_consumer); | 857 history->ScheduleDBTask(task.get(), &request_consumer); |
| 859 request_consumer.CancelAllRequests(); | 858 request_consumer.CancelAllRequests(); |
| 860 CleanupHistoryService(); | 859 CleanupHistoryService(); |
| 861 // WARNING: history has now been deleted. | 860 // WARNING: history has now been deleted. |
| 862 history = NULL; | 861 history = NULL; |
| 863 ASSERT_FALSE(task->done_invoked); | 862 ASSERT_FALSE(task->done_invoked); |
| 864 } | 863 } |
| 865 | 864 |
| 866 } // namespace history | 865 } // namespace history |
| OLD | NEW |