// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/safe_browsing/content/browser/safe_browsing_navigation_observer_manager_util.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "testing/gtest/include/gtest/gtest.h" namespace safe_browsing { // Before: // Gesture(0) -> Gesture(1) -> NonGesture(2..11) -> Gesture(12) // After: // Gesture(0) -> Gesture(1) -> NonGesture(2..5) -> Empty(6..8) -> // NonGesture(9..11) -> Gesture(12) TEST(SBNavigationObserverManagerUtilTest, RemoveMiddleNonUserGestureEntries) { … } TEST(SBNavigationObserverManagerUtilTest, DoNotRemoveMiddleNonUserGestureEntriesIfLengthIsLessThanMaxAllowed) { … } // Before: // Gesture(0) -> NonGesture(1...4) -> Gesture(5) -> NonGesture(6...9) -> // Gesture(10) -> NonGesture(11...12) After: Gesture(0) -> NonGesture(1...2) -> // Empty(3) -> NonGesture(4) -> Gesture(5) -> NonGesture(6) -> Empty(7...8) -> // NonGesture(8..9) -> Gesture(10) -> NonGesture(11...12) TEST(SBNavigationObserverManagerUtilTest, RemoveNonConsecutiveMiddleNonUserGestureEntries) { … } // Before: // Gesture(0) -> NonGesture(1) -> Gesture(2) -> NG(3) -> G(4) -> NG(5) -> G(6) // -> NG(7) -> G(8) After: Gesture(0) -> NonGesture(1) -> Gesture(2) -> E(3) -> // G(4) -> E(5) -> G(6) -> E(7) -> G(8) TEST(SBNavigationObserverManagerUtilTest, RemoveNonMiddleNonUserGestureEntries) { … } // Before: // NonGesture(0) -> Gesture(1) -> NonGesture(2) -> G(3) -> NG(4) -> G(5) -> // NG(6) -> G(7) -> NG(8) After: NonGesture(0) -> Gesture(1) -> E(2) -> G(3) -> // E(4) -> G(5) -> E(6) -> G(7) -> NG(8) TEST(SBNavigationObserverManagerUtilTest, RemoveNonMiddleNonUserGestureEntriesWithClientRedirectStart) { … } } // namespace safe_browsing