// Copyright 2023 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/history_clusters/core/cluster_interaction_state_processor.h" #include <string> #include <vector> #include "base/run_loop.h" #include "base/test/task_environment.h" #include "components/history/core/browser/history_types.h" #include "components/history_clusters/core/clustering_test_utils.h" #include "components/history_clusters/core/config.h" #include "components/history_clusters/core/history_clusters_types.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace history_clusters { namespace { ElementsAre; UnorderedElementsAre; // Returns four clusters with following properties: // 1. Cluster 1 with a visits: that has search terms marked as hidden. // - visit 1: Search term: Hidden; Interaction state: Default. // - visit 2: Search term: Hidden; Interaction state: Default. // - visit 3: Search term: Hidden; Interaction state: Default. // 2. Cluster 2 with a visits: that has search terms marked as done and hidden. // - visit 4: Search term: Done; Interaction state: Default. // - visit 5: Search term: Show; Interaction state: Default. // - visit 6: Search term: Hidden; Interaction state: Default. // 3. Cluster 3 with visits: // - visit 7: Search term: Done; Interaction state: Done. // - visit 8: Search term: Hidden; Interaction state: Default. // - visit 9: Search term: Hidden; Interaction state: Default. // 4. Cluster 4 with visits: // - visit 10: Search term: Done; Interaction state: Default. // - visit 11: Search term: Hidden; Interaction state: Hidden. // - visit 12: Search term: Hidden; Interaction state: Default. std::vector<history::Cluster> GetTestClusters() { … } // Do not filter any clusters on interaction state. TEST(ClusterInteractionStateProcessorTest, NoInteractionStateFiltration) { … } // Filter all clusters with done visits or done search terms. i.e: Cluster 3 // should filter out Cluster 2 and 4 as well. TEST(ClusterInteractionStateProcessorTest, FilterClustersWithDoneStateVisits) { … } // Filter all visits marked hidden or with hidden search terms. i.e: Visit 11 // should filter out Visits 1,2,3,6,8,9,12. TEST(ClusterInteractionStateProcessorTest, FilterHiddenStateVisits) { … } // Filter both done and hidden states, should give empty clusters. TEST(ClusterInteractionStateProcessorTest, FilterBothDoneAndHiddenStateClusters) { … } } // namespace } // namespace history_clusters