#include "chrome/browser/ai/ai_summarizer.h"
#include "base/test/mock_callback.h"
#include "base/test/run_until.h"
#include "chrome/browser/ai/ai_manager_keyed_service.h"
#include "chrome/browser/ai/ai_manager_keyed_service_factory.h"
#include "chrome/browser/optimization_guide/mock_optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/optimization_guide/core/mock_optimization_guide_model_executor.h"
#include "components/optimization_guide/proto/features/summarize.pb.h"
#include "components/optimization_guide/proto/string_value.pb.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom.h"
_;
AtMost;
NiceMock;
namespace {
MockSession;
MockSessionWrapper;
SummarizeRequest;
SummarizerOutputFormat;
SummarizerOutputLength;
SummarizerOutputType;
class MockSupportsUserData : public base::SupportsUserData { … };
class MockStreamingResponder : public blink::mojom::ModelStreamingResponder { … };
class AISummarizerUnitTest : public ChromeRenderViewHostTestHarness { … };
class MockCreateSummarizerClient
: public blink::mojom::AIManagerCreateSummarizerClient { … };
}
TEST_F(AISummarizerUnitTest, CreateSummarizerWithoutService) { … }
testing::Action<void(
const google::protobuf::MessageLite&,
optimization_guide::OptimizationGuideModelExecutionResultStreamingCallback)>
CreateModelExecutionMock(const std::string& expected_input,
const std::string& expected_context,
SummarizerOutputType expected_output_type,
SummarizerOutputFormat expected_output_format,
SummarizerOutputLength expected_output_length,
const std::string& output) { … }
TEST_F(AISummarizerUnitTest, SummarizeSuccess) { … }
TEST_F(AISummarizerUnitTest, SessionDetachedDuringSummarization) { … }
TEST_F(AISummarizerUnitTest, MultipleSummarizeWithOptions) { … }