// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif // History unit tests come in two flavors: // // 1. The more complicated style is that the unit test creates a full history // service. This spawns a background thread for the history backend, and // all communication is asynchronous. This is useful for testing more // complicated things or end-to-end behavior. // // 2. The simpler style is to create a history backend on this thread and // access it directly without a HistoryService object. This is much simpler // because communication is synchronous. Generally, sets should go through // the history backend (since there is a lot of logic) but gets can come // directly from the HistoryDatabase. This is because the backend generally // has no logic in the getter except threading stuff, which we don't want // to run. #include <stddef.h> #include "components/history/core/browser/history_backend.h" #include "components/history/core/test/history_backend_db_base_test.h" namespace history { namespace { // This must be outside the anonymous namespace for the friend statement in // HistoryBackend to work. class ContentHistoryBackendDBTest : public HistoryBackendDBBaseTest { … }; struct InterruptReasonAssociation { … }; // Test is dependent on interrupt reasons being listed in header file // in order. const InterruptReasonAssociation current_reasons[] = …; // This represents a list of all reasons we've previously used; // Do Not Remove Any Entries From This List. const InterruptReasonAssociation historical_reasons[] = …; // Make sure no one has changed a DownloadInterruptReason we've previously // persisted. TEST_F(ContentHistoryBackendDBTest, ConfirmDownloadInterruptReasonBackwardsCompatible) { … } } // namespace } // namespace history