[cr142] GetHistoryCount added 404 policy arg

The only use of this function is for a test, so 404s are being included
to keep as it was previously.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/50079edb8650e5dd22a8c90b90481d22d6dcd528

commit 50079edb8650e5dd22a8c90b90481d22d6dcd528
Author: Svend Larsen <svend@chromium.org>
Date:   Fri Sep 19 08:02:22 2025 -0700

    [VL] Let callers specify 404 policy in GetHistoryCount()

    404 visits have historically not been eligible for History, so callers
    of History querying methods have not needed to consider whether 404
    visits are relevant for their feature or not. In the future, when
    history::kVisitedLinksOn404 is enabled, 404s will become eligible for
    History, and therefore be countable by VisitDatabase::GetHistoryCount(),
    and by extension the HistoryBackend and HistoryService methods of the
    same name. Some callers of GetHistoryCount() do not want to receive 404
    visits, so this CL adds a policy_for_404_visits param to the method to
    allow callers to specify whether they want 404 visits to count.

    This CL is part of a larger project to make links `:visited` after a 404
    visit. Project links:
    - Google-internal project doc: go/stop-filtering-history-by-status-code
    - Issue tree / work status: https://crbug.com/427225439/dependencies

    Fixed: 441157315
    Change-Id: Ic9f5791339c68432a8a16b7acfc1027c4b07c88b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6962734
    Reviewed-by: Martin Šrámek <msramek@chromium.org>
    Reviewed-by: Ankush Singh <ankushkush@google.com>
    Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
    Reviewed-by: manuk hovanesian <manukh@chromium.org>
    Commit-Queue: Svend Larsen <svend@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1517953}
This commit is contained in:
Claudio DeSouza
2025-10-15 20:31:03 -04:00
committed by Emerick Rogul
parent 82b65c2d98
commit 2fc5a18652
@@ -171,6 +171,7 @@ class RequestOTRBrowserTestBase : public BaseLocalDataFilesBrowserTest {
history_service->GetHistoryCount(
/*begin_time=*/base::Time::UnixEpoch(),
/*end_time=*/base::Time::Now(),
history::VisitQuery404sPolicy::kInclude404s,
base::BindLambdaForTesting([&](history::HistoryCountResult result) {
ASSERT_TRUE(result.success);
history_count = result.count;