From 9fd6b344237fc18018ca378834fadfd3cbf32f5d Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Fri, 13 Feb 2026 16:59:41 -0500 Subject: [PATCH] [cr147] Updates ContentAgentToolProviderTest.StopAllTasks. Chromium change: https://chromium.googlesource.com/chromium/src.git/+/e7192e53d75a6459c14d2d32be4123423b0282eb commit e7192e53d75a6459c14d2d32be4123423b0282eb Author: Dave Tapuska Date: Wed Nov 26 09:45:30 2025 -0800 [actor] Remove storage of inactive tasks Remove this killswitch. Bug: b:457401094 --- browser/ai_chat/BUILD.gn | 1 + .../ai_chat/content_agent_tool_provider_unittest.cc | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/browser/ai_chat/BUILD.gn b/browser/ai_chat/BUILD.gn index b0276a5e619..96e7f32a71d 100644 --- a/browser/ai_chat/BUILD.gn +++ b/browser/ai_chat/BUILD.gn @@ -305,6 +305,7 @@ source_set("unit_tests") { "//brave/components/ai_chat/core/browser", "//brave/components/ai_chat/core/common:test_support", "//chrome/browser/actor", + "//chrome/browser/actor:test_support", "//chrome/browser/actor/ui:test_support", "//components/optimization_guide/content/browser", "//components/optimization_guide/proto:optimization_guide_proto", diff --git a/browser/ai_chat/content_agent_tool_provider_unittest.cc b/browser/ai_chat/content_agent_tool_provider_unittest.cc index 27cbfc151d8..dac86b175a4 100644 --- a/browser/ai_chat/content_agent_tool_provider_unittest.cc +++ b/browser/ai_chat/content_agent_tool_provider_unittest.cc @@ -15,6 +15,7 @@ #include "brave/components/ai_chat/core/common/mojom/common.mojom.h" #include "chrome/browser/actor/actor_keyed_service.h" #include "chrome/browser/actor/actor_task.h" +#include "chrome/browser/actor/actor_test_util.h" #include "chrome/browser/actor/ui/test_support/mock_actor_ui_state_manager.h" #include "chrome/common/actor/action_result.h" #include "chrome/common/chrome_features.h" @@ -134,10 +135,14 @@ TEST_F(ContentAgentToolProviderTest, StopAllTasks) { tool_provider_->StopAllTasks(); - // Verify task is now in inactive tasks + // Tasks are deleted asynchronously. + EXPECT_TRUE(task); + EXPECT_EQ(task->GetState(), actor::ActorTask::State::kFinished); + actor::WaitForPostedTask(); + + // Verify task is now not in inactive tasks. EXPECT_EQ(actor_service_->GetActiveTasks().count(task_id), 0u); - // With kActorDoNotStoreCompletedTasks feature turned on by default upstream, - // completed tasks aren't stored in inactive tasks. + // Inactive tasks aren't stored. ASSERT_FALSE(task); }