diff --git a/components/ai_chat/core/browser/engine/remote_completion_client_unittest.cc b/components/ai_chat/core/browser/engine/remote_completion_client_unittest.cc index 35c7a82dd91..95cc33f00ea 100644 --- a/components/ai_chat/core/browser/engine/remote_completion_client_unittest.cc +++ b/components/ai_chat/core/browser/engine/remote_completion_client_unittest.cc @@ -68,16 +68,12 @@ TEST_F(RemoteCompletionClientUnitTest, ParseJson) { run_loop2.Run(); // This test verifies that the callback is not called when the response is - // "[DONE]". We use a run loop to wait for the callback to be called, and we - // expect it to never be called. Therefore, we use RunUntilIdle() instead of - // Run(), since Run() would time out waiting for the callback to be called. - base::RunLoop run_loop3; + // "[DONE]". We use RunUntilIdle() to wait for the callback to be called, and + // we expect it to never be called. SendMesage( - base::BindRepeating([](base::RunLoop* run_loop, - const std::string& response) { run_loop->Quit(); }, - &run_loop3), + base::BindRepeating([](const std::string& response) { ADD_FAILURE(); }), "data: [DONE]"); - run_loop3.RunUntilIdle(); + task_environment_.RunUntilIdle(); } } // namespace ai_chat diff --git a/components/api_request_helper/api_request_helper_unittest.cc b/components/api_request_helper/api_request_helper_unittest.cc index 3dc4e50a4de..b09559aa4a8 100644 --- a/components/api_request_helper/api_request_helper_unittest.cc +++ b/components/api_request_helper/api_request_helper_unittest.cc @@ -138,10 +138,8 @@ TEST_F(ApiRequestHelperUnitTest, SanitizedRequest) { SendRequest("{", base::Value()); SendRequest("0", base::Value()); SendRequest("a", base::Value()); - // Android's sanitizer doesn't support trailing commas. -#if !BUILDFLAG(IS_ANDROID) - SendRequest("{\"a\":1,}", ParseJson("{\"a\":1}")); -#endif + // The sanitizer doesn't support trailing commas by default. + SendRequest("{\"a\":1,}", base::Value()); } TEST_F(ApiRequestHelperUnitTest, RequestWithConversion) { @@ -245,28 +243,21 @@ TEST_F(ApiRequestHelperUnitTest, SSEJsonParsing) { run_loop2.Run(); // This test verifies that the callback is not called when the response is - // "[DONE]". We use a run loop to wait for the callback to be called, and - // we expect it to never be called. - base::RunLoop run_loop3; - SendMessageSSEJSON("data: [DONE]", - base::BindRepeating( - [](base::RunLoop* run_loop, - data_decoder::DataDecoder::ValueOrError result) { - run_loop->Quit(); - }, - &run_loop3)); - run_loop3.RunUntilIdle(); + // "[DONE]". + SendMessageSSEJSON( + "data: [DONE]", + base::BindRepeating([](data_decoder::DataDecoder::ValueOrError result) { + ADD_FAILURE(); + })); + task_environment_.RunUntilIdle(); // Testing with no JSON and an empty string - base::RunLoop run_loop4; - SendMessageSSEJSON("", - base::BindRepeating( - [](base::RunLoop* run_loop, - data_decoder::DataDecoder::ValueOrError result) { - run_loop->Quit(); - }, - &run_loop4)); - run_loop4.RunUntilIdle(); + SendMessageSSEJSON( + "", + base::BindRepeating([](data_decoder::DataDecoder::ValueOrError result) { + ADD_FAILURE(); + })); + task_environment_.RunUntilIdle(); } } // namespace api_request_helper diff --git a/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc b/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc index 313aeb243fa..02004be5c70 100644 --- a/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc +++ b/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc @@ -257,6 +257,7 @@ TEST_F(WalletDataFilesInstallerUnitTest, OnDemandInstallAndParsing_EmptyPath) { .Times(1) .WillOnce(testing::Return(true)); SetOnDemandUpdateCallbackWithComponentReady(base::FilePath()); + RunUntilIdle(); CreateWallet(); RunUntilIdle();