diff --git a/browser/ai_chat/ai_chat_ui_browsertest.cc b/browser/ai_chat/ai_chat_ui_browsertest.cc index 91438dc8ba99..b3223822ca3d 100644 --- a/browser/ai_chat/ai_chat_ui_browsertest.cc +++ b/browser/ai_chat/ai_chat_ui_browsertest.cc @@ -287,20 +287,23 @@ IN_PROC_BROWSER_TEST_F(AIChatUIBrowserTest, ExtractionPrintDialog) { #endif // BUILDFLAG(IS_WIN) && defined(ADDRESS_SANITIZER) && // defined(ARCH_CPU_64_BITS) IN_PROC_BROWSER_TEST_F(AIChatUIBrowserTest, MAYBE_PrintPreviewFallback) { + auto run_loop = std::make_unique(); + // TODO(darkdh): Enable text_in_image.pdf when upstream fixes the hanging + // blank page issue. See https://github.com/brave/brave-browser/issues/41113 +#if 0 NavigateURL(https_server_.GetURL("a.com", "/text_in_image.pdf")); - auto run_loop = std::make_unique(); chat_tab_helper_->GeneratePageContent( base::BindLambdaForTesting([&run_loop](std::string text, bool is_video, std::string invalidation_token) { EXPECT_FALSE(is_video); - EXPECT_EQ( - text, - "This is the way.\n\nI have spoken.\nWherever I Go, He Goes."); + EXPECT_EQ(text, + "This is the way.\n\nI have spoken.\nWherever I Go, He Goes."); run_loop->Quit(); })); run_loop->Run(); run_loop = std::make_unique(); +#endif NavigateURL(https_server_.GetURL("a.com", "/canvas.html")); chat_tab_helper_->GeneratePageContent( diff --git a/components/ai_chat/content/browser/pdf_utils.cc b/components/ai_chat/content/browser/pdf_utils.cc index 1b5566c425d1..942419f6fbdd 100644 --- a/components/ai_chat/content/browser/pdf_utils.cc +++ b/components/ai_chat/content/browser/pdf_utils.cc @@ -6,6 +6,7 @@ #include "brave/components/ai_chat/content/browser/pdf_utils.h" #include "base/strings/strcat.h" +#include "components/strings/grit/components_strings.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "pdf/buildflags.h" @@ -127,6 +128,14 @@ bool IsPdfLoaded(const ui::AXNode* pdf_root) { return false; } +#if BUILDFLAG(ENABLE_PDF) + if (pdf_root->GetChildAtIndex(0)->GetChildAtIndex(0)->GetStringAttribute( + ax::mojom::StringAttribute::kName) == + l10n_util::GetStringUTF8(IDS_PDF_OCR_IN_PROGRESS)) { + return false; + } +#endif + return true; }